-
Notifications
You must be signed in to change notification settings - Fork 14.8k
RuntimeLibcalls: Pass in exception handling type #144696
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
RuntimeLibcalls: Pass in exception handling type #144696
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) ChangesAll of the ABI options that influence libcall decisions need Full diff: https://github.com/llvm/llvm-project/pull/144696.diff 5 Files Affected:
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())
|
@llvm/pr-subscribers-backend-x86 Author: Matt Arsenault (arsenm) ChangesAll of the ABI options that influence libcall decisions need Full diff: https://github.com/llvm/llvm-project/pull/144696.diff 5 Files Affected:
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())
|
0aba739
to
9810123
Compare
dfb15b7
to
762a6b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
762a6b4
to
83bf964
Compare
All of the ABI options that influence libcall decisions need to be passed in.
9810123
to
98b6aae
Compare
All of the ABI options that influence libcall decisions need
to be passed in.