[llvm] 0a3e9aa - SystemZ: Move runtime libcall setting out of TargetLowering (#142622)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 14:21:49 PDT 2025


Author: Matt Arsenault
Date: 2025-06-04T06:21:46+09:00
New Revision: 0a3e9aa336d1926691e1353e7251ff0704c32a69

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

LOG: SystemZ: Move runtime libcall setting out of TargetLowering (#142622)

RuntimeLibcallInfo needs to be correct outside of codegen contexts.

Added: 
    llvm/lib/IR/ZOSLibcallNames.def

Modified: 
    llvm/lib/IR/RuntimeLibcalls.cpp
    llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Removed: 
    llvm/lib/Target/SystemZ/ZOSLibcallNames.def


################################################################################
diff  --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index db0373055160c..d8451b818e8e3 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -278,4 +278,17 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
     }
     setLibcallName(RTLIB::MULO_I128, nullptr);
   }
+
+  if (TT.isSystemZ() && TT.isOSzOS()) {
+    struct RTLibCallMapping {
+      RTLIB::Libcall Code;
+      const char *Name;
+    };
+    static RTLibCallMapping RTLibCallCommon[] = {
+#define HANDLE_LIBCALL(code, name) {RTLIB::code, name},
+#include "ZOSLibcallNames.def"
+    };
+    for (auto &E : RTLibCallCommon)
+      setLibcallName(E.Code, E.Name);
+  }
 }

diff  --git a/llvm/lib/Target/SystemZ/ZOSLibcallNames.def b/llvm/lib/IR/ZOSLibcallNames.def
similarity index 100%
rename from llvm/lib/Target/SystemZ/ZOSLibcallNames.def
rename to llvm/lib/IR/ZOSLibcallNames.def

diff  --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index 3b86a9bc58790..f06246706aaa9 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -828,19 +828,6 @@ SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &TM,
 
   // Default to having -disable-strictnode-mutation on
   IsStrictFPEnabled = true;
-
-  if (Subtarget.isTargetzOS()) {
-    struct RTLibCallMapping {
-      RTLIB::Libcall Code;
-      const char *Name;
-    };
-    static RTLibCallMapping RTLibCallCommon[] = {
-#define HANDLE_LIBCALL(code, name) {RTLIB::code, name},
-#include "ZOSLibcallNames.def"
-    };
-    for (auto &E : RTLibCallCommon)
-      setLibcallName(E.Code, E.Name);
-  }
 }
 
 bool SystemZTargetLowering::useSoftFloat() const {


        


More information about the llvm-commits mailing list