14#ifndef LLVM_IR_RUNTIME_LIBCALLS_H
15#define LLVM_IR_RUNTIME_LIBCALLS_H
32#define GET_RUNTIME_LIBCALL_ENUM
33#include "llvm/IR/RuntimeLibcalls.inc"
34#undef GET_RUNTIME_LIBCALL_ENUM
50 return enum_seq(
static_cast<RTLIB::Libcall
>(0), RTLIB::UNKNOWN_LIBCALL);
54 return enum_seq(
static_cast<RTLIB::LibcallImpl
>(1),
55 static_cast<RTLIB::LibcallImpl
>(RTLIB::NumLibcallImpls));
63 const std::array<
uint64_t, (RTLIB::NumLibcallImpls + 63) / 64> &Src)
84 ExceptionModel = TT.getDefaultExceptionHandling();
86 initLibcalls(TT, ExceptionModel,
FloatABI, EABIVersion, ABIName);
91 LibcallImpls[
Call] = Impl;
102 if (CallImpl == RTLIB::Unsupported)
104 return StringRef(RuntimeLibcallImplNameTable.getCString(
105 RuntimeLibcallNameOffsetTable[CallImpl]),
106 RuntimeLibcallNameSizeTable[CallImpl]);
111 return LibcallImpls[
Call];
117 LibcallImplCallingConvs[
Call] = CC;
123 return LibcallImplCallingConvs[LibcallImpls[
Call]];
128 return LibcallImplCallingConvs[
Call];
133 return ArrayRef(LibcallImpls).drop_back();
140 if (Memcpy != RTLIB::Unsupported)
148 return AvailableLibcallImpls.test(Impl);
152 AvailableLibcallImpls.set(Impl);
157 return ImplToLibcall[Impl];
171#define GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
172#include "llvm/IR/RuntimeLibcalls.inc"
173#undef GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
183 RTLIB::LibcallImpl Recognized = LibcallImpls[ImplToLibcall[Impl]];
184 if (Recognized != RTLIB::Unsupported)
188 return RTLIB::Unsupported;
193 lookupLibcallImplNameImpl(
StringRef Name);
196 RTLIB::LibcallImpl LibcallImpls[RTLIB::UNKNOWN_LIBCALL + 1] = {
200 "default calling conv should be encoded as 0");
208 LLVM_ABI static const char RuntimeLibcallImplNameTableStorage[];
209 LLVM_ABI static const StringTable RuntimeLibcallImplNameTable;
214 LLVM_ABI static const RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
219 static inline iota_range<RTLIB::LibcallImpl>
222 static bool darwinHasSinCosStret(
const Triple &TT) {
223 if (!TT.isOSDarwin())
231 return !TT.isMacOSXVersionLT(10, 9) && TT.isArch64Bit();
234 return !TT.isOSVersionLT(7, 0);
239 static bool hasAEABILibcalls(
const Triple &TT) {
240 return TT.isTargetAEABI() ||
TT.isTargetGNUAEABI() ||
241 TT.isTargetMuslAEABI() ||
TT.isAndroid();
245 static bool isAAPCS_ABI(
const Triple &TT, StringRef ABIName);
247 static bool darwinHasExp10(
const Triple &TT);
250 static bool hasSinCos(
const Triple &TT) {
251 return TT.isGNUEnvironment() ||
TT.isOSFuchsia() ||
TT.isAndroid();
254 static bool hasSinCos_f32_f64(
const Triple &TT) {
255 return hasSinCos(TT) ||
TT.isPS();
259 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),...
constexpr Bitset(const std::array< uint64_t,(NumBits+63)/64 > &B)
Manage a bitset representing the list of available libcalls for a module.
constexpr LibcallImplBitset(const std::array< uint64_t,(RTLIB::NumLibcallImpls+63)/64 > &Src)
constexpr LibcallImplBitset()=default
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.
bool isAvailable(RTLIB::LibcallImpl Impl) const
void setAvailable(RTLIB::LibcallImpl Impl)
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