[llvm] 4079ed3 - ARM: Move setting of more runtime libcalls to RuntimeLibcallInfo (#143826)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 12 01:35:59 PDT 2025
Author: Matt Arsenault
Date: 2025-06-12T17:35:55+09:00
New Revision: 4079ed3c9e72d64746c5d3f05fc585d844c1e8a7
URL: https://github.com/llvm/llvm-project/commit/4079ed3c9e72d64746c5d3f05fc585d844c1e8a7
DIFF: https://github.com/llvm/llvm-project/commit/4079ed3c9e72d64746c5d3f05fc585d844c1e8a7.diff
LOG: 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.
Added:
Modified:
llvm/lib/IR/RuntimeLibcalls.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 31013310a746d..331b319511aed 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -79,6 +79,34 @@ static void setARMLibcallNames(RuntimeLibcallsInfo &Info, const Triple &TT) {
}
}
}
+
+ if (TT.isOSWindows()) {
+ static const struct {
+ const RTLIB::Libcall Op;
+ const char *const Name;
+ const CallingConv::ID CC;
+ } LibraryCalls[] = {
+ {RTLIB::FPTOSINT_F32_I64, "__stoi64", CallingConv::ARM_AAPCS_VFP},
+ {RTLIB::FPTOSINT_F64_I64, "__dtoi64", CallingConv::ARM_AAPCS_VFP},
+ {RTLIB::FPTOUINT_F32_I64, "__stou64", CallingConv::ARM_AAPCS_VFP},
+ {RTLIB::FPTOUINT_F64_I64, "__dtou64", CallingConv::ARM_AAPCS_VFP},
+ {RTLIB::SINTTOFP_I64_F32, "__i64tos", CallingConv::ARM_AAPCS_VFP},
+ {RTLIB::SINTTOFP_I64_F64, "__i64tod", CallingConv::ARM_AAPCS_VFP},
+ {RTLIB::UINTTOFP_I64_F32, "__u64tos", CallingConv::ARM_AAPCS_VFP},
+ {RTLIB::UINTTOFP_I64_F64, "__u64tod", CallingConv::ARM_AAPCS_VFP},
+ };
+
+ for (const auto &LC : LibraryCalls) {
+ Info.setLibcallName(LC.Op, LC.Name);
+ Info.setLibcallCallingConv(LC.Op, LC.CC);
+ }
+ }
+
+ // Use divmod compiler-rt calls for iOS 5.0 and later.
+ if (TT.isOSBinFormatMachO() && (!TT.isiOS() || !TT.isOSVersionLT(5, 0))) {
+ Info.setLibcallName(RTLIB::SDIVREM_I32, "__divmodsi4");
+ Info.setLibcallName(RTLIB::UDIVREM_I32, "__udivmodsi4");
+ }
}
static void setMSP430Libcalls(RuntimeLibcallsInfo &Info, const Triple &TT) {
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 8455eef9bad32..d2e910a248f23 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -708,36 +708,6 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
}
}
- if (Subtarget->isTargetWindows()) {
- static const struct {
- const RTLIB::Libcall Op;
- const char * const Name;
- const CallingConv::ID CC;
- } LibraryCalls[] = {
- { RTLIB::FPTOSINT_F32_I64, "__stoi64", CallingConv::ARM_AAPCS_VFP },
- { RTLIB::FPTOSINT_F64_I64, "__dtoi64", CallingConv::ARM_AAPCS_VFP },
- { RTLIB::FPTOUINT_F32_I64, "__stou64", CallingConv::ARM_AAPCS_VFP },
- { RTLIB::FPTOUINT_F64_I64, "__dtou64", CallingConv::ARM_AAPCS_VFP },
- { RTLIB::SINTTOFP_I64_F32, "__i64tos", CallingConv::ARM_AAPCS_VFP },
- { RTLIB::SINTTOFP_I64_F64, "__i64tod", CallingConv::ARM_AAPCS_VFP },
- { RTLIB::UINTTOFP_I64_F32, "__u64tos", CallingConv::ARM_AAPCS_VFP },
- { RTLIB::UINTTOFP_I64_F64, "__u64tod", CallingConv::ARM_AAPCS_VFP },
- };
-
- for (const auto &LC : LibraryCalls) {
- setLibcallName(LC.Op, LC.Name);
- setLibcallCallingConv(LC.Op, LC.CC);
- }
- }
-
- // Use divmod compiler-rt calls for iOS 5.0 and later.
- if (Subtarget->isTargetMachO() &&
- !(Subtarget->isTargetIOS() &&
- Subtarget->getTargetTriple().isOSVersionLT(5, 0))) {
- setLibcallName(RTLIB::SDIVREM_I32, "__divmodsi4");
- setLibcallName(RTLIB::UDIVREM_I32, "__udivmodsi4");
- }
-
// The half <-> float conversion functions are always soft-float on
// non-watchos platforms, but are needed for some targets which use a
// hard-float calling convention by default.
More information about the llvm-commits
mailing list