17#define DEBUG_TYPE "runtime-libcalls-info"
22#define GET_RUNTIME_LIBCALLS_INFO
23#define GET_INIT_RUNTIME_LIBCALL_NAMES
24#define GET_SET_TARGET_RUNTIME_LIBCALL_SETS
25#define DEFINE_GET_LOOKUP_LIBCALL_IMPL_NAME
26#include "llvm/IR/RuntimeLibcalls.inc"
35void RuntimeLibcallsInfo::initLibcalls(
const Triple &TT,
39 setTargetRuntimeLibcallSets(TT, ExceptionModel,
FloatABI, EABIVersion,
45RuntimeLibcallsInfo::libcallImplNameHit(
uint16_t NameOffsetEntry,
49 .drop_front(NameOffsetEntry + 1)) {
50 if (Entry != StrOffset)
55 RTLIB::LibcallImpl ImplStart =
static_cast<RTLIB::LibcallImpl
>(
56 &RuntimeLibcallNameOffsetTable[NameOffsetEntry] -
57 &RuntimeLibcallNameOffsetTable[0]);
59 static_cast<RTLIB::LibcallImpl
>(ImplStart + NumAliases));
62bool RuntimeLibcallsInfo::isAAPCS_ABI(
const Triple &TT, StringRef ABIName) {
67bool RuntimeLibcallsInfo::darwinHasExp10(
const Triple &TT) {
70 return !
TT.isMacOSXVersionLT(10, 9);
72 return !
TT.isOSVersionLT(7, 0);
84std::pair<FunctionType *, AttributeList>
87 RTLIB::LibcallImpl LibcallImpl)
const {
89 Attribute::NoCallback, Attribute::NoFree, Attribute::NoSync,
90 Attribute::NoUnwind, Attribute::WillReturn};
92 switch (LibcallImpl) {
93 case RTLIB::impl___sincos_stret:
94 case RTLIB::impl___sincosf_stret: {
95 if (!darwinHasSinCosStret(TT))
98 Type *ScalarTy = LibcallImpl == RTLIB::impl___sincosf_stret
102 AttrBuilder FuncAttrBuilder(Ctx);
104 FuncAttrBuilder.addAttribute(Attr);
107 TT.isX86_32() || ((TT.isARM() || TT.isThumb()) &&
114 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
117 AttrBuilder AttrBuilder(Ctx);
119 AttrBuilder.addStructRetAttr(StructTy);
120 AttrBuilder.addAlignmentAttr(
DL.getABITypeAlign(StructTy));
124 return {FuncTy, Attrs.addParamAttributes(Ctx, 0, AttrBuilder)};
128 LibcallImpl == RTLIB::impl___sincosf_stret && TT.isX86_64()
134 case RTLIB::impl_sqrtf:
135 case RTLIB::impl_sqrt: {
136 AttrBuilder FuncAttrBuilder(Ctx);
139 FuncAttrBuilder.addAttribute(Attr);
143 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
149 Attrs = Attrs.addRetAttribute(
152 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.
Module.h This file contains the declarations for the Module class.
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)
A Module instance is used to store all the information related to an LLVM module.
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
RuntimeLibcallsInfo()=default