17#define DEBUG_TYPE "runtime-libcalls-info"
22#define GET_INIT_RUNTIME_LIBCALL_NAMES
23#define GET_SET_TARGET_RUNTIME_LIBCALL_SETS
24#define DEFINE_GET_LOOKUP_LIBCALL_IMPL_NAME
25#include "llvm/IR/RuntimeLibcalls.inc"
29void RuntimeLibcallsInfo::initLibcalls(
const Triple &TT,
33 setTargetRuntimeLibcallSets(TT, ExceptionModel,
FloatABI, EABIVersion,
38iota_range<RTLIB::LibcallImpl>
39RuntimeLibcallsInfo::libcallImplNameHit(uint16_t NameOffsetEntry,
42 for (uint16_t Entry :
ArrayRef(RuntimeLibcallNameOffsetTable)
43 .drop_front(NameOffsetEntry + 1)) {
44 if (Entry != StrOffset)
49 RTLIB::LibcallImpl ImplStart =
static_cast<RTLIB::LibcallImpl
>(
50 &RuntimeLibcallNameOffsetTable[NameOffsetEntry] -
51 &RuntimeLibcallNameOffsetTable[0]);
53 static_cast<RTLIB::LibcallImpl
>(ImplStart + NumAliases));
56bool RuntimeLibcallsInfo::isAAPCS_ABI(
const Triple &TT, StringRef ABIName) {
61bool RuntimeLibcallsInfo::darwinHasExp10(
const Triple &TT) {
64 return !
TT.isMacOSXVersionLT(10, 9);
66 return !
TT.isOSVersionLT(7, 0);
78std::pair<FunctionType *, AttributeList>
81 RTLIB::LibcallImpl LibcallImpl)
const {
83 Attribute::NoCallback, Attribute::NoFree, Attribute::NoSync,
84 Attribute::NoUnwind, Attribute::WillReturn};
86 switch (LibcallImpl) {
87 case RTLIB::impl___sincos_stret:
88 case RTLIB::impl___sincosf_stret: {
89 if (!darwinHasSinCosStret(TT))
92 Type *ScalarTy = LibcallImpl == RTLIB::impl___sincosf_stret
96 AttrBuilder FuncAttrBuilder(Ctx);
98 FuncAttrBuilder.addAttribute(Attr);
101 TT.isX86_32() || ((TT.isARM() || TT.isThumb()) &&
108 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
111 AttrBuilder AttrBuilder(Ctx);
113 AttrBuilder.addStructRetAttr(StructTy);
114 AttrBuilder.addAlignmentAttr(
DL.getABITypeAlign(StructTy));
118 return {FuncTy, Attrs.addParamAttributes(Ctx, 0, AttrBuilder)};
122 LibcallImpl == RTLIB::impl___sincosf_stret && TT.isX86_64()
128 case RTLIB::impl_sqrtf:
129 case RTLIB::impl_sqrt: {
130 AttrBuilder FuncAttrBuilder(Ctx);
133 FuncAttrBuilder.addAttribute(Attr);
137 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
143 Attrs = Attrs.addRetAttribute(
146 return {FuncTy, Attrs};
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_ATTRIBUTE_ALWAYS_INLINE
LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always...
Utilities for dealing with flags related to floating point properties and mode controls.
static LLVM_ABI Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask)
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
A parsed version of the target data layout string in and methods for querying it.
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Class to represent function types.
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
This is an important class for using LLVM in a threaded context.
static MemoryEffectsBase errnoMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
static MemoryEffectsBase argumentOrErrnoMemOnly(ModRefInfo ArgMR=ModRefInfo::ModRef, ModRefInfo ErrnoMR=ModRefInfo::ModRef)
StringRef - Represent a constant reference to a string, i.e.
Class to represent struct types.
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
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.
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
LLVM_ABI LLVM_READONLY ARMABI computeTargetABI(const Triple &TT, StringRef ABIName="")
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.
@ Mod
The access may modify the value stored in memory.
@ NoModRef
The access neither references nor modifies the value stored in memory.
ArrayRef(const T &OneElt) -> ArrayRef< T >
std::pair< FunctionType *, AttributeList > getFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const