Skip to content

Commit 4079ed3

Browse files
authored
ARM: Move setting of more runtime libcalls to RuntimeLibcallInfo (#143826)
These are the easy cases that do not really depend on the subtarget, other than for the deceptive predicates on the subtarget class. Most of the rest of the cases here also do not, but this is obscured by going through helper predicates added onto the subtarget which hide dependence on TargetOptions.
1 parent edaac11 commit 4079ed3

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

llvm/lib/IR/RuntimeLibcalls.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,34 @@ static void setARMLibcallNames(RuntimeLibcallsInfo &Info, const Triple &TT) {
7979
}
8080
}
8181
}
82+
83+
if (TT.isOSWindows()) {
84+
static const struct {
85+
const RTLIB::Libcall Op;
86+
const char *const Name;
87+
const CallingConv::ID CC;
88+
} LibraryCalls[] = {
89+
{RTLIB::FPTOSINT_F32_I64, "__stoi64", CallingConv::ARM_AAPCS_VFP},
90+
{RTLIB::FPTOSINT_F64_I64, "__dtoi64", CallingConv::ARM_AAPCS_VFP},
91+
{RTLIB::FPTOUINT_F32_I64, "__stou64", CallingConv::ARM_AAPCS_VFP},
92+
{RTLIB::FPTOUINT_F64_I64, "__dtou64", CallingConv::ARM_AAPCS_VFP},
93+
{RTLIB::SINTTOFP_I64_F32, "__i64tos", CallingConv::ARM_AAPCS_VFP},
94+
{RTLIB::SINTTOFP_I64_F64, "__i64tod", CallingConv::ARM_AAPCS_VFP},
95+
{RTLIB::UINTTOFP_I64_F32, "__u64tos", CallingConv::ARM_AAPCS_VFP},
96+
{RTLIB::UINTTOFP_I64_F64, "__u64tod", CallingConv::ARM_AAPCS_VFP},
97+
};
98+
99+
for (const auto &LC : LibraryCalls) {
100+
Info.setLibcallName(LC.Op, LC.Name);
101+
Info.setLibcallCallingConv(LC.Op, LC.CC);
102+
}
103+
}
104+
105+
// Use divmod compiler-rt calls for iOS 5.0 and later.
106+
if (TT.isOSBinFormatMachO() && (!TT.isiOS() || !TT.isOSVersionLT(5, 0))) {
107+
Info.setLibcallName(RTLIB::SDIVREM_I32, "__divmodsi4");
108+
Info.setLibcallName(RTLIB::UDIVREM_I32, "__udivmodsi4");
109+
}
82110
}
83111

84112
static void setMSP430Libcalls(RuntimeLibcallsInfo &Info, const Triple &TT) {

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -708,36 +708,6 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
708708
}
709709
}
710710

711-
if (Subtarget->isTargetWindows()) {
712-
static const struct {
713-
const RTLIB::Libcall Op;
714-
const char * const Name;
715-
const CallingConv::ID CC;
716-
} LibraryCalls[] = {
717-
{ RTLIB::FPTOSINT_F32_I64, "__stoi64", CallingConv::ARM_AAPCS_VFP },
718-
{ RTLIB::FPTOSINT_F64_I64, "__dtoi64", CallingConv::ARM_AAPCS_VFP },
719-
{ RTLIB::FPTOUINT_F32_I64, "__stou64", CallingConv::ARM_AAPCS_VFP },
720-
{ RTLIB::FPTOUINT_F64_I64, "__dtou64", CallingConv::ARM_AAPCS_VFP },
721-
{ RTLIB::SINTTOFP_I64_F32, "__i64tos", CallingConv::ARM_AAPCS_VFP },
722-
{ RTLIB::SINTTOFP_I64_F64, "__i64tod", CallingConv::ARM_AAPCS_VFP },
723-
{ RTLIB::UINTTOFP_I64_F32, "__u64tos", CallingConv::ARM_AAPCS_VFP },
724-
{ RTLIB::UINTTOFP_I64_F64, "__u64tod", CallingConv::ARM_AAPCS_VFP },
725-
};
726-
727-
for (const auto &LC : LibraryCalls) {
728-
setLibcallName(LC.Op, LC.Name);
729-
setLibcallCallingConv(LC.Op, LC.CC);
730-
}
731-
}
732-
733-
// Use divmod compiler-rt calls for iOS 5.0 and later.
734-
if (Subtarget->isTargetMachO() &&
735-
!(Subtarget->isTargetIOS() &&
736-
Subtarget->getTargetTriple().isOSVersionLT(5, 0))) {
737-
setLibcallName(RTLIB::SDIVREM_I32, "__divmodsi4");
738-
setLibcallName(RTLIB::UDIVREM_I32, "__udivmodsi4");
739-
}
740-
741711
// The half <-> float conversion functions are always soft-float on
742712
// non-watchos platforms, but are needed for some targets which use a
743713
// hard-float calling convention by default.

0 commit comments

Comments
 (0)