@@ -22,92 +22,39 @@ using namespace RTLIB;
22
22
#undef GET_INIT_RUNTIME_LIBCALL_NAMES
23
23
#undef GET_SET_TARGET_RUNTIME_LIBCALL_SETS
24
24
25
- static void setARMLibcallNames (RuntimeLibcallsInfo &Info, const Triple &TT,
26
- FloatABI::ABIType FloatABIType, EABI EABIVersion,
27
- StringRef ABIName) {
28
- // The half <-> float conversion functions are always soft-float on
29
- // non-watchos platforms, but are needed for some targets which use a
30
- // hard-float calling convention by default.
31
- if (!TT.isWatchABI ()) {
32
- ARM::ARMABI TargetABI = ARM::computeTargetABI (TT, ABIName);
33
-
34
- if (TargetABI == ARM::ARM_ABI_AAPCS || TargetABI == ARM::ARM_ABI_AAPCS16) {
35
- Info.setLibcallImplCallingConv (RTLIB::__truncsfhf2,
36
- CallingConv::ARM_AAPCS);
37
- Info.setLibcallImplCallingConv (RTLIB::__truncdfhf2,
38
- CallingConv::ARM_AAPCS);
39
- Info.setLibcallImplCallingConv (RTLIB::__extendhfsf2,
40
- CallingConv::ARM_AAPCS);
41
- Info.setLibcallImplCallingConv (RTLIB::__gnu_h2f_ieee,
42
- CallingConv::ARM_AAPCS);
43
- Info.setLibcallImplCallingConv (RTLIB::__gnu_f2h_ieee,
44
- CallingConv::ARM_AAPCS);
45
- } else {
46
- Info.setLibcallImplCallingConv (RTLIB::__truncsfhf2,
47
- CallingConv::ARM_APCS);
48
- Info.setLibcallImplCallingConv (RTLIB::__truncdfhf2,
49
- CallingConv::ARM_APCS);
50
- Info.setLibcallImplCallingConv (RTLIB::__extendhfsf2,
51
- CallingConv::ARM_APCS);
52
- Info.setLibcallImplCallingConv (RTLIB::__gnu_h2f_ieee,
53
- CallingConv::ARM_APCS);
54
- Info.setLibcallImplCallingConv (RTLIB::__gnu_f2h_ieee,
55
- CallingConv::ARM_APCS);
56
- }
57
- }
58
-
59
- static const RTLIB::LibcallImpl AAPCS_Libcalls[] = {
60
- RTLIB::__aeabi_dadd, RTLIB::__aeabi_ddiv,
61
- RTLIB::__aeabi_dmul, RTLIB::__aeabi_dsub,
62
- RTLIB::__aeabi_dcmpeq__oeq, RTLIB::__aeabi_dcmpeq__une,
63
- RTLIB::__aeabi_dcmplt, RTLIB::__aeabi_dcmple,
64
- RTLIB::__aeabi_dcmpge, RTLIB::__aeabi_dcmpgt,
65
- RTLIB::__aeabi_dcmpun, RTLIB::__aeabi_fadd,
66
- RTLIB::__aeabi_fdiv, RTLIB::__aeabi_fmul,
67
- RTLIB::__aeabi_fsub, RTLIB::__aeabi_fcmpeq__oeq,
68
- RTLIB::__aeabi_fcmpeq__une, RTLIB::__aeabi_fcmplt,
69
- RTLIB::__aeabi_fcmple, RTLIB::__aeabi_fcmpge,
70
- RTLIB::__aeabi_fcmpgt, RTLIB::__aeabi_fcmpun,
71
- RTLIB::__aeabi_d2iz, RTLIB::__aeabi_d2uiz,
72
- RTLIB::__aeabi_d2lz, RTLIB::__aeabi_d2ulz,
73
- RTLIB::__aeabi_f2iz, RTLIB::__aeabi_f2uiz,
74
- RTLIB::__aeabi_f2lz, RTLIB::__aeabi_f2ulz,
75
- RTLIB::__aeabi_d2f, RTLIB::__aeabi_d2h,
76
- RTLIB::__aeabi_f2d, RTLIB::__aeabi_i2d,
77
- RTLIB::__aeabi_ui2d, RTLIB::__aeabi_l2d,
78
- RTLIB::__aeabi_ul2d, RTLIB::__aeabi_i2f,
79
- RTLIB::__aeabi_ui2f, RTLIB::__aeabi_l2f,
80
- RTLIB::__aeabi_ul2f, RTLIB::__aeabi_lmul,
81
- RTLIB::__aeabi_llsl, RTLIB::__aeabi_llsr,
82
- RTLIB::__aeabi_lasr, RTLIB::__aeabi_idiv,
83
- RTLIB::__aeabi_idivmod, RTLIB::__aeabi_uidivmod,
84
- RTLIB::__aeabi_ldivmod, RTLIB::__aeabi_uidiv,
85
- RTLIB::__aeabi_uldivmod, RTLIB::__aeabi_f2h,
86
- RTLIB::__aeabi_d2h, RTLIB::__aeabi_h2f,
87
- RTLIB::__aeabi_memcpy, RTLIB::__aeabi_memmove,
88
- RTLIB::__aeabi_memset, RTLIB::__aeabi_memcpy4,
89
- RTLIB::__aeabi_memcpy8, RTLIB::__aeabi_memmove4,
90
- RTLIB::__aeabi_memmove8, RTLIB::__aeabi_memset4,
91
- RTLIB::__aeabi_memset8, RTLIB::__aeabi_memclr,
92
- RTLIB::__aeabi_memclr4, RTLIB::__aeabi_memclr8};
93
-
94
- for (RTLIB::LibcallImpl Impl : AAPCS_Libcalls)
95
- Info.setLibcallImplCallingConv (Impl, CallingConv::ARM_AAPCS);
96
- }
97
-
98
25
// / Set default libcall names. If a target wants to opt-out of a libcall it
99
26
// / should be placed here.
100
27
void RuntimeLibcallsInfo::initLibcalls (const Triple &TT,
101
28
ExceptionHandling ExceptionModel,
102
29
FloatABI::ABIType FloatABI,
103
30
EABI EABIVersion, StringRef ABIName) {
104
- setTargetRuntimeLibcallSets (TT, FloatABI);
31
+ setTargetRuntimeLibcallSets (TT, FloatABI, EABIVersion, ABIName );
105
32
106
33
if (ExceptionModel == ExceptionHandling::SjLj)
107
34
setLibcallImpl (RTLIB::UNWIND_RESUME, RTLIB::_Unwind_SjLj_Resume);
108
35
109
36
if (TT.isARM () || TT.isThumb ()) {
110
- setARMLibcallNames (*this , TT, FloatABI, EABIVersion, ABIName);
37
+ // The half <-> float conversion functions are always soft-float on
38
+ // non-watchos platforms, but are needed for some targets which use a
39
+ // hard-float calling convention by default.
40
+ if (!TT.isWatchABI ()) {
41
+ if (isAAPCS_ABI (TT, ABIName)) {
42
+ setLibcallImplCallingConv (RTLIB::__truncsfhf2, CallingConv::ARM_AAPCS);
43
+ setLibcallImplCallingConv (RTLIB::__truncdfhf2, CallingConv::ARM_AAPCS);
44
+ setLibcallImplCallingConv (RTLIB::__extendhfsf2, CallingConv::ARM_AAPCS);
45
+ setLibcallImplCallingConv (RTLIB::__gnu_h2f_ieee,
46
+ CallingConv::ARM_AAPCS);
47
+ setLibcallImplCallingConv (RTLIB::__gnu_f2h_ieee,
48
+ CallingConv::ARM_AAPCS);
49
+ } else {
50
+ setLibcallImplCallingConv (RTLIB::__truncsfhf2, CallingConv::ARM_APCS);
51
+ setLibcallImplCallingConv (RTLIB::__truncdfhf2, CallingConv::ARM_APCS);
52
+ setLibcallImplCallingConv (RTLIB::__extendhfsf2, CallingConv::ARM_APCS);
53
+ setLibcallImplCallingConv (RTLIB::__gnu_h2f_ieee, CallingConv::ARM_APCS);
54
+ setLibcallImplCallingConv (RTLIB::__gnu_f2h_ieee, CallingConv::ARM_APCS);
55
+ }
56
+ }
57
+
111
58
return ;
112
59
}
113
60
@@ -162,6 +109,11 @@ RuntimeLibcallsInfo::getRecognizedLibcallImpls(StringRef FuncName) {
162
109
return make_range (EntriesBegin, EntriesEnd);
163
110
}
164
111
112
+ bool RuntimeLibcallsInfo::isAAPCS_ABI (const Triple &TT, StringRef ABIName) {
113
+ const ARM::ARMABI TargetABI = ARM::computeTargetABI (TT, ABIName);
114
+ return TargetABI == ARM::ARM_ABI_AAPCS || TargetABI == ARM::ARM_ABI_AAPCS16;
115
+ }
116
+
165
117
bool RuntimeLibcallsInfo::darwinHasExp10 (const Triple &TT) {
166
118
switch (TT.getOS ()) {
167
119
case Triple::MacOSX:
0 commit comments