14#ifndef LLVM_IR_RUNTIME_LIBCALLS_H
15#define LLVM_IR_RUNTIME_LIBCALLS_H
31#define GET_RUNTIME_LIBCALL_ENUM
32#include "llvm/IR/RuntimeLibcalls.inc"
33#undef GET_RUNTIME_LIBCALL_ENUM
49 return enum_seq(
static_cast<RTLIB::Libcall
>(0), RTLIB::UNKNOWN_LIBCALL);
53 return enum_seq(
static_cast<RTLIB::LibcallImpl
>(1),
54 static_cast<RTLIB::LibcallImpl
>(RTLIB::NumLibcallImpls));
69 ExceptionModel = TT.getDefaultExceptionHandling();
71 initLibcalls(TT, ExceptionModel,
FloatABI, EABIVersion, ABIName);
76 LibcallImpls[
Call] = Impl;
87 if (CallImpl == RTLIB::Unsupported)
89 return StringRef(RuntimeLibcallImplNameTable.getCString(
90 RuntimeLibcallNameOffsetTable[CallImpl]),
91 RuntimeLibcallNameSizeTable[CallImpl]);
96 return LibcallImpls[
Call];
102 LibcallImplCallingConvs[
Call] = CC;
108 return LibcallImplCallingConvs[LibcallImpls[
Call]];
113 return LibcallImplCallingConvs[
Call];
118 return ArrayRef(LibcallImpls).drop_back();
125 if (Memcpy != RTLIB::Unsupported)
134 return ImplToLibcall[Impl];
148#define GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
149#include "llvm/IR/RuntimeLibcalls.inc"
150#undef GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
160 RTLIB::LibcallImpl Recognized = LibcallImpls[ImplToLibcall[Impl]];
161 if (Recognized != RTLIB::Unsupported)
165 return RTLIB::Unsupported;
170 lookupLibcallImplNameImpl(
StringRef Name);
173 RTLIB::LibcallImpl LibcallImpls[RTLIB::UNKNOWN_LIBCALL + 1] = {
177 "default calling conv should be encoded as 0");
185 LLVM_ABI static const char RuntimeLibcallImplNameTableStorage[];
186 LLVM_ABI static const StringTable RuntimeLibcallImplNameTable;
191 LLVM_ABI static const RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
196 static inline iota_range<RTLIB::LibcallImpl>
199 static bool darwinHasSinCosStret(
const Triple &TT) {
200 if (!TT.isOSDarwin())
208 return !TT.isMacOSXVersionLT(10, 9) && TT.isArch64Bit();
211 return !TT.isOSVersionLT(7, 0);
216 static bool hasAEABILibcalls(
const Triple &TT) {
217 return TT.isTargetAEABI() ||
TT.isTargetGNUAEABI() ||
218 TT.isTargetMuslAEABI() ||
TT.isAndroid();
222 static bool isAAPCS_ABI(
const Triple &TT, StringRef ABIName);
224 static bool darwinHasExp10(
const Triple &TT);
227 static bool hasSinCos(
const Triple &TT) {
228 return TT.isGNUEnvironment() ||
TT.isOSFuchsia() ||
229 (
TT.isAndroid() && !
TT.isAndroidVersionLT(9));
232 static bool hasSinCos_f32_f64(
const Triple &TT) {
233 return hasSinCos(TT) ||
TT.isPS();
237 void setTargetRuntimeLibcallSets(
const Triple &TT,
Atomic ordering constants.
Provides some synthesis utilities to produce sequences of values.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
static auto libcall_impls()
This is an optimization pass for GlobalISel generic memory operations.
auto enum_seq(EnumT Begin, EnumT End)
Iterate over an enum type from Begin up to - but not including - End.
@ None
No exception support.
ArrayRef(const T &OneElt) -> ArrayRef< T >
static LLVM_ABI iota_range< RTLIB::LibcallImpl > lookupLibcallImplName(StringRef Name)
Check if a function name is a recognized runtime call of any kind.
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
void setLibcallImpl(RTLIB::Libcall Call, RTLIB::LibcallImpl Impl)
Rename the default libcall routine name for the specified libcall.
StringRef getMemcpyName() const
Return a function name compatible with RTLIB::MEMCPY, or nullptr if fully unsupported.
LLVM_ABI RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const
Check if this is valid libcall for the current module, otherwise RTLIB::Unsupported.
StringRef getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
RuntimeLibcallsInfo(const Triple &TT, ExceptionHandling ExceptionModel=ExceptionHandling::None, FloatABI::ABIType FloatABI=FloatABI::Default, EABI EABIVersion=EABI::Default, StringRef ABIName="")
RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const
Return the lowering's selection of implementation call for Call.
static StringRef getLibcallImplName(RTLIB::LibcallImpl CallImpl)
Get the libcall routine name for the specified libcall implementation.
void setLibcallImplCallingConv(RTLIB::LibcallImpl Call, CallingConv::ID CC)
Set the CallingConv that should be used for the specified libcall implementation.
ArrayRef< RTLIB::LibcallImpl > getLibcallImpls() const
static RTLIB::Libcall getLibcallFromImpl(RTLIB::LibcallImpl Impl)
Return the libcall provided by Impl.
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
static constexpr bool is_iterable
static constexpr bool is_iterable