16#ifndef LLVM_IR_RUNTIME_LIBCALLS_H
17#define LLVM_IR_RUNTIME_LIBCALLS_H
36#define GET_RUNTIME_LIBCALL_ENUM
37#include "llvm/IR/RuntimeLibcalls.inc"
60 return enum_seq(
static_cast<RTLIB::Libcall
>(0), RTLIB::UNKNOWN_LIBCALL);
64 return enum_seq(
static_cast<RTLIB::LibcallImpl
>(1),
65 static_cast<RTLIB::LibcallImpl
>(RTLIB::NumLibcallImpls));
73 const std::array<
uint64_t, (RTLIB::NumLibcallImpls + 63) / 64> &Src)
104 ModuleAnalysisManager::Invalidator &);
108 if (CallImpl == RTLIB::Unsupported)
110 return StringRef(RuntimeLibcallImplNameTable.getCString(
111 RuntimeLibcallNameOffsetTable[CallImpl]),
112 RuntimeLibcallNameSizeTable[CallImpl]);
118 LibcallImplCallingConvs[
Call] = CC;
123 return LibcallImplCallingConvs[
Call];
128 return ImplToLibcall[Impl];
139 return AvailableLibcallImpls.count();
143 return AvailableLibcallImpls.test(Impl);
147 AvailableLibcallImpls.set(Impl);
151 AvailableLibcallImpls.reset(Impl);
165#define GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
166#include "llvm/IR/RuntimeLibcalls.inc"
177 return RTLIB::Unsupported;
183 return TT.isArch16Bit() ? 16 : 32;
189 LLVM_ABI std::pair<FunctionType *, AttributeList>
191 RTLIB::LibcallImpl LibcallImpl)
const;
196 LLVM_ABI std::pair<FunctionType *, AttributeList>
198 RTLIB::LibcallImpl LibcallImpl)
const;
207#define GET_RUNTIME_LIBCALLS_INFO_MEMBER_DECLS
208#include "llvm/IR/RuntimeLibcalls.inc"
210 LLVM_ABI static iota_range<RTLIB::LibcallImpl>
211 lookupLibcallImplNameImpl(StringRef Name);
214 "default calling conv should be encoded as 0");
222 LLVM_ABI static const char RuntimeLibcallImplNameTableStorage[];
224 LLVM_ABI static const uint16_t RuntimeLibcallNameOffsetTable[];
225 LLVM_ABI static const uint8_t RuntimeLibcallNameSizeTable[];
228 LLVM_ABI static const FuncArgTypeID SignatureTable[];
229 LLVM_ABI static const uint16_t SignatureOffset[];
232 LLVM_ABI static const RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
237 static inline iota_range<RTLIB::LibcallImpl>
238 libcallImplNameHit(uint16_t NameOffsetEntry, uint16_t StrOffset);
240 static bool darwinHasSinCosStret(
const Triple &TT) {
241 if (!
TT.isOSDarwin())
249 return !
TT.isMacOSXVersionLT(10, 9) &&
TT.isArch64Bit();
252 return !
TT.isOSVersionLT(7, 0);
258 static bool isAAPCS_ABI(
const Triple &TT, StringRef ABIName);
262 bool isLibraryAvailable(StringRef LibraryName)
const;
265 void setTargetRuntimeLibcallSets(
const Triple &TT,
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Atomic ordering constants.
This header defines various interfaces for pass management in LLVM.
Provides some synthesis utilities to produce sequences of values.
constexpr Bitset(const std::array< uint64_t,(NumBits+63)/64 > &B)
A parsed version of the target data layout string in and methods for querying it.
Class to represent function types.
This is an important class for using LLVM in a threaded context.
Tracks which library functions to use for a particular subtarget or function.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
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
Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
The instances of the Type class are immutable: once they are created, they are never changed.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
static auto libcall_impls()
This is an optimization pass for GlobalISel generic memory operations.
LongDoubleFormat
The floating-point format used for the target's "long double" type.
constexpr auto enum_seq(EnumT Begin, EnumT End)
Iterate over an enum type from Begin up to - but not including - End.
@ Default
Not specified; resolve to the target's default model.
VectorLibrary
List of known vector-functions libraries.
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
static LLVM_ABI RTLIB::Libcall getLibcallForIntrinsic(Intrinsic::ID ID, FunctionType *FTy)
Return the runtime libcall that the floating-point math intrinsic ID may be lowered to,...
unsigned getNumAvailableLibcallImpls() const
bool isAvailable(RTLIB::LibcallImpl Impl) const
LLVM_ABI std::pair< FunctionType *, AttributeList > getFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const
void setAvailable(RTLIB::LibcallImpl Impl)
static LLVM_ABI bool hasVectorMaskArgument(RTLIB::LibcallImpl Impl)
Returns true if the function has a vector mask argument, which is assumed to be the last argument.
void setUnavailable(RTLIB::LibcallImpl Impl)
static iota_range< RTLIB::LibcallImpl > lookupLibcallImplName(StringRef Name)
Check if a function name is a recognized runtime call of any kind.
RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const
Check if this is valid libcall for the current module, otherwise RTLIB::Unsupported.
RuntimeLibcallsInfo()=default
static StringRef getLibcallImplName(RTLIB::LibcallImpl CallImpl)
Get the libcall routine name for the specified libcall implementation.
unsigned getIntSize(const Triple &TT) const
Get size of a C-level int or unsigned int, in bits.
void setLibcallImplCallingConv(RTLIB::LibcallImpl Call, CallingConv::ID CC)
Set the CallingConv that should be used for the specified libcall implementation.
LLVM_ABI std::pair< FunctionType *, AttributeList > getDefaultFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const
Get the C-type function signature of the Libcall if provided, and convert it to IR FunctionType and A...
static RTLIB::Libcall getLibcallFromImpl(RTLIB::LibcallImpl Impl)
Return the libcall provided by Impl.
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &)
static constexpr bool is_iterable
static constexpr bool is_iterable