Skip to content

Commit 6b0126f

Browse files
committed
ARM: Avoid using isTarget wrappers around Triple predicates
These are module level properties, and querying them through a function-level subtarget context is confusing. Plus we don't need an aliased name. This doesn't avoid all the uses, just the ones in the TargetLowering constructor.
1 parent 3bf268a commit 6b0126f

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,9 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
508508
setBooleanContents(ZeroOrOneBooleanContent);
509509
setBooleanVectorContents(ZeroOrNegativeOneBooleanContent);
510510

511-
if (Subtarget->isTargetMachO()) {
511+
const Triple &TT = TM.getTargetTriple();
512+
513+
if (TT.isOSBinFormatMachO()) {
512514
// Uses VFP for Thumb libfuncs if available.
513515
if (Subtarget->isThumb() && Subtarget->hasVFP2Base() &&
514516
Subtarget->hasARMOps() && !Subtarget->useSoftFloat()) {
@@ -582,8 +584,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
582584

583585
// RTLIB
584586
if (Subtarget->isAAPCS_ABI() &&
585-
(Subtarget->isTargetAEABI() || Subtarget->isTargetGNUAEABI() ||
586-
Subtarget->isTargetMuslAEABI() || Subtarget->isTargetAndroid())) {
587+
(TT.isTargetAEABI() || TT.isTargetGNUAEABI() || TT.isTargetMuslAEABI() ||
588+
TT.isAndroid())) {
587589
// clang-format off
588590
static const struct {
589591
const RTLIB::Libcall Op;
@@ -705,7 +707,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
705707
// The half <-> float conversion functions are always soft-float on
706708
// non-watchos platforms, but are needed for some targets which use a
707709
// hard-float calling convention by default.
708-
if (!Subtarget->isTargetWatchABI()) {
710+
if (!TT.isWatchABI()) {
709711
if (Subtarget->isAAPCS_ABI()) {
710712
setLibcallCallingConv(RTLIB::FPROUND_F32_F16, CallingConv::ARM_AAPCS);
711713
setLibcallCallingConv(RTLIB::FPROUND_F64_F16, CallingConv::ARM_AAPCS);
@@ -719,7 +721,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
719721

720722
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI they have
721723
// a __gnu_ prefix (which is the default).
722-
if (Subtarget->isTargetAEABI()) {
724+
if (TT.isTargetAEABI()) {
723725
static const struct {
724726
const RTLIB::Libcall Op;
725727
const char * const Name;
@@ -734,7 +736,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
734736
setLibcallName(LC.Op, LC.Name);
735737
setLibcallCallingConv(LC.Op, LC.CC);
736738
}
737-
} else if (!Subtarget->isTargetMachO()) {
739+
} else if (!TT.isOSBinFormatMachO()) {
738740
setLibcallName(RTLIB::FPROUND_F32_F16, "__gnu_f2h_ieee");
739741
setLibcallName(RTLIB::FPEXT_F16_F32, "__gnu_h2f_ieee");
740742
}
@@ -1220,7 +1222,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
12201222
setOperationAction(ISD::UDIV, MVT::i32, LibCall);
12211223
}
12221224

1223-
if (Subtarget->isTargetWindows() && !Subtarget->hasDivideInThumbMode()) {
1225+
if (TT.isOSWindows() && !Subtarget->hasDivideInThumbMode()) {
12241226
setOperationAction(ISD::SDIV, MVT::i32, Custom);
12251227
setOperationAction(ISD::UDIV, MVT::i32, Custom);
12261228

@@ -1232,9 +1234,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
12321234
setOperationAction(ISD::UREM, MVT::i32, Expand);
12331235

12341236
// Register based DivRem for AEABI (RTABI 4.2)
1235-
if (Subtarget->isTargetAEABI() || Subtarget->isTargetAndroid() ||
1236-
Subtarget->isTargetGNUAEABI() || Subtarget->isTargetMuslAEABI() ||
1237-
Subtarget->isTargetWindows()) {
1237+
if (TT.isTargetAEABI() || TT.isAndroid() || TT.isTargetGNUAEABI() ||
1238+
TT.isTargetMuslAEABI() || TT.isOSWindows()) {
12381239
setOperationAction(ISD::SREM, MVT::i64, Custom);
12391240
setOperationAction(ISD::UREM, MVT::i64, Custom);
12401241
HasStandaloneRem = false;
@@ -1264,7 +1265,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
12641265
setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);
12651266
setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
12661267

1267-
if (Subtarget->isTargetWindows())
1268+
if (TT.isOSWindows())
12681269
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
12691270
else
12701271
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Expand);
@@ -1319,8 +1320,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
13191320
}
13201321

13211322
// Compute supported atomic widths.
1322-
if (Subtarget->isTargetLinux() ||
1323-
(!Subtarget->isMClass() && Subtarget->hasV6Ops())) {
1323+
if (TT.isOSLinux() || (!Subtarget->isMClass() && Subtarget->hasV6Ops())) {
13241324
// For targets where __sync_* routines are reliably available, we use them
13251325
// if necessary.
13261326
//
@@ -1531,7 +1531,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
15311531

15321532
// On MSVC, both 32-bit and 64-bit, ldexpf(f32) is not defined. MinGW has
15331533
// it, but it's just a wrapper around ldexp.
1534-
if (Subtarget->isTargetWindows()) {
1534+
if (TT.isOSWindows()) {
15351535
for (ISD::NodeType Op : {ISD::FLDEXP, ISD::STRICT_FLDEXP, ISD::FFREXP})
15361536
if (isOperationExpand(Op, MVT::f32))
15371537
setOperationAction(Op, MVT::f32, Promote);

0 commit comments

Comments
 (0)