Skip to content

RISCV: Start moving runtime libcall config to tablegen #147652

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 Jul 9, 2025

This doesn't yet attempt to move the OS dependent configuration
shared with other targets. Removes __riscv_flush_icache from the
default set so it's no longer falsely reported as available for
other targets.

Copy link
Contributor Author

arsenm commented Jul 9, 2025

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

@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-llvm-selectiondag
@llvm/pr-subscribers-backend-hexagon

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

Changes

This doesn't yet attempt to move the OS dependent configuration
shared with other targets. Removes __riscv_flush_icache from the
default set so it's no longer falsely reported as available for
other targets.


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

1 Files Affected:

  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+14-1)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index ee4892ee186cd..fabfaf89b5aa0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -668,7 +668,6 @@ def __llvm_deoptimize : RuntimeLibcallImpl<DEOPTIMIZE>;
 
 // Clear cache
 def __clear_cache : RuntimeLibcallImpl<CLEAR_CACHE>;
-def __riscv_flush_icache : RuntimeLibcallImpl<RISCV_FLUSH_ICACHE>;
 
 //--------------------------------------------------------------------
 // libm
@@ -928,6 +927,8 @@ def bzero : RuntimeLibcallImpl<BZERO>;
 def __bzero : RuntimeLibcallImpl<BZERO>;
 def _Unwind_SjLj_Resume : RuntimeLibcallImpl<UNWIND_RESUME>;
 
+def __riscv_flush_icache : RuntimeLibcallImpl<RISCV_FLUSH_ICACHE>;
+
 //===----------------------------------------------------------------------===//
 // F128 libm Runtime Libcalls
 //===----------------------------------------------------------------------===//
@@ -1846,6 +1847,18 @@ def PPCSystemLibrary
            AvailableIf<memcpy, isNotAIX>,
            LibcallImpls<(add Int128RTLibcalls), isPPC64>)>;
 
+//===----------------------------------------------------------------------===//
+// RISCV Runtime Libcalls
+//===----------------------------------------------------------------------===//
+
+def isRISCV : RuntimeLibcallPredicate<"TT.isRISCV()">;
+def isRISCV64 : RuntimeLibcallPredicate<"TT.isRISCV64()">;
+
+def RISCVSystemLibrary
+    : SystemRuntimeLibrary<isRISCV,
+      (add DefaultRuntimeLibcallImpls, __riscv_flush_icache,
+           LibcallImpls<(add Int128RTLibcalls), isRISCV64>)>;
+
 //===----------------------------------------------------------------------===//
 // SPARC Runtime Libcalls
 //===----------------------------------------------------------------------===//

@arsenm arsenm requested a review from topperc July 9, 2025 05:22
@arsenm arsenm marked this pull request as ready for review July 9, 2025 05:22
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/stop-using-defset-default-libcall-impls branch from cab40d4 to 170b353 Compare July 9, 2025 08:20
@arsenm arsenm force-pushed the users/arsenm/riscv/start-moving-runtime-libcalls-tablegen branch from 7f81f86 to ba16f00 Compare July 9, 2025 08:21
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/stop-using-defset-default-libcall-impls branch from 170b353 to 652b9c5 Compare July 10, 2025 10:41
@arsenm arsenm force-pushed the users/arsenm/riscv/start-moving-runtime-libcalls-tablegen branch from ba16f00 to f4304a2 Compare July 10, 2025 10:42
Copy link
Contributor Author

arsenm commented Jul 13, 2025

Merge activity

  • Jul 13, 1:37 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 13, 1:48 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 13, 1:51 AM UTC: @arsenm merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/stop-using-defset-default-libcall-impls branch from 652b9c5 to cf3a31e Compare July 13, 2025 01:45
Base automatically changed from users/arsenm/runtime-libcalls/stop-using-defset-default-libcall-impls to main July 13, 2025 01:47
This doesn't yet attempt to move the OS dependent configuration
shared with other targets. Removes __riscv_flush_icache from the
default set so it's no longer falsely reported as available for
other targets.
@arsenm arsenm force-pushed the users/arsenm/riscv/start-moving-runtime-libcalls-tablegen branch from f4304a2 to c9c599f Compare July 13, 2025 01:48
@arsenm arsenm merged commit d92e6f0 into main Jul 13, 2025
7 of 9 checks passed
@arsenm arsenm deleted the users/arsenm/riscv/start-moving-runtime-libcalls-tablegen branch July 13, 2025 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants