[llvm] cb3d77d - AArch64: Partially move setting of libcall names out of TargetLowering (#142985)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 09:17:47 PDT 2025


Author: Matt Arsenault
Date: 2025-06-07T01:17:42+09:00
New Revision: cb3d77d107c863a0273f4084dfa3a378b6e54c86

URL: https://github.com/llvm/llvm-project/commit/cb3d77d107c863a0273f4084dfa3a378b6e54c86
DIFF: https://github.com/llvm/llvm-project/commit/cb3d77d107c863a0273f4084dfa3a378b6e54c86.diff

LOG: AArch64: Partially move setting of libcall names out of TargetLowering (#142985)

Move the parts that aren't dependent on the subtarget into
RuntimeLibcallInfo, which should contain the superset of all possible
runtime calls and be accurate outside of codegen.

Added: 
    

Modified: 
    llvm/lib/IR/RuntimeLibcalls.cpp
    llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 5ec5c72d3bf75..54227deddc53d 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -16,6 +16,21 @@ static cl::opt<bool>
     HexagonEnableFastMathRuntimeCalls("hexagon-fast-math", cl::Hidden,
                                       cl::desc("Enable Fast Math processing"));
 
+static void setAArch64LibcallNames(RuntimeLibcallsInfo &Info,
+                                   const Triple &TT) {
+  if (TT.isWindowsArm64EC()) {
+    // FIXME: are there calls we need to exclude from this?
+#define HANDLE_LIBCALL(code, name)                                             \
+  {                                                                            \
+    const char *libcallName = Info.getLibcallName(RTLIB::code);                \
+    if (libcallName && libcallName[0] != '#')                                  \
+      Info.setLibcallName(RTLIB::code, "#" #name);                             \
+  }
+#include "llvm/IR/RuntimeLibcalls.def"
+#undef HANDLE_LIBCALL
+  }
+}
+
 /// Set default libcall names. If a target wants to opt-out of a libcall it
 /// should be placed here.
 void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
@@ -247,6 +262,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
     }
   }
 
+  if (TT.getArch() == Triple::ArchType::aarch64)
+    setAArch64LibcallNames(*this, TT);
+
   if (TT.getArch() == Triple::ArchType::avr) {
     // Division rtlib functions (not supported), use divmod functions instead
     setLibcallName(RTLIB::SDIV_I8, nullptr);

diff  --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 449f64a201d4e..f3b0aec2123fe 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -1986,18 +1986,6 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
   for (ISD::NodeType Op : {ISD::FLDEXP, ISD::STRICT_FLDEXP, ISD::FFREXP})
     if (isOperationExpand(Op, MVT::f16))
       setOperationAction(Op, MVT::f16, Promote);
-
-  if (Subtarget->isWindowsArm64EC()) {
-    // FIXME: are there calls we need to exclude from this?
-#define HANDLE_LIBCALL(code, name)                                             \
-  {                                                                            \
-    const char *libcallName = getLibcallName(RTLIB::code);                     \
-    if (libcallName && libcallName[0] != '#')                                  \
-      setLibcallName(RTLIB::code, "#" #name);                                  \
-  }
-#include "llvm/IR/RuntimeLibcalls.def"
-#undef HANDLE_LIBCALL
-  }
 }
 
 void AArch64TargetLowering::addTypeForNEON(MVT VT) {


        


More information about the llvm-commits mailing list