16#ifndef LLVM_IR_RUNTIME_LIBCALLS_H
17#define LLVM_IR_RUNTIME_LIBCALLS_H
38#define GET_RUNTIME_LIBCALL_ENUM
39#include "llvm/IR/RuntimeLibcalls.inc"
64 return enum_seq(
static_cast<RTLIB::Libcall
>(0), RTLIB::UNKNOWN_LIBCALL);
68 return enum_seq(
static_cast<RTLIB::LibcallImpl
>(1),
69 static_cast<RTLIB::LibcallImpl
>(RTLIB::NumLibcallImpls));
77 const std::array<
uint64_t, (RTLIB::NumLibcallImpls + 63) / 64> &Src)
96 std::pair<Type *, Type *> lowerCPairReturn(
const Triple &TT,
108 std::optional<LongDoubleFormat> LDblFormat = std::nullopt,
121 ModuleAnalysisManager::Invalidator &);
125 if (CallImpl == RTLIB::Unsupported)
127 return StringRef(RuntimeLibcallImplNameTable.getCString(
128 RuntimeLibcallNameOffsetTable[CallImpl]),
129 RuntimeLibcallNameSizeTable[CallImpl]);
135 LibcallImplCallingConvs[
Call] =
CC;
140 return LibcallImplCallingConvs[
Call];
158 return AvailableLibcallImpls.count();
162 return AvailableLibcallImpls.test(Impl);
166 AvailableLibcallImpls.set(Impl);
170 AvailableLibcallImpls.reset(Impl);
184#define GET_LOOKUP_LIBCALL_IMPL_NAME_BODY
185#include "llvm/IR/RuntimeLibcalls.inc"
196 return RTLIB::Unsupported;
202 return TT.isArch16Bit() ? 16 : 32;
208 bool &ShouldExtI32Return,
209 bool &ShouldSignExtI32Param,
210 bool &ShouldSignExtI32Return,
215 bool &ShouldZExtBoolReturn,
221 LLVM_ABI std::pair<FunctionType *, AttributeList>
223 RTLIB::LibcallImpl LibcallImpl)
const;
228 LLVM_ABI std::pair<FunctionType *, AttributeList>
230 RTLIB::LibcallImpl LibcallImpl)
const;
236 RTLIB::LibcallImpl LibcallImpl)
const;
254 RTLIB::FuncArgTypeID ID = SignatureTable[SignatureOffset[LibcallImpl]];
255 return ID == RTLIB::Variable || ID == RTLIB::ThreadLocalVariable;
260 return SignatureTable[SignatureOffset[LibcallImpl]] ==
261 RTLIB::ThreadLocalVariable;
276 RTLIB::UNKNOWN_LIBCALL;
282#define GET_RUNTIME_LIBCALLS_INFO_MEMBER_DECLS
283#include "llvm/IR/RuntimeLibcalls.inc"
285 LLVM_ABI static iota_range<RTLIB::LibcallImpl>
286 lookupLibcallImplNameImpl(StringRef Name);
289 "default calling conv should be encoded as 0");
297 LLVM_ABI static const char RuntimeLibcallImplNameTableStorage[];
299 LLVM_ABI static const uint16_t RuntimeLibcallNameOffsetTable[];
300 LLVM_ABI static const uint8_t RuntimeLibcallNameSizeTable[];
303 LLVM_ABI static const FuncArgTypeID SignatureTable[];
304 LLVM_ABI static const uint16_t SignatureOffset[];
307 LLVM_ABI static const RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
309 RTLIB::Libcall selectLongDoubleLibcall(RTLIB::Libcall F80,
311 RTLIB::Libcall PPCF128)
const;
316 static inline iota_range<RTLIB::LibcallImpl>
317 libcallImplNameHit(uint16_t NameOffsetEntry, uint16_t StrOffset);
319 static bool darwinHasSinCosStret(
const Triple &TT) {
320 if (!
TT.isOSDarwin())
328 return !
TT.isMacOSXVersionLT(10, 9) &&
TT.isArch64Bit();
331 return !
TT.isOSVersionLT(7, 0);
337 static bool isAAPCS_ABI(
const Triple &TT, StringRef ABIName);
341 bool isLibraryAvailable(RTLIB::RuntimeLibrary Library)
const;
345 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.
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)
A parsed version of the target data layout string in and methods for querying it.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
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.
LLVM_ABI FunctionCallee getOrInsertLibcallDecl(Module &M, RTLIB::LibcallImpl LibcallImpl) const
static bool isVariable(RTLIB::LibcallImpl LibcallImpl)
static LLVM_ABI ArrayRef< RTLIB::RuntimeLibrary > getDefaultRuntimeLibraries(const Triple &TT)
Return the runtime libraries enabled by default for TT.
LLVM_ABI RTLIB::Libcall getLibcallFromImpl(RTLIB::LibcallImpl Impl) const
Return the libcall provided by Impl.
LLVM_ABI GlobalValue * getOrInsertImplGlobal(Module &M, RTLIB::LibcallImpl LibcallImpl) const
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
static unsigned getIntSize(const Triple &TT)
Get size of a C-level int or unsigned int, in bits.
static bool hasVectorMaskArgument(RTLIB::LibcallImpl Impl)
Returns true if the function has a vector mask argument, which is assumed to be the last argument.
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 Type * getVariableType(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) 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 void initExtensionsForTriple(bool &ShouldExtI32Param, bool &ShouldExtI32Return, bool &ShouldSignExtI32Param, bool &ShouldSignExtI32Return, const Triple &T)
Determine the extension attributes needed for i32 parameters and returns corresponding to C-level int...
void setUnavailable(RTLIB::LibcallImpl Impl)
static bool isThreadLocalVariable(RTLIB::LibcallImpl LibcallImpl)
static iota_range< RTLIB::LibcallImpl > lookupLibcallImplName(StringRef Name)
Check if a function name is a recognized runtime call of any kind.
static LLVM_ABI RTLIB::Libcall getUnmaskedVectorLibcall(RTLIB::Libcall LC)
Return the unmasked variant of the masked vector libcall LC, or RTLIB::UNKNOWN_LIBCALL if LC is not a...
RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const
Check if this is valid libcall for the current module, otherwise RTLIB::Unsupported.
static LLVM_ABI void initBoolExtensionsForTriple(bool &ShouldZExtBoolParam, bool &ShouldZExtBoolReturn, const Triple &T)
Determine whether bool parameters and returns need zeroext on T.
RuntimeLibcallsInfo()=default
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.
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...
LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &)
static LLVM_ABI RTLIB::Libcall getMaskedVectorLibcall(RTLIB::Libcall LC)
Return the masked variant of the vector libcall LC, or RTLIB::UNKNOWN_LIBCALL if LC has no masked var...
static constexpr bool is_iterable
static constexpr bool is_iterable