-
Notifications
You must be signed in to change notification settings - Fork 14.3k
X86: Start moving setLibcallName calls out of TargetLowering #142539
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
arsenm
merged 1 commit into
main
from
users/arsenm/x86/move-runtime-libcall-config-out-of-tli
Jun 3, 2025
Merged
X86: Start moving setLibcallName calls out of TargetLowering #142539
arsenm
merged 1 commit into
main
from
users/arsenm/x86/move-runtime-libcall-config-out-of-tli
Jun 3, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently configuration of runtime libcalls is split between RuntimeLibcallInfo and TargetLowering; RuntimeLibcallsInfo needs to have the complete information in order to support LTO with the runtime library included.
@llvm/pr-subscribers-llvm-ir @llvm/pr-subscribers-backend-x86 Author: Matt Arsenault (arsenm) ChangesCurrently configuration of runtime libcalls is split between RuntimeLibcallInfo Full diff: https://github.com/llvm/llvm-project/pull/142539.diff 2 Files Affected:
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 90c3bf0db0236..40a8cd9c9e0ec 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -224,6 +224,26 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
setLibcallName(RTLIB::POWI_F64, nullptr);
}
+ // Setup Windows compiler runtime calls.
+ if (TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment()) {
+ static const struct {
+ const RTLIB::Libcall Op;
+ const char *const Name;
+ const CallingConv::ID CC;
+ } LibraryCalls[] = {
+ {RTLIB::SDIV_I64, "_alldiv", CallingConv::X86_StdCall},
+ {RTLIB::UDIV_I64, "_aulldiv", CallingConv::X86_StdCall},
+ {RTLIB::SREM_I64, "_allrem", CallingConv::X86_StdCall},
+ {RTLIB::UREM_I64, "_aullrem", CallingConv::X86_StdCall},
+ {RTLIB::MUL_I64, "_allmul", CallingConv::X86_StdCall},
+ };
+
+ for (const auto &LC : LibraryCalls) {
+ setLibcallName(LC.Op, LC.Name);
+ setLibcallCallingConv(LC.Op, LC.CC);
+ }
+ }
+
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/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 71c699a318eb1..12a1c2991917e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -166,26 +166,6 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
addBypassSlowDiv(64, 32);
}
- // Setup Windows compiler runtime calls.
- if (Subtarget.isTargetWindowsMSVC() || Subtarget.isTargetWindowsItanium()) {
- static const struct {
- const RTLIB::Libcall Op;
- const char * const Name;
- const CallingConv::ID CC;
- } LibraryCalls[] = {
- { RTLIB::SDIV_I64, "_alldiv", CallingConv::X86_StdCall },
- { RTLIB::UDIV_I64, "_aulldiv", CallingConv::X86_StdCall },
- { RTLIB::SREM_I64, "_allrem", CallingConv::X86_StdCall },
- { RTLIB::UREM_I64, "_aullrem", CallingConv::X86_StdCall },
- { RTLIB::MUL_I64, "_allmul", CallingConv::X86_StdCall },
- };
-
- for (const auto &LC : LibraryCalls) {
- setLibcallName(LC.Op, LC.Name);
- setLibcallCallingConv(LC.Op, LC.CC);
- }
- }
-
if (Subtarget.canUseCMPXCHG16B())
setMaxAtomicSizeInBitsSupported(128);
else if (Subtarget.canUseCMPXCHG8B())
@@ -532,6 +512,8 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
setOperationAction(ISD::EH_SJLJ_SETJMP, MVT::i32, Custom);
setOperationAction(ISD::EH_SJLJ_LONGJMP, MVT::Other, Custom);
setOperationAction(ISD::EH_SJLJ_SETUP_DISPATCH, MVT::Other, Custom);
+
+ // FIXME: This should be set in RuntimeLibcallsInfo
if (TM.Options.ExceptionModel == ExceptionHandling::SjLj)
setLibcallName(RTLIB::UNWIND_RESUME, "_Unwind_SjLj_Resume");
|
nikic
approved these changes
Jun 3, 2025
rorth
pushed a commit
to rorth/llvm-project
that referenced
this pull request
Jun 11, 2025
DhruvSrivastavaX
pushed a commit
to DhruvSrivastavaX/lldb-for-aix
that referenced
this pull request
Jun 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently configuration of runtime libcalls is split between RuntimeLibcallInfo
and TargetLowering; RuntimeLibcallsInfo needs to have the complete information
in order to support LTO with the runtime library included.