-
Notifications
You must be signed in to change notification settings - Fork 14.3k
TableGen: Allow defining sets of runtime libraries #144978
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
base: users/arsenm/aarch64/add-libcall-impl-for-sc-mem-functions
Are you sure you want to change the base?
TableGen: Allow defining sets of runtime libraries #144978
Conversation
Add a way to define a SystemLibrary for a complete set of libcalls, subdivided by a predicate based on the triple. Libraries can be defined using dag set operations, and the prior default set can be subtracted from and added to (though I think eventually all targets should move to explicit opt-ins. We're still doing things like reporting ppcf128 libcalls as available dy default on all targets). Start migrating some of the easier targets to only use the new system. Targets that don't define a SystemLibrary are still manually mutating a table set to the old defaults.
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- llvm/include/llvm/IR/RuntimeLibcalls.h llvm/lib/IR/RuntimeLibcalls.cpp llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp View the diff from clang-format here.diff --git a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
index 30fcca47a..a4b6c8d7f 100644
--- a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
@@ -349,9 +349,8 @@ void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
SetTheory Sets;
DenseMap<const Record *, std::vector<const Record *>> Func2Preds;
- Sets.addExpander(
- "LibcallImpls",
- std::make_unique<LibcallPredicateExpander>(*this, Func2Preds));
+ Sets.addExpander("LibcallImpls", std::make_unique<LibcallPredicateExpander>(
+ *this, Func2Preds));
const SetTheory::RecVec *Elements =
Sets.expand(R->getValueAsDef("MemberList"));
|
@llvm/pr-subscribers-tablegen @llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) ChangesAdd a way to define a SystemLibrary for a complete set of Start migrating some of the easier targets to only use the new Patch is 71.70 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/144978.diff 9 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 912715fbf6b19..d69c23753da7a 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -52,7 +52,6 @@ struct RuntimeLibcallsInfo {
FloatABI::ABIType FloatABI = FloatABI::Default,
EABI EABIVersion = EABI::Default) {
initSoftFloatCmpLibcallPredicates();
- initDefaultLibCallImpls();
initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion);
}
@@ -97,6 +96,7 @@ struct RuntimeLibcallsInfo {
/// Get the comparison predicate that's to be used to test the result of the
/// comparison libcall against zero. This should only be used with
/// floating-point compare libcalls.
+ // FIXME: This should be a function of RTLIB::LibcallImpl
CmpInst::Predicate
getSoftFloatCmpLibcallPredicate(RTLIB::Libcall Call) const {
return SoftFloatCompareLibcallPredicates[Call];
@@ -172,13 +172,7 @@ struct RuntimeLibcallsInfo {
void initDefaultLibCallImpls();
/// Generated by tablegen.
- void setPPCLibCallNameOverrides();
-
- /// Generated by tablegen.
- void setZOSLibCallNameOverrides();
-
- /// Generated by tablegen.
- void setWindowsArm64LibCallNameOverrides();
+ void setTargetRuntimeLibcallSets(const Triple &TT);
void initSoftFloatCmpLibcallPredicates();
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 1d9f02dcf8ba8..e24b4c928b421 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -891,6 +891,17 @@ def calloc : RuntimeLibcallImpl<CALLOC>;
} // End let IsDefault = true
} // End defset DefaultRuntimeLibcallImpls
+defvar DefaultLibCalls =
+ !foreach(entry, DefaultRuntimeLibcallImpls, entry.Provides);
+
+defvar DefaultRuntimeLibcallImpls_f128 =
+ !filter(entry, DefaultRuntimeLibcallImpls,
+ !match(!cast<string>(entry.Provides), "_F128"));
+
+defvar DefaultRuntimeLibcallImpls_atomic =
+ !filter(entry, DefaultRuntimeLibcallImpls,
+ !match(!cast<string>(entry.Provides), "ATOMIC"));
+
//--------------------------------------------------------------------
// Define implementation other libcalls
//--------------------------------------------------------------------
@@ -915,58 +926,61 @@ def _Unwind_SjLj_Resume : RuntimeLibcallImpl<UNWIND_RESUME>;
// F128 libm Runtime Libcalls
//===----------------------------------------------------------------------===//
-def logf128 : RuntimeLibcallImpl<LOG_F128>;
-def log2f128 : RuntimeLibcallImpl<LOG2_F128>;
-def log10f128 : RuntimeLibcallImpl<LOG10_F128>;
-def expf128 : RuntimeLibcallImpl<EXP_F128>;
-def exp2f128 : RuntimeLibcallImpl<EXP2_F128>;
-def exp10f128 : RuntimeLibcallImpl<EXP10_F128>;
-def sinf128 : RuntimeLibcallImpl<SIN_F128>;
-def cosf128 : RuntimeLibcallImpl<COS_F128>;
-def tanf128 : RuntimeLibcallImpl<TAN_F128>;
-def tanhf128 : RuntimeLibcallImpl<TANH_F128>;
-def sincosf128 : RuntimeLibcallImpl<SINCOS_F128>;
-def powf128 : RuntimeLibcallImpl<POW_F128>;
-def fminf128 : RuntimeLibcallImpl<FMIN_F128>;
-def fmaxf128 : RuntimeLibcallImpl<FMAX_F128>;
-def fmodf128 : RuntimeLibcallImpl<REM_F128>;
-def sqrtf128 : RuntimeLibcallImpl<SQRT_F128>;
-def ceilf128 : RuntimeLibcallImpl<CEIL_F128>;
-def floorf128 : RuntimeLibcallImpl<FLOOR_F128>;
-def truncf128 : RuntimeLibcallImpl<TRUNC_F128>;
-def roundf128 : RuntimeLibcallImpl<ROUND_F128>;
-def lroundf128 : RuntimeLibcallImpl<LROUND_F128>;
-def llroundf128 : RuntimeLibcallImpl<LLROUND_F128>;
-def rintf128 : RuntimeLibcallImpl<RINT_F128>;
-def lrintf128 : RuntimeLibcallImpl<LRINT_F128>;
-def llrintf128 : RuntimeLibcallImpl<LLRINT_F128>;
-def nearbyintf128 : RuntimeLibcallImpl<NEARBYINT_F128>;
-def fmaf128 : RuntimeLibcallImpl<FMA_F128>;
-def frexpf128 : RuntimeLibcallImpl<FREXP_F128>;
-
-def cbrtf128 : RuntimeLibcallImpl<CBRT_F128>;
-def fminimumf128 : RuntimeLibcallImpl<FMINIMUM_F128>;
-def fmaximumf128 : RuntimeLibcallImpl<FMAXIMUM_F128>;
-def fminimum_numf128 : RuntimeLibcallImpl<FMINIMUM_NUM_F128>;
-def fmaximum_numf128 : RuntimeLibcallImpl<FMAXIMUM_NUM_F128>;
-def asinf128 : RuntimeLibcallImpl<ASIN_F128>;
-def acosf128 : RuntimeLibcallImpl<ACOS_F128>;
-def atanf128 : RuntimeLibcallImpl<ATAN_F128>;
-def atan2f128 : RuntimeLibcallImpl<ATAN2_F128>;
-def ldexpf128 : RuntimeLibcallImpl<LDEXP_F128>;
-def roundevenf128 : RuntimeLibcallImpl<ROUNDEVEN_F128>;
-def modff128 : RuntimeLibcallImpl<MODF_F128>;
-def sinhf128 : RuntimeLibcallImpl<SINH_F128>;
-def coshf128 : RuntimeLibcallImpl<COSH_F128>;
-def copysignf128 : RuntimeLibcallImpl<COPYSIGN_F128>;
-
-def __logf128_finite : RuntimeLibcallImpl<LOG_FINITE_F128>;
-def __log2f128_finite : RuntimeLibcallImpl<LOG2_FINITE_F128>;
-def __log10f128_finite : RuntimeLibcallImpl<LOG10_FINITE_F128>;
-def __expf128_finite : RuntimeLibcallImpl<EXP_FINITE_F128>;
-def __exp2f128_finite : RuntimeLibcallImpl<EXP2_FINITE_F128>;
-def __exp10f128_finite : RuntimeLibcallImpl<EXP10_FINITE_F128>;
-def __powf128_finite : RuntimeLibcallImpl<POW_FINITE_F128>;
+defset list<RuntimeLibcallImpl> LibmF128Libcalls = {
+ def logf128 : RuntimeLibcallImpl<LOG_F128>;
+ def log2f128 : RuntimeLibcallImpl<LOG2_F128>;
+ def log10f128 : RuntimeLibcallImpl<LOG10_F128>;
+ def expf128 : RuntimeLibcallImpl<EXP_F128>;
+ def exp2f128 : RuntimeLibcallImpl<EXP2_F128>;
+ def exp10f128 : RuntimeLibcallImpl<EXP10_F128>;
+ def sinf128 : RuntimeLibcallImpl<SIN_F128>;
+ def cosf128 : RuntimeLibcallImpl<COS_F128>;
+ def tanf128 : RuntimeLibcallImpl<TAN_F128>;
+ def tanhf128 : RuntimeLibcallImpl<TANH_F128>;
+ def sincosf128 : RuntimeLibcallImpl<SINCOS_F128>;
+ def powf128 : RuntimeLibcallImpl<POW_F128>;
+ def fminf128 : RuntimeLibcallImpl<FMIN_F128>;
+ def fmaxf128 : RuntimeLibcallImpl<FMAX_F128>;
+ def fmodf128 : RuntimeLibcallImpl<REM_F128>;
+ def sqrtf128 : RuntimeLibcallImpl<SQRT_F128>;
+ def ceilf128 : RuntimeLibcallImpl<CEIL_F128>;
+ def floorf128 : RuntimeLibcallImpl<FLOOR_F128>;
+ def truncf128 : RuntimeLibcallImpl<TRUNC_F128>;
+ def roundf128 : RuntimeLibcallImpl<ROUND_F128>;
+ def lroundf128 : RuntimeLibcallImpl<LROUND_F128>;
+ def llroundf128 : RuntimeLibcallImpl<LLROUND_F128>;
+ def rintf128 : RuntimeLibcallImpl<RINT_F128>;
+ def lrintf128 : RuntimeLibcallImpl<LRINT_F128>;
+ def llrintf128 : RuntimeLibcallImpl<LLRINT_F128>;
+ def nearbyintf128 : RuntimeLibcallImpl<NEARBYINT_F128>;
+ def fmaf128 : RuntimeLibcallImpl<FMA_F128>;
+ def frexpf128 : RuntimeLibcallImpl<FREXP_F128>;
+ def cbrtf128 : RuntimeLibcallImpl<CBRT_F128>;
+ def fminimumf128 : RuntimeLibcallImpl<FMINIMUM_F128>;
+ def fmaximumf128 : RuntimeLibcallImpl<FMAXIMUM_F128>;
+ def fminimum_numf128 : RuntimeLibcallImpl<FMINIMUM_NUM_F128>;
+ def fmaximum_numf128 : RuntimeLibcallImpl<FMAXIMUM_NUM_F128>;
+ def asinf128 : RuntimeLibcallImpl<ASIN_F128>;
+ def acosf128 : RuntimeLibcallImpl<ACOS_F128>;
+ def atanf128 : RuntimeLibcallImpl<ATAN_F128>;
+ def atan2f128 : RuntimeLibcallImpl<ATAN2_F128>;
+ def ldexpf128 : RuntimeLibcallImpl<LDEXP_F128>;
+ def roundevenf128 : RuntimeLibcallImpl<ROUNDEVEN_F128>;
+ def modff128 : RuntimeLibcallImpl<MODF_F128>;
+ def sinhf128 : RuntimeLibcallImpl<SINH_F128>;
+ def coshf128 : RuntimeLibcallImpl<COSH_F128>;
+ def copysignf128 : RuntimeLibcallImpl<COPYSIGN_F128>;
+}
+
+defset list<RuntimeLibcallImpl> LibmF128FiniteLibcalls = {
+ def __logf128_finite : RuntimeLibcallImpl<LOG_FINITE_F128>;
+ def __log2f128_finite : RuntimeLibcallImpl<LOG2_FINITE_F128>;
+ def __log10f128_finite : RuntimeLibcallImpl<LOG10_FINITE_F128>;
+ def __expf128_finite : RuntimeLibcallImpl<EXP_FINITE_F128>;
+ def __exp2f128_finite : RuntimeLibcallImpl<EXP2_FINITE_F128>;
+ def __exp10f128_finite : RuntimeLibcallImpl<EXP10_FINITE_F128>;
+ def __powf128_finite : RuntimeLibcallImpl<POW_FINITE_F128>;
+}
//===----------------------------------------------------------------------===//
// AArch64 Runtime Libcalls
@@ -994,16 +1008,41 @@ defset list<RuntimeLibcallImpl> AArch64LibcallImpls = {
def __arm_sc_memcpy : RuntimeLibcallImpl<SC_MEMCPY>;
def __arm_sc_memmove : RuntimeLibcallImpl<SC_MEMMOVE>;
def __arm_sc_memset : RuntimeLibcallImpl<SC_MEMSET>;
-}
+} // End AArch64LibcallImpls
-foreach libcall = AArch64LibcallImpls in {
- def arm64ec_#libcall : DuplicateLibcallImplWithPrefix<libcall, "#">;
-}
+def isAArch64_ExceptArm64EC
+ : RuntimeLibcallPredicate<"(TT.isAArch64() && !TT.isWindowsArm64EC())">;
+def isWindowsArm64EC : RuntimeLibcallPredicate<"TT.isWindowsArm64EC()">;
+
+def AArch64SystemLibrary : SystemRuntimeLibrary<isAArch64_ExceptArm64EC,
+ (add DefaultRuntimeLibcallImpls,
+ AArch64LibcallImpls)>;
-foreach libcall = DefaultRuntimeLibcallImpls in {
- def arm64ec_#libcall : DuplicateLibcallImplWithPrefix<libcall, "#">;
+// Prepend a # to every name
+defset list<RuntimeLibcallImpl> WinArm64ECDefaultRuntimeLibcallImpls = {
+ foreach libcall = DefaultRuntimeLibcallImpls in {
+ def arm64ec_#libcall : DuplicateLibcallImplWithPrefix<libcall, "#">;
+ }
+
+ foreach libcall = AArch64LibcallImpls in {
+ def arm64ec_#libcall : DuplicateLibcallImplWithPrefix<libcall, "#">;
+ }
}
+def WindowsARM64ECSystemLibrary
+ : SystemRuntimeLibrary<isWindowsArm64EC,
+ (add WinArm64ECDefaultRuntimeLibcallImpls)>;
+
+//===----------------------------------------------------------------------===//
+// AMDGPU Runtime Libcalls
+//===----------------------------------------------------------------------===//
+
+def isAMDGPU : RuntimeLibcallPredicate<"TT.isAMDGPU()">;
+
+// No calls, except for dummy atomic calls to avoid crashes.
+def AMDGPUSystemLibrary
+ : SystemRuntimeLibrary<isAMDGPU, (add DefaultRuntimeLibcallImpls_atomic)>;
+
//===----------------------------------------------------------------------===//
// ARM Runtime Libcalls
//===----------------------------------------------------------------------===//
@@ -1227,6 +1266,30 @@ def __udivmodhi4 : RuntimeLibcallImpl<UDIVREM_I16>; // CallingConv::AVR_BUILTIN
def avr_sin : RuntimeLibcallImpl<SIN_F32, "sin">;
def avr_cos : RuntimeLibcallImpl<COS_F32, "cos">;
+def isAVR : RuntimeLibcallPredicate<"TT.getArch() == Triple::avr">;
+
+def AVRSystemLibrary
+ : SystemRuntimeLibrary<
+ isAVR,
+ (add(sub DefaultRuntimeLibcallImpls,
+
+ // Division rtlib functions (not supported), use divmod
+ // functions instead
+ __divqi3, __divhi3, __divsi3, __udivqi3, __udivhi3, __udivsi3,
+
+ // Modulus rtlib functions (not supported), use divmod functions
+ // instead
+ __modqi3, __modhi3, __modsi3, __umodqi3, __umodhi3, __umodsi3,
+
+ // Standard f64 names are replaced
+ sin, cos, sinf, cosf),
+
+ __divmodqi4, __divmodhi4, __divmodsi4, __udivmodqi4, __udivmodhi4,
+ __udivmodsi4,
+
+ // Trigonometric rtlib functions
+ avr_sin, avr_cos)>;
+
//===----------------------------------------------------------------------===//
// Hexagon Runtime Libcalls
//===----------------------------------------------------------------------===//
@@ -1447,52 +1510,94 @@ def __mspabi_mpyll : RuntimeLibcallImpl<MUL_I64>;
// setLibcallCallingConv(MUL_I64, CallingConv::MSP430_BUILTIN);
//===----------------------------------------------------------------------===//
-// PPC Runtime Libcalls
+// NVPTX Runtime Libcalls
//===----------------------------------------------------------------------===//
-class PPCRuntimeLibcallImpl<RuntimeLibcall P, string Name = NAME>
- : RuntimeLibcallImpl<P, Name>;
+def isNVPTX : RuntimeLibcallPredicate<"TT.isNVPTX()">;
+
+// No calls, except for dummy atomic calls to avoid crashes.
+def NVPTXSystemLibrary
+ : SystemRuntimeLibrary<isNVPTX, (add DefaultRuntimeLibcallImpls_atomic)>;
+
+//===----------------------------------------------------------------------===//
+// PPC Runtime Libcalls
+//===----------------------------------------------------------------------===//
// For IEEE quad-precision libcall names, PPC uses "kf" instead of "tf".
-def __addkf3 : PPCRuntimeLibcallImpl<ADD_F128>;
-def __subkf3 : PPCRuntimeLibcallImpl<SUB_F128>;
-def __mulkf3 : PPCRuntimeLibcallImpl<MUL_F128>;
-def __divkf3 : PPCRuntimeLibcallImpl<DIV_F128>;
-def __powikf2 : PPCRuntimeLibcallImpl<POWI_F128>;
-def __extendsfkf2 : PPCRuntimeLibcallImpl<FPEXT_F32_F128>;
-def __extenddfkf2 : PPCRuntimeLibcallImpl<FPEXT_F64_F128>;
-def __trunckfhf2 : PPCRuntimeLibcallImpl<FPROUND_F128_F16>;
-def __trunckfsf2 : PPCRuntimeLibcallImpl<FPROUND_F128_F32>;
-def __trunckfdf2 : PPCRuntimeLibcallImpl<FPROUND_F128_F64>;
-def __fixkfsi : PPCRuntimeLibcallImpl<FPTOSINT_F128_I32>;
-def __fixkfdi : PPCRuntimeLibcallImpl<FPTOSINT_F128_I64>;
-def __fixkfti : PPCRuntimeLibcallImpl<FPTOSINT_F128_I128>;
-def __fixunskfsi : PPCRuntimeLibcallImpl<FPTOUINT_F128_I32>;
-def __fixunskfdi : PPCRuntimeLibcallImpl<FPTOUINT_F128_I64>;
-def __fixunskfti : PPCRuntimeLibcallImpl<FPTOUINT_F128_I128>;
-def __floatsikf : PPCRuntimeLibcallImpl<SINTTOFP_I32_F128>;
-def __floatdikf : PPCRuntimeLibcallImpl<SINTTOFP_I64_F128>;
-def __floattikf : PPCRuntimeLibcallImpl<SINTTOFP_I128_F128>;
-def __floatunsikf : PPCRuntimeLibcallImpl<UINTTOFP_I32_F128>;
-def __floatundikf : PPCRuntimeLibcallImpl<UINTTOFP_I64_F128>;
-def __floatuntikf : PPCRuntimeLibcallImpl<UINTTOFP_I128_F128>;
-def __eqkf2 : PPCRuntimeLibcallImpl<OEQ_F128>;
-def __nekf2 : PPCRuntimeLibcallImpl<UNE_F128>;
-def __gekf2 : PPCRuntimeLibcallImpl<OGE_F128>;
-def __ltkf2 : PPCRuntimeLibcallImpl<OLT_F128>;
-def __lekf2 : PPCRuntimeLibcallImpl<OLE_F128>;
-def __gtkf2 : PPCRuntimeLibcallImpl<OGT_F128>;
-def __unordkf2 : PPCRuntimeLibcallImpl<UO_F128>;
-
-// PPC64 && Subtarget.isAIXABI()
-def ___memmove64 : RuntimeLibcallImpl<MEMCPY>;
-def ___memset64 : RuntimeLibcallImpl<MEMSET>;
-def ___bzero64 : RuntimeLibcallImpl<BZERO>;
-
-// !PPC64 && Subtarget.isAIXABI()
-def ___memmove : RuntimeLibcallImpl<MEMMOVE>;
-def ___memset : RuntimeLibcallImpl<MEMSET>;
-def ___bzero : RuntimeLibcallImpl<BZERO>;
+defset list<RuntimeLibcallImpl> PPCRuntimeLibcalls = {
+ def __addkf3 : RuntimeLibcallImpl<ADD_F128>;
+ def __subkf3 : RuntimeLibcallImpl<SUB_F128>;
+ def __mulkf3 : RuntimeLibcallImpl<MUL_F128>;
+ def __divkf3 : RuntimeLibcallImpl<DIV_F128>;
+ def __powikf2 : RuntimeLibcallImpl<POWI_F128>;
+ def __extendsfkf2 : RuntimeLibcallImpl<FPEXT_F32_F128>;
+ def __extenddfkf2 : RuntimeLibcallImpl<FPEXT_F64_F128>;
+ def __trunckfhf2 : RuntimeLibcallImpl<FPROUND_F128_F16>;
+ def __trunckfsf2 : RuntimeLibcallImpl<FPROUND_F128_F32>;
+ def __trunckfdf2 : RuntimeLibcallImpl<FPROUND_F128_F64>;
+ def __fixkfsi : RuntimeLibcallImpl<FPTOSINT_F128_I32>;
+ def __fixkfdi : RuntimeLibcallImpl<FPTOSINT_F128_I64>;
+ def __fixkfti : RuntimeLibcallImpl<FPTOSINT_F128_I128>;
+ def __fixunskfsi : RuntimeLibcallImpl<FPTOUINT_F128_I32>;
+ def __fixunskfdi : RuntimeLibcallImpl<FPTOUINT_F128_I64>;
+ def __fixunskfti : RuntimeLibcallImpl<FPTOUINT_F128_I128>;
+ def __floatsikf : RuntimeLibcallImpl<SINTTOFP_I32_F128>;
+ def __floatdikf : RuntimeLibcallImpl<SINTTOFP_I64_F128>;
+ def __floattikf : RuntimeLibcallImpl<SINTTOFP_I128_F128>;
+ def __floatunsikf : RuntimeLibcallImpl<UINTTOFP_I32_F128>;
+ def __floatundikf : RuntimeLibcallImpl<UINTTOFP_I64_F128>;
+ def __floatuntikf : RuntimeLibcallImpl<UINTTOFP_I128_F128>;
+ def __eqkf2 : RuntimeLibcallImpl<OEQ_F128>;
+ def __nekf2 : RuntimeLibcallImpl<UNE_F128>;
+ def __gekf2 : RuntimeLibcallImpl<OGE_F128>;
+ def __ltkf2 : RuntimeLibcallImpl<OLT_F128>;
+ def __lekf2 : RuntimeLibcallImpl<OLE_F128>;
+ def __gtkf2 : RuntimeLibcallImpl<OGT_F128>;
+ def __unordkf2 : RuntimeLibcallImpl<UO_F128>;
+}
+
+defset list<RuntimeLibcallImpl> PPC64AIXCallList = {
+ def ___memmove64 : RuntimeLibcallImpl<MEMCPY>;
+ def ___memset64 : RuntimeLibcallImpl<MEMSET>;
+ def ___bzero64 : RuntimeLibcallImpl<BZERO>;
+}
+
+defset list<RuntimeLibcallImpl> PPC32AIXCallList = {
+ def ___memmove : RuntimeLibcallImpl<MEMMOVE>;
+ def ___memset : RuntimeLibcallImpl<MEMSET>;
+ def ___bzero : RuntimeLibcallImpl<BZERO>;
+}
+
+defvar PPCOverrides = !foreach(entry, PPCRuntimeLibcalls, entry.Provides);
+
+defvar ToPrune = !listremove(DefaultLibCalls, PPCOverrides);
+// DefaultLibcalls item.Provides
+//);
+
+// defvar PPCOverride = !foldl([], DefaultRuntimeLibcallImpls, acc, item,
+// !eq(item.Provides,
+//);
+
+def isPPC : RuntimeLibcallPredicate<"TT.isPPC()">;
+def isAIX : RuntimeLibcallPredicate<"TT.isOSAIX()">;
+def isNotAIX : RuntimeLibcallPredicate<"!TT.isOSAIX()">;
+def isPPC32_AIX : RuntimeLibcallPredicate<"(TT.isPPC32() && TT.isOSAIX())">;
+def isPPC64_AIX : RuntimeLibcallPredicate<"(TT.isPPC64() && TT.isOSAIX())">;
+
+def AIX32Calls : LibcallImpls<(add PPC32AIXCallList), isPPC32_AIX>;
+def AIX64Calls : LibcallImpls<(add PPC64AIXCallList), isPPC64_AIX>;
+
+// FIXME: Current emission behavior with multiple implementations is
+// janky. We need to filter out the conflicting cases with different
+// f128 names, and then add the overrides. We should switch to
+// explicitly adding subsets of the default calls.
+def PPCSystemLibrary
+ : SystemRuntimeLibrary<isPPC, (add PPCRuntimeLibcalls,
+ (sub DefaultRuntimeLibcallImpls, memcpy,
+ DefaultRuntimeLibcallImpls_f128),
+ __extendkftf2, __trunctfkf2,
+ LibmF128Libcalls, AIX32Calls, AIX64Calls,
+ AvailableIf<memcpy, isNotAIX>)>;
//===----------------------------------------------------------------------===//
// SPARC Runtime Libcalls
@@ -1562,94 +1667,105 @@ def _allmul : RuntimeLibcallImpl<MUL_I64>; // CallingConv::X86_StdCall
def __memcpy_4 : RuntimeLibcallImpl<MEMCPY_ALIGN_4>;
+def isXCore : RuntimeLibcallPredicate<"TT.getArch() == Triple::xcore">;
+def XCoreSystemLibrary
+ : SystemRuntimeLibrary<isXCore, (add DefaultRuntimeLibcallImpls,
+ __memcpy_4)>;
+
//===----------------------------------------------------------------------===//
// ZOS Runtime Libcalls
//===----------------------------------------------------------------------===//
-class ZOSRuntimeLibcallImpl<RuntimeLibcall P, string Name = NAME>
- : RuntimeLibcallImpl<P, Name>;
-
-def zos___TRNC_B : ZOSRuntimeLibcallImpl<TRUNC_F64, "@@TRNC@B">;
-def zos___FTRC_B : ZOSRuntimeLibcallImpl<TRUNC_F32, "@@FTRC@B">;
-def zos___LTRC_B : ZOSRuntimeLibcallImpl<TRUNC_F128, "@@LTRC@B">;
-def zos___WSQT_B : ZOSRuntimeLibcallImpl<SQRT_F64, "@@WSQT@B">;
-def zos___FSQT_B : ZOSRuntimeLibcallImpl<SQRT_F32, "@@FSQT@B">;
-def zos___LSQT_B : ZOSRuntimeLibcallImpl<SQRT_F128, "@@LSQT@B">;
-def zos___SSIN_B : ZOSRuntimeLibcallImpl<SIN_F64, "@@SSIN@B">;
-def zos___FSIN_B : ZOSRuntimeLibcallImpl<SIN_F32, "@@FSIN@B">;
-def zos___LSIN_B : ZOSRuntimeLibcallImpl<SIN_F128, "@@LSIN@B">;
-def zos___ROUN_B : ZOSRuntimeLibcallImpl<ROUND_F64, "@@ROUN@B">;
-def zos___ROUNFB : ZOSRuntimeLibcallImpl<ROUND_F32, "@@ROUNFB">;
-def zos___ROUNLB : ZOSRuntimeLibcallImpl<ROUND_F128, "@@ROUNLB">;
-def zos___SRNT_B : ZOSRuntimeLibcallImpl<RINT_F64, "@@SRNT@B">;
-def zos___RINTFB : ZOSRuntimeLibcallImpl<RINT_F32, "@@RINTFB">;
-def zos___RINTLB : ZOSRuntimeLibcallImpl<RINT_F128, "@@RINTLB">;
-def zos___WFMD_B : ZOSRuntimeLibcallImpl<REM_F64, "@@WFMD@B">;
-def zos___FFMD_B : ZOSRuntimeLibcallImpl<REM_F32, "@@FFMD@B">;
-def zos___LFMD_B : ZOSRuntimeLibcallImpl<REM_F128, "@@LFMD@B">;
-def zos___WPOW_B : ZOSRuntimeLibcallImpl<POW_F64, "@@WPOW@B">;
-def zos___FPOW_B : ZOSRuntimeLibcallImpl<POW_F32, "@@FPOW@B">;
-def zos___LPOW_B : ZOSRuntimeLibcallImpl<POW_F128, "@@LPOW@B">;
-def zos___NBYI_B : ZOSRuntimeLibcallImpl<NEARBYINT_F64, "@@NBYI@B">;
-def zos___NBYIFB : ZOSRuntimeLibcallImpl<NEARBYINT_F32, "@@NBYIFB">;
-def zos___NBYILB : ZOSRuntimeLibcallImpl<NEARBYINT_F128, "@@NBYILB">;
-def zos___ROND_B : ZOSRuntimeLibcallImpl<LROUND_F64, "@@ROND@B">;
-def zos___FRND_B : ZOSRuntimeLibcallImpl<LROUND_F32, "@@FRND@B">;
-def zos___LRND_B : ZOSRuntimeLibcallImpl<LROUND_F128, "@@LRND@B">;
-def zos___LRNT_B : ZOSRuntimeLibcallImpl<LRINT_F64, "@@LRNT@B">;
-def zos___LRNTFB : ZOSRuntimeLibcallImpl<LRINT_F32, "@@LRNTFB">;
-def zos___LRNTL...
[truncated]
|
Add a way to define a SystemLibrary for a complete set of
libcalls, subdivided by a predicate based on the triple.
Libraries can be defined using dag set operations, and the
prior default set can be subtracted from and added to (though
I think eventually all targets should move to explicit opt-ins.
We're still doing things like reporting ppcf128 libcalls as
available dy default on all targets).
Start migrating some of the easier targets to only use the new
system. Targets that don't define a SystemLibrary are still
manually mutating a table set to the old defaults.