Skip to content

Lanai: Use TableGen to set libcall calling conventions #146080

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

Open
wants to merge 1 commit into
base: users/arsenm/tablegen/add-calling-conv-libcall-impl-sets
Choose a base branch
from

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 27, 2025

No description provided.

Copy link
Contributor Author

arsenm commented Jun 27, 2025

@arsenm arsenm marked this pull request as ready for review June 27, 2025 14:22
@llvmbot
Copy link
Member

llvmbot commented Jun 27, 2025

@llvm/pr-subscribers-tablegen

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

Changes

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

2 Files Affected:

  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+12)
  • (modified) llvm/lib/Target/Lanai/LanaiISelLowering.cpp (-4)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 59e9481201de4..396dc45240412 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -1360,6 +1360,18 @@ def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl<SQRT_F64>;
 def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes
     : RuntimeLibcallImpl<HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES>;
 
+//===----------------------------------------------------------------------===//
+// Lanai Runtime Libcalls
+//===----------------------------------------------------------------------===//
+
+def isLanai : RuntimeLibcallPredicate<"TT.getArch() == Triple::lanai">;
+
+// Use fast calling convention for library functions.
+def LanaiSystemLibrary
+    : SystemRuntimeLibrary<isLanai, (add DefaultRuntimeLibcallImpls)> {
+  let DefaultLibcallCallingConv = FASTCC;
+}
+
 //===----------------------------------------------------------------------===//
 // Mips16 Runtime Libcalls
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp
index ec668ebaeab0d..272c7bc1a8db6 100644
--- a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp
+++ b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp
@@ -150,10 +150,6 @@ LanaiTargetLowering::LanaiTargetLowering(const TargetMachine &TM,
   // statements. Re-evaluate this on new benchmarks.
   setMinimumJumpTableEntries(100);
 
-  // Use fast calling convention for library functions.
-  for (RTLIB::LibcallImpl LC : RTLIB::libcall_impls())
-    setLibcallImplCallingConv(LC, CallingConv::Fast);
-
   MaxStoresPerMemset = 16; // For @llvm.memset -> sequence of stores
   MaxStoresPerMemsetOptSize = 8;
   MaxStoresPerMemcpy = 16; // For @llvm.memcpy -> sequence of stores

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

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

LGTM

@arsenm arsenm force-pushed the users/arsenm/lanai/use-tablegen-runtime-libcalls branch from 9cbb4db to c7f71df Compare June 28, 2025 02:35
@arsenm arsenm force-pushed the users/arsenm/tablegen/add-calling-conv-libcall-impl-sets branch from eaca233 to 370182a Compare June 28, 2025 02:35
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.

3 participants