-
Notifications
You must be signed in to change notification settings - Fork 14.7k
ARM: Move calling conv config to RuntimeLibcalls #152065
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
arsenm
wants to merge
1
commit into
main
Choose a base branch
from
users/arsenm/arm/move-calling-conv-config-runtime-libcalls
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ARM: Move calling conv config to RuntimeLibcalls #152065
arsenm
wants to merge
1
commit into
main
from
users/arsenm/arm/move-calling-conv-config-runtime-libcalls
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
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-llvm-ir @llvm/pr-subscribers-backend-arm Author: Matt Arsenault (arsenm) ChangesConsolidate module level ABI into RuntimeLibcalls Full diff: https://github.com/llvm/llvm-project/pull/152065.diff 2 Files Affected:
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index b6e2cac5f7b04..0eb7ed4c3e619 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -9,6 +9,7 @@
#include "llvm/IR/RuntimeLibcalls.h"
#include "llvm/ADT/StringTable.h"
#include "llvm/Support/Debug.h"
+#include "llvm/TargetParser/ARMTargetParser.h"
#define DEBUG_TYPE "runtime-libcalls-info"
@@ -22,8 +23,39 @@ using namespace RTLIB;
#undef GET_SET_TARGET_RUNTIME_LIBCALL_SETS
static void setARMLibcallNames(RuntimeLibcallsInfo &Info, const Triple &TT,
- FloatABI::ABIType FloatABIType,
- EABI EABIVersion) {
+ FloatABI::ABIType FloatABIType, EABI EABIVersion,
+ StringRef ABIName) {
+ // The half <-> float conversion functions are always soft-float on
+ // non-watchos platforms, but are needed for some targets which use a
+ // hard-float calling convention by default.
+ if (!TT.isWatchABI()) {
+ ARM::ARMABI TargetABI = ARM::computeTargetABI(TT, ABIName);
+
+ if (TargetABI == ARM::ARM_ABI_AAPCS || TargetABI == ARM::ARM_ABI_AAPCS16) {
+ Info.setLibcallImplCallingConv(RTLIB::__truncsfhf2,
+ CallingConv::ARM_AAPCS);
+ Info.setLibcallImplCallingConv(RTLIB::__truncdfhf2,
+ CallingConv::ARM_AAPCS);
+ Info.setLibcallImplCallingConv(RTLIB::__extendhfsf2,
+ CallingConv::ARM_AAPCS);
+ Info.setLibcallImplCallingConv(RTLIB::__gnu_h2f_ieee,
+ CallingConv::ARM_AAPCS);
+ Info.setLibcallImplCallingConv(RTLIB::__gnu_f2h_ieee,
+ CallingConv::ARM_AAPCS);
+ } else {
+ Info.setLibcallImplCallingConv(RTLIB::__truncsfhf2,
+ CallingConv::ARM_APCS);
+ Info.setLibcallImplCallingConv(RTLIB::__truncdfhf2,
+ CallingConv::ARM_APCS);
+ Info.setLibcallImplCallingConv(RTLIB::__extendhfsf2,
+ CallingConv::ARM_APCS);
+ Info.setLibcallImplCallingConv(RTLIB::__gnu_h2f_ieee,
+ CallingConv::ARM_APCS);
+ Info.setLibcallImplCallingConv(RTLIB::__gnu_f2h_ieee,
+ CallingConv::ARM_APCS);
+ }
+ }
+
static const RTLIB::LibcallImpl AAPCS_Libcalls[] = {
RTLIB::__aeabi_dadd, RTLIB::__aeabi_ddiv,
RTLIB::__aeabi_dmul, RTLIB::__aeabi_dsub,
@@ -77,7 +109,7 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
setLibcallImpl(RTLIB::UNWIND_RESUME, RTLIB::_Unwind_SjLj_Resume);
if (TT.isARM() || TT.isThumb()) {
- setARMLibcallNames(*this, TT, FloatABI, EABIVersion);
+ setARMLibcallNames(*this, TT, FloatABI, EABIVersion, ABIName);
return;
}
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 936625606e315..183e64e1c88d9 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -711,25 +711,6 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
}
}
- // The half <-> float conversion functions are always soft-float on
- // non-watchos platforms, but are needed for some targets which use a
- // hard-float calling convention by default.
- if (!TT.isWatchABI()) {
- if (TM.isAAPCS_ABI()) {
- setLibcallImplCallingConv(RTLIB::__truncsfhf2, CallingConv::ARM_AAPCS);
- setLibcallImplCallingConv(RTLIB::__truncdfhf2, CallingConv::ARM_AAPCS);
- setLibcallImplCallingConv(RTLIB::__extendhfsf2, CallingConv::ARM_AAPCS);
- setLibcallImplCallingConv(RTLIB::__gnu_h2f_ieee, CallingConv::ARM_AAPCS);
- setLibcallImplCallingConv(RTLIB::__gnu_f2h_ieee, CallingConv::ARM_AAPCS);
- } else {
- setLibcallImplCallingConv(RTLIB::__truncsfhf2, CallingConv::ARM_APCS);
- setLibcallImplCallingConv(RTLIB::__truncdfhf2, CallingConv::ARM_APCS);
- setLibcallImplCallingConv(RTLIB::__extendhfsf2, CallingConv::ARM_APCS);
- setLibcallImplCallingConv(RTLIB::__gnu_h2f_ieee, CallingConv::ARM_APCS);
- setLibcallImplCallingConv(RTLIB::__gnu_f2h_ieee, CallingConv::ARM_APCS);
- }
- }
-
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI they have
// a __gnu_ prefix (which is the default).
if (TT.isTargetAEABI()) {
|
f012e8f
to
ea3013e
Compare
ea3013e
to
2af18c4
Compare
Consolidate module level ABI into RuntimeLibcalls
2af18c4
to
c644888
Compare
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.
Consolidate module level ABI into RuntimeLibcalls