Skip to content

Commit a0bf8e2

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 1c35fe4 commit a0bf8e2

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
@@ -515,7 +515,9 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
515515
setBooleanContents(ZeroOrOneBooleanContent);
516516
setBooleanVectorContents(ZeroOrNegativeOneBooleanContent);
517517

518-
if (Subtarget->isTargetMachO()) {
518+
const Triple &TT = TM.getTargetTriple();
519+
520+
if (TT.isOSBinFormatMachO()) {
519521
// Uses VFP for Thumb libfuncs if available.
520522
if (Subtarget->isThumb() && Subtarget->hasVFP2Base() &&
521523
Subtarget->hasARMOps() && !Subtarget->useSoftFloat()) {
@@ -589,8 +591,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
589591

590592
// RTLIB
591593
if (TM.isAAPCS_ABI() &&
592-
(Subtarget->isTargetAEABI() || Subtarget->isTargetGNUAEABI() ||
593-
Subtarget->isTargetMuslAEABI() || Subtarget->isTargetAndroid())) {
594+
(TT.isTargetAEABI() || TT.isTargetGNUAEABI() || TT.isTargetMuslAEABI() ||
595+
TT.isAndroid())) {
594596
// clang-format off
595597
static const struct {
596598
const RTLIB::Libcall Op;
@@ -712,7 +714,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
712714
// The half <-> float conversion functions are always soft-float on
713715
// non-watchos platforms, but are needed for some targets which use a
714716
// hard-float calling convention by default.
715-
if (!Subtarget->isTargetWatchABI()) {
717+
if (!TT.isWatchABI()) {
716718
if (TM.isAAPCS_ABI()) {
717719
setLibcallCallingConv(RTLIB::FPROUND_F32_F16, CallingConv::ARM_AAPCS);
718720
setLibcallCallingConv(RTLIB::FPROUND_F64_F16, CallingConv::ARM_AAPCS);
@@ -726,7 +728,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
726728

727729
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI they have
728730
// a __gnu_ prefix (which is the default).
729-
if (Subtarget->isTargetAEABI()) {
731+
if (TT.isTargetAEABI()) {
730732
static const struct {
731733
const RTLIB::Libcall Op;
732734
const char * const Name;
@@ -741,7 +743,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
741743
setLibcallName(LC.Op, LC.Name);
742744
setLibcallCallingConv(LC.Op, LC.CC);
743745
}
744-
} else if (!Subtarget->isTargetMachO()) {
746+
} else if (!TT.isOSBinFormatMachO()) {
745747
setLibcallName(RTLIB::FPROUND_F32_F16, "__gnu_f2h_ieee");
746748
setLibcallName(RTLIB::FPEXT_F16_F32, "__gnu_h2f_ieee");
747749
}
@@ -1227,7 +1229,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
12271229
setOperationAction(ISD::UDIV, MVT::i32, LibCall);
12281230
}
12291231

1230-
if (Subtarget->isTargetWindows() && !Subtarget->hasDivideInThumbMode()) {
1232+
if (TT.isOSWindows() && !Subtarget->hasDivideInThumbMode()) {
12311233
setOperationAction(ISD::SDIV, MVT::i32, Custom);
12321234
setOperationAction(ISD::UDIV, MVT::i32, Custom);
12331235

@@ -1239,9 +1241,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
12391241
setOperationAction(ISD::UREM, MVT::i32, Expand);
12401242

12411243
// Register based DivRem for AEABI (RTABI 4.2)
1242-
if (Subtarget->isTargetAEABI() || Subtarget->isTargetAndroid() ||
1243-
Subtarget->isTargetGNUAEABI() || Subtarget->isTargetMuslAEABI() ||
1244-
Subtarget->isTargetWindows()) {
1244+
if (TT.isTargetAEABI() || TT.isAndroid() || TT.isTargetGNUAEABI() ||
1245+
TT.isTargetMuslAEABI() || TT.isOSWindows()) {
12451246
setOperationAction(ISD::SREM, MVT::i64, Custom);
12461247
setOperationAction(ISD::UREM, MVT::i64, Custom);
12471248
HasStandaloneRem = false;
@@ -1271,7 +1272,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
12711272
setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);
12721273
setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
12731274

1274-
if (Subtarget->isTargetWindows())
1275+
if (TT.isOSWindows())
12751276
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
12761277
else
12771278
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Expand);
@@ -1326,8 +1327,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
13261327
}
13271328

13281329
// Compute supported atomic widths.
1329-
if (Subtarget->isTargetLinux() ||
1330-
(!Subtarget->isMClass() && Subtarget->hasV6Ops())) {
1330+
if (TT.isOSLinux() || (!Subtarget->isMClass() && Subtarget->hasV6Ops())) {
13311331
// For targets where __sync_* routines are reliably available, we use them
13321332
// if necessary.
13331333
//
@@ -1538,7 +1538,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
15381538

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

0 commit comments

Comments
 (0)