Skip to content

SystemZ: Move runtime libcall setting out of TargetLowering #142622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 3, 2025

RuntimeLibcallInfo needs to be correct outside of codegen contexts.

RuntimeLibcallInfo needs to be correct outside of codegen contexts.
Copy link
Contributor Author

arsenm commented Jun 3, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm requested review from JonPsson and uweigand June 3, 2025 14:57
@arsenm arsenm marked this pull request as ready for review June 3, 2025 14:57
@llvmbot
Copy link
Member

llvmbot commented Jun 3, 2025

@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-backend-systemz

Author: Matt Arsenault (arsenm)

Changes

RuntimeLibcallInfo needs to be correct outside of codegen contexts.


Full diff: https://github.com/llvm/llvm-project/pull/142622.diff

3 Files Affected:

  • (modified) llvm/lib/IR/RuntimeLibcalls.cpp (+13)
  • (renamed) llvm/lib/IR/ZOSLibcallNames.def ()
  • (modified) llvm/lib/Target/SystemZ/SystemZISelLowering.cpp (-13)
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 {

@llvmbot llvmbot added the llvm:ir label Jun 3, 2025
@redstar redstar self-requested a review June 3, 2025 15:42
Copy link
Member

@redstar redstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@uweigand uweigand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well, thanks!

@arsenm arsenm merged commit 0a3e9aa into main Jun 3, 2025
11 of 16 checks passed
@arsenm arsenm deleted the users/arsenm/systemz/move-runtime-libcall-config-out-of-tli branch June 3, 2025 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants