[llvm] 1c35fe4 - RuntimeLibcalls: Pass in exception handling type (#144696)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 19 03:08:55 PDT 2025
Author: Matt Arsenault
Date: 2025-06-19T19:08:52+09:00
New Revision: 1c35fe4e6b2596d153da82b23d04a3779fb12730
URL: https://github.com/llvm/llvm-project/commit/1c35fe4e6b2596d153da82b23d04a3779fb12730
DIFF: https://github.com/llvm/llvm-project/commit/1c35fe4e6b2596d153da82b23d04a3779fb12730.diff
LOG: RuntimeLibcalls: Pass in exception handling type (#144696)
All of the ABI options that influence libcall decisions need
to be passed in.
Added:
Modified:
llvm/include/llvm/IR/RuntimeLibcalls.h
llvm/lib/CodeGen/TargetLoweringBase.cpp
llvm/lib/IR/RuntimeLibcalls.cpp
llvm/lib/Target/VE/VEISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index a6a180f5ed8db..71f38bedf17e0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -54,10 +54,12 @@ static inline auto libcalls() {
/// A simple container for information about the supported runtime calls.
struct RuntimeLibcallsInfo {
- explicit RuntimeLibcallsInfo(const Triple &TT,
- FloatABI::ABIType FloatABI = FloatABI::Default,
- EABI EABIVersion = EABI::Default) {
- initLibcalls(TT, FloatABI, EABIVersion);
+ explicit RuntimeLibcallsInfo(
+ const Triple &TT,
+ ExceptionHandling ExceptionModel = ExceptionHandling::None,
+ FloatABI::ABIType FloatABI = FloatABI::Default,
+ EABI EABIVersion = EABI::Default) {
+ initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion);
}
/// Rename the default libcall routine name for the specified libcall.
@@ -147,8 +149,8 @@ struct RuntimeLibcallsInfo {
/// Set default libcall names. If a target wants to opt-out of a libcall it
/// should be placed here.
- LLVM_ABI void initLibcalls(const Triple &TT, FloatABI::ABIType FloatABI,
- EABI ABIType);
+ LLVM_ABI void initLibcalls(const Triple &TT, ExceptionHandling ExceptionModel,
+ FloatABI::ABIType FloatABI, EABI ABIType);
};
} // namespace RTLIB
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 2b5087cd38f55..41e73b8530937 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -632,8 +632,8 @@ void RTLIB::initCmpLibcallCCs(ISD::CondCode *CmpLibcallCCs) {
/// NOTE: The TargetMachine owns TLOF.
TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm)
- : TM(tm), Libcalls(TM.getTargetTriple(), TM.Options.FloatABIType,
- TM.Options.EABIVersion) {
+ : TM(tm), Libcalls(TM.getTargetTriple(), TM.Options.ExceptionModel,
+ TM.Options.FloatABIType, TM.Options.EABIVersion) {
initActions();
// Perform these initializations only once.
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 74dccdf172d45..ad2904d6d2ea6 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -357,6 +357,7 @@ static void setLongDoubleIsF128Libm(RuntimeLibcallsInfo &Info,
/// Set default libcall names. If a target wants to opt-out of a libcall it
/// should be placed here.
void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
+ ExceptionHandling ExceptionModel,
FloatABI::ABIType FloatABI,
EABI EABIVersion) {
initSoftFloatCmpLibcallPredicates();
@@ -373,6 +374,11 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
if (TT.isX86() && TT.isGNUEnvironment())
setLongDoubleIsF128Libm(*this, /*FiniteOnlyFuncs=*/true);
+ if (TT.isX86() || TT.isVE()) {
+ if (ExceptionModel == ExceptionHandling::SjLj)
+ setLibcallName(RTLIB::UNWIND_RESUME, "_Unwind_SjLj_Resume");
+ }
+
// For IEEE quad-precision libcall names, PPC uses "kf" instead of "tf".
if (TT.isPPC()) {
setLibcallName(RTLIB::ADD_F128, "__addkf3");
diff --git a/llvm/lib/Target/VE/VEISelLowering.cpp b/llvm/lib/Target/VE/VEISelLowering.cpp
index b5a0d26abbf8e..98c5fdd138986 100644
--- a/llvm/lib/Target/VE/VEISelLowering.cpp
+++ b/llvm/lib/Target/VE/VEISelLowering.cpp
@@ -298,8 +298,6 @@ void VETargetLowering::initSPUActions() {
setOperationAction(ISD::EH_SJLJ_LONGJMP, MVT::Other, Custom);
setOperationAction(ISD::EH_SJLJ_SETJMP, MVT::i32, Custom);
setOperationAction(ISD::EH_SJLJ_SETUP_DISPATCH, MVT::Other, Custom);
- if (TM.Options.ExceptionModel == ExceptionHandling::SjLj)
- setLibcallName(RTLIB::UNWIND_RESUME, "_Unwind_SjLj_Resume");
/// } SJLJ instructions
// Intrinsic instructions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 4751361c71f2c..defb7730b4c7d 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -513,10 +513,6 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
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");
-
// Darwin ABI issue.
for (auto VT : { MVT::i32, MVT::i64 }) {
if (VT == MVT::i64 && !Subtarget.is64Bit())
More information about the llvm-commits
mailing list