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"
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));
62 const std::array<
uint64_t, (RTLIB::NumLibcallImpls + 63) / 64> &Src)
83 ExceptionModel = TT.getDefaultExceptionHandling();
85 initLibcalls(TT, ExceptionModel,
FloatABI, EABIVersion, ABIName);
90 LibcallImpls[
Call] = Impl;
101 if (CallImpl == RTLIB::Unsupported)
103 return StringRef(RuntimeLibcallImplNameTable.getCString(
104 RuntimeLibcallNameOffsetTable[CallImpl]),
105 RuntimeLibcallNameSizeTable[CallImpl]);
110 return LibcallImpls[
Call];
116 LibcallImplCallingConvs[
Call] = CC;
122 return LibcallImplCallingConvs[LibcallImpls[
Call]];
127 return LibcallImplCallingConvs[
Call];
132 return ArrayRef(LibcallImpls).drop_back();
139 if (Memcpy != RTLIB::Unsupported)
147 return AvailableLibcallImpls.test(Impl);
151 AvailableLibcallImpls.set(Impl);
156 return ImplToLibcall[Impl];
170#define GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
171#include "llvm/IR/RuntimeLibcalls.inc"
181 RTLIB::LibcallImpl Recognized = LibcallImpls[ImplToLibcall[Impl]];
182 if (Recognized != RTLIB::Unsupported)
186 return RTLIB::Unsupported;
191 lookupLibcallImplNameImpl(
StringRef Name);
194 RTLIB::LibcallImpl LibcallImpls[RTLIB::UNKNOWN_LIBCALL + 1] = {
198 "default calling conv should be encoded as 0");
206 LLVM_ABI static const char RuntimeLibcallImplNameTableStorage[];
207 LLVM_ABI static const StringTable RuntimeLibcallImplNameTable;
212 LLVM_ABI static const RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
217 static inline iota_range<RTLIB::LibcallImpl>
220 static bool darwinHasSinCosStret(
const Triple &TT) {
221 if (!TT.isOSDarwin())
229 return !TT.isMacOSXVersionLT(10, 9) && TT.isArch64Bit();
232 return !TT.isOSVersionLT(7, 0);
237 static bool hasAEABILibcalls(
const Triple &TT) {
238 return TT.isTargetAEABI() ||
TT.isTargetGNUAEABI() ||
239 TT.isTargetMuslAEABI() ||
TT.isOSFuchsia() ||
TT.isAndroid();
243 static bool isAAPCS_ABI(
const Triple &TT, StringRef ABIName);
245 static bool darwinHasExp10(
const Triple &TT);
248 static bool hasSinCos(
const Triple &TT) {
249 return TT.isGNUEnvironment() ||
TT.isOSFuchsia() ||
TT.isAndroid();
252 static bool hasSinCos_f32_f64(
const Triple &TT) {
253 return hasSinCos(TT) ||
TT.isPS();
257 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