LLVM 24.0.0git
RuntimeLibcalls.cpp
Go to the documentation of this file.
1//===- RuntimeLibcalls.cpp - Interface for runtime libcalls -----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
11#include "llvm/IR/Intrinsics.h"
12#include "llvm/IR/Module.h"
14#include "llvm/IR/Type.h"
16
17#define DEBUG_TYPE "runtime-libcalls-info"
18
19using namespace llvm;
20using namespace RTLIB;
21
22#define GET_RUNTIME_LIBCALLS_INFO
23#define GET_INIT_RUNTIME_LIBCALL_NAMES
24#define GET_INIT_RUNTIME_LIBCALL_SIGNATURES
25#define GET_RUNTIME_LIBCALL_MASKED_VECTOR_LIBCALL_MAPPING
26#define GET_SET_TARGET_RUNTIME_LIBCALL_SETS
27#define DEFINE_GET_LOOKUP_LIBCALL_IMPL_NAME
28#define GET_RUNTIME_LIBCALL_INTRINSIC_TO_LIBCALL
29#include "llvm/IR/RuntimeLibcalls.inc"
30
31static RuntimeLibrary getVectorRuntimeLibrary(VectorLibrary VecLib) {
32 switch (VecLib) {
34 break;
36 return RuntimeLibrary::accelerate;
38 return RuntimeLibrary::darwin_libsystem_m;
40 return RuntimeLibrary::libmvec;
42 return RuntimeLibrary::massv;
44 return RuntimeLibrary::svml;
46 return RuntimeLibrary::sleefgnuabi;
48 return RuntimeLibrary::armpl;
50 return RuntimeLibrary::amdlibm;
51 }
52
53 llvm_unreachable("no RuntimeLibrary for VectorLibrary");
54}
55
57 const Triple &TT, ExceptionHandling ExceptionModel,
58 FloatABI::ABIType FloatABI, std::optional<LongDoubleFormat> LDblFormat,
59 StringRef ABIName, VectorLibrary VecLib)
60 : LongDoubleFmt(LDblFormat.value_or(TT.getDefaultLongDoubleFormat())) {
61 // Only an unspecified model resolves to the triple default; None is left as
62 // an explicit disable.
63 if (ExceptionModel == ExceptionHandling::Default)
64 ExceptionModel = TT.getDefaultExceptionHandling();
65
66 initLibcalls(TT, ExceptionModel, FloatABI, ABIName, LongDoubleFmt);
67
68 if (VecLib != VectorLibrary::NoLibrary) {
69 setAvailableLibraryLibcalls(getVectorRuntimeLibrary(VecLib), TT,
70 ExceptionModel, FloatABI, ABIName,
71 LongDoubleFmt);
72 }
73}
74
75// TODO: Consider the remaining module flags.
77 VectorLibrary VecLib)
78 : RuntimeLibcallsInfo(M.getTargetTriple(), M.getExceptionModel(),
79 M.getFloatABI(), M.getLongDoubleFormat(), ABIName,
80 VecLib) {}
81
82RTLIB::Libcall RuntimeLibcallsInfo::selectLongDoubleLibcall(
83 RTLIB::Libcall F80, RTLIB::Libcall F128, RTLIB::Libcall PPCF128) const {
84 switch (LongDoubleFmt) {
86 return F80;
88 return F128;
90 return PPCF128;
93 // These long double formats aren't properly handled, but we also don't emit
94 // calls for them. TODO: We could fix the avr_sin/avr_cos hack if we handled
95 // the float case.
96 return RTLIB::UNKNOWN_LIBCALL;
97 }
98
99 llvm_unreachable("unhandled long double format");
100}
101
102bool RuntimeLibcallsInfo::isLibraryAvailable(RuntimeLibrary Library) const {
103 // TODO: Drive this from module-level state (e.g. the linked runtime). For now
104 // every named library is reported as available.
105 return true;
106}
107
108void RuntimeLibcallsInfo::setTargetRuntimeLibcallSets(
109 const Triple &TT, ExceptionHandling ExceptionModel,
110 FloatABI::ABIType FloatABI, StringRef ABIName,
112 CallingConv::ID DefaultCC = getDefaultLibcallCallingConv(
113 TT, ExceptionModel, FloatABI, ABIName, LongDoubleFormat);
114 if (DefaultCC != CallingConv::C)
115 llvm::fill(LibcallImplCallingConvs, DefaultCC);
116
117 for (RTLIB::RuntimeLibrary Library : getDefaultRuntimeLibraries(TT)) {
118 if (isLibraryAvailable(Library))
119 setAvailableLibraryLibcalls(Library, TT, ExceptionModel, FloatABI,
120 ABIName, LongDoubleFormat);
121 }
122}
123
124/// Set default libcall names. If a target wants to opt-out of a libcall it
125/// should be placed here.
126void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
127 ExceptionHandling ExceptionModel,
128 FloatABI::ABIType FloatABI,
129 StringRef ABIName,
131 setTargetRuntimeLibcallSets(TT, ExceptionModel, FloatABI, ABIName,
133}
134
136iota_range<RTLIB::LibcallImpl>
137RuntimeLibcallsInfo::libcallImplNameHit(uint16_t NameOffsetEntry,
138 uint16_t StrOffset) {
139 int NumAliases = 1;
140 for (uint16_t Entry : ArrayRef(RuntimeLibcallNameOffsetTable)
141 .drop_front(NameOffsetEntry + 1)) {
142 if (Entry != StrOffset)
143 break;
144 ++NumAliases;
145 }
146
147 RTLIB::LibcallImpl ImplStart = static_cast<RTLIB::LibcallImpl>(
148 &RuntimeLibcallNameOffsetTable[NameOffsetEntry] -
149 &RuntimeLibcallNameOffsetTable[0]);
150 return enum_seq(ImplStart,
151 static_cast<RTLIB::LibcallImpl>(ImplStart + NumAliases));
152}
153
154bool RuntimeLibcallsInfo::isAAPCS_ABI(const Triple &TT, StringRef ABIName) {
155 const ARM::ARMABI TargetABI = ARM::computeTargetABI(TT, ABIName);
156 return TargetABI == ARM::ARM_ABI_AAPCS || TargetABI == ARM::ARM_ABI_AAPCS16;
157}
158
160 bool &ShouldExtI32Return,
161 bool &ShouldSignExtI32Param,
162 bool &ShouldSignExtI32Return,
163 const Triple &T) {
164 ShouldExtI32Param = ShouldExtI32Return = false;
165 ShouldSignExtI32Param = ShouldSignExtI32Return = false;
166
167 // PowerPC64, Sparc64, SystemZ need signext/zeroext on i32 parameters and
168 // returns corresponding to C-level ints and unsigned ints.
169 if (T.isPPC64() || T.getArch() == Triple::sparcv9 ||
170 T.getArch() == Triple::systemz) {
171 ShouldExtI32Param = true;
172 ShouldExtI32Return = true;
173 }
174 // LoongArch, Mips, and riscv64, on the other hand, need signext on i32
175 // parameters corresponding to both signed and unsigned ints.
176 if (T.isLoongArch() || T.isMIPS() || T.isRISCV64()) {
177 ShouldSignExtI32Param = true;
178 }
179 // LoongArch and riscv64 need signext on i32 returns corresponding to both
180 // signed and unsigned ints.
181 if (T.isLoongArch() || T.isRISCV64()) {
182 ShouldSignExtI32Return = true;
183 }
184}
185
186/// TODO: There is really no guarantee that sizeof(size_t) is equal to the index
187/// size of the default address space. This matches TargetLibraryInfo and should
188/// be kept in sync.
190 return DL.getIndexType(Ctx, /*AddressSpace=*/0);
191}
192
193// TODO: NoCallback probably unsafe in general
194static constexpr Attribute::AttrKind CommonFnAttrs[] = {
195 Attribute::NoCallback, Attribute::NoFree, Attribute::NoSync,
196 Attribute::NoUnwind, Attribute::WillReturn};
197
199 switch (Format) {
201 return Type::getFloatTy(Ctx);
203 return Type::getDoubleTy(Ctx);
205 return Type::getX86_FP80Ty(Ctx);
207 return Type::getFP128Ty(Ctx);
209 return Type::getPPC_FP128Ty(Ctx);
210 }
211
212 llvm_unreachable("unhandled long double format");
213}
214
215static std::pair<Type *, Attribute>
216convertToIRTypeAndAttr(FuncArgTypeID ID, LLVMContext &Ctx, const DataLayout &DL,
217 unsigned IntBits, LongDoubleFormat LdblFormat) {
218
219 // FIXME: Use the llvm/ABI library to get accurate IR types and attributes.
220 switch (ID) {
221 case Void:
222 return {Type::getVoidTy(Ctx), Attribute()};
223 case Bool:
224 return {IntegerType::get(Ctx, 1), Attribute::get(Ctx, Attribute::ZExt)};
225 case Int8:
226 return {IntegerType::get(Ctx, 8), Attribute()};
227 case Int16:
228 case UInt16:
229 return {IntegerType::get(Ctx, 16), Attribute()};
230 case Int32:
231 case UInt32:
232 return {IntegerType::get(Ctx, 32), Attribute()};
233 case Int:
234 case UInt:
235 case IntPlus:
236 case UIntPlus:
237 case Long:
238 case ULong:
239 case IntX:
240 case UIntX:
241 return {IntegerType::get(Ctx, IntBits), Attribute()};
242 case Int64:
243 case UInt64:
244 case LLong:
245 case ULLong:
246 return {IntegerType::get(Ctx, 64), Attribute()};
247 case Int128:
248 return {IntegerType::get(Ctx, 128), Attribute()};
249 case SizeT:
250 case SSizeT:
251 return {getSizeTType(Ctx, DL), Attribute()};
252 case Flt:
253 case Floating:
254 return {Type::getFloatTy(Ctx), Attribute()};
255 case Dbl:
256 return {Type::getDoubleTy(Ctx), Attribute()};
257 case LDbl:
258 return {getLongDoubleType(Ctx, LdblFormat), Attribute()};
259 case X86FP80:
260 return {Type::getX86_FP80Ty(Ctx), Attribute()};
261 case FP128:
262 return {Type::getFP128Ty(Ctx), Attribute()};
263 case PPCFP128:
264 return {Type::getPPC_FP128Ty(Ctx), Attribute()};
265 case Ptr:
266 return {PointerType::get(Ctx, 0), Attribute()};
267 case V2F32:
269 case V4F32:
271 case V8F32:
273 case V16F32:
274 return {FixedVectorType::get(Type::getFloatTy(Ctx), 16), Attribute()};
275 case NXV4F32:
277 case V2F64:
279 case V4F64:
281 case V8F64:
283 case NXV2F64:
285 case NXV2I1:
287 case NXV4I1:
289 case V2I32:
291 case V4I32:
293 case V8I32:
295 case V16I32:
296 return {FixedVectorType::get(Type::getInt32Ty(Ctx), 16), Attribute()};
297 case NXV2I32:
299 case NXV4I32:
301 default:
302 return {};
303 }
304}
305
306std::pair<FunctionType *, AttributeList>
308 LLVMContext &Ctx, const Triple &TT, const DataLayout &DL,
309 RTLIB::LibcallImpl LibcallImpl) const {
310 const FuncArgTypeID *ProtoTypes =
311 &SignatureTable[SignatureOffset[LibcallImpl]];
312
313 if (ProtoTypes[0] == NoFuncArgType)
314 return {};
315
316 unsigned IntBits = getIntSize(TT);
317 AttributeList Attrs;
318
319 auto [RetTy, RetAttr] =
320 convertToIRTypeAndAttr(ProtoTypes[0], Ctx, DL, IntBits, LongDoubleFmt);
321 if (RetAttr.isValid())
322 Attrs = Attrs.addRetAttribute(Ctx, RetAttr);
323
324 Type *LastTy = RetTy, *ArgTy;
325 Attribute LastAttr = RetAttr, ArgAttr;
327 bool IsVarArg = false;
328 unsigned Idx = 1;
329 for (FuncArgTypeID TyID = ProtoTypes[Idx]; TyID != NoFuncArgType;
330 TyID = ProtoTypes[++Idx]) {
331 if (TyID == Ellip) {
332 // The ellipsis ends the protoype list so it must be followed by
333 // NoFuncArgType.
334 assert(ProtoTypes[Idx + 1] == NoFuncArgType);
335 IsVarArg = true;
336 break;
337 }
338
339 if (TyID == Same) {
340 ArgTy = LastTy;
341 ArgAttr = LastAttr;
342 } else {
343 std::tie(ArgTy, ArgAttr) = convertToIRTypeAndAttr(
344 ProtoTypes[Idx], Ctx, DL, IntBits, LongDoubleFmt);
345 LastTy = ArgTy;
346 LastAttr = ArgAttr;
347 }
348
349 ArgTys.push_back(ArgTy);
350 if (ArgAttr.isValid())
351 Attrs = Attrs.addParamAttribute(Ctx, Idx - 1, ArgAttr);
352 }
353
354 if (RetTy->isVectorTy()) {
355 AttrBuilder FuncAttrBuilder(Ctx);
357 FuncAttrBuilder.addAttribute(Attr);
358 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
359 }
360
361 return {FunctionType::get(RetTy, ArgTys, IsVarArg), Attrs};
362}
363
364std::pair<FunctionType *, AttributeList>
366 const DataLayout &DL,
367 RTLIB::LibcallImpl LibcallImpl) const {
368 static constexpr Attribute::AttrKind MemoryFnAttrs[] = {
369 Attribute::NoUnwind, Attribute::WillReturn};
370 static constexpr Attribute::AttrKind CommonPtrArgAttrs[] = {
371 Attribute::NoAlias, Attribute::WriteOnly, Attribute::NonNull};
372
373 switch (LibcallImpl) {
374 // FIXME: Should also include __sincospi[f]_stret
375 case RTLIB::impl___sincos_stret:
376 case RTLIB::impl___sincosf_stret: {
377 if (!darwinHasSinCosStret(TT)) // Non-darwin currently unexpected
378 return {};
379
380 Type *ScalarTy = LibcallImpl == RTLIB::impl___sincosf_stret
381 ? Type::getFloatTy(Ctx)
382 : Type::getDoubleTy(Ctx);
383
384 AttrBuilder FuncAttrBuilder(Ctx);
386 FuncAttrBuilder.addAttribute(Attr);
387
388 const bool UseSret =
389 TT.isX86_32() || ((TT.isARM() || TT.isThumb()) &&
391
392 FuncAttrBuilder.addMemoryAttr(MemoryEffects::argMemOnly(
394
395 AttributeList Attrs;
396 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
397
398 if (UseSret) {
399 AttrBuilder AttrBuilder(Ctx);
400 StructType *StructTy = StructType::get(ScalarTy, ScalarTy);
401 AttrBuilder.addStructRetAttr(StructTy);
402 AttrBuilder.addAlignmentAttr(DL.getABITypeAlign(StructTy));
404 Type::getVoidTy(Ctx), {DL.getAllocaPtrType(Ctx), ScalarTy}, false);
405
406 return {FuncTy, Attrs.addParamAttributes(Ctx, 0, AttrBuilder)};
407 }
408
409 Type *RetTy =
410 LibcallImpl == RTLIB::impl___sincosf_stret && TT.isX86_64()
411 ? static_cast<Type *>(FixedVectorType::get(ScalarTy, 2))
412 : static_cast<Type *>(StructType::get(ScalarTy, ScalarTy));
413
414 return {FunctionType::get(RetTy, {ScalarTy}, false), Attrs};
415 }
416 case RTLIB::impl_malloc:
417 case RTLIB::impl_calloc: {
418 AttrBuilder FuncAttrBuilder(Ctx);
419 for (Attribute::AttrKind Attr : MemoryFnAttrs)
420 FuncAttrBuilder.addAttribute(Attr);
421 FuncAttrBuilder.addAttribute(Attribute::NoFree);
422
424 if (LibcallImpl == RTLIB::impl_malloc)
425 AllocKind |= AllocFnKind::Uninitialized;
426
427 // TODO: Set memory attribute
428 FuncAttrBuilder.addAllocKindAttr(AllocKind);
429 FuncAttrBuilder.addAttribute("alloc-family", "malloc");
430 FuncAttrBuilder.addAllocSizeAttr(0, LibcallImpl == RTLIB::impl_malloc
431 ? std::nullopt
432 : std::make_optional(1));
433
434 AttributeList Attrs;
435 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
436
437 {
438 AttrBuilder ArgAttrBuilder(Ctx);
439 for (Attribute::AttrKind AK : CommonPtrArgAttrs)
440 ArgAttrBuilder.addAttribute(AK);
441
442 Attrs = Attrs.addRetAttribute(Ctx, Attribute::NoUndef);
443 Attrs = Attrs.addRetAttribute(Ctx, Attribute::NoAlias);
444 Attrs = Attrs.addParamAttribute(Ctx, 0, Attribute::NoUndef);
445 if (LibcallImpl == RTLIB::impl_calloc)
446 Attrs = Attrs.addParamAttribute(Ctx, 1, Attribute::NoUndef);
447 }
448
449 IntegerType *SizeT = getSizeTType(Ctx, DL);
450 PointerType *PtrTy = PointerType::get(Ctx, 0);
451 SmallVector<Type *, 2> ArgTys = {SizeT};
452 if (LibcallImpl == RTLIB::impl_calloc)
453 ArgTys.push_back(SizeT);
454
455 return {FunctionType::get(PtrTy, ArgTys, false), Attrs};
456 }
457 case RTLIB::impl_free: {
458 // TODO: Set memory attribute
459 AttrBuilder FuncAttrBuilder(Ctx);
460 for (Attribute::AttrKind Attr : MemoryFnAttrs)
461 FuncAttrBuilder.addAttribute(Attr);
462
463 FuncAttrBuilder.addAllocKindAttr(AllocFnKind::Free);
464 FuncAttrBuilder.addAttribute("alloc-family", "malloc");
465
466 AttributeList Attrs;
467 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
468
469 {
470 AttrBuilder ArgAttrBuilder(Ctx);
471 ArgAttrBuilder.addAttribute(Attribute::NoUndef);
472 ArgAttrBuilder.addAttribute(Attribute::AllocatedPointer);
473 ArgAttrBuilder.addCapturesAttr(CaptureInfo::none());
474 Attrs = Attrs.addParamAttributes(Ctx, 0, ArgAttrBuilder);
475 }
476
477 return {FunctionType::get(Type::getVoidTy(Ctx), {PointerType::get(Ctx, 0)},
478 false),
479 Attrs};
480 }
481 case RTLIB::impl___aeabi_idivmod:
482 case RTLIB::impl___aeabi_uidivmod:
483 case RTLIB::impl___aeabi_ldivmod:
484 case RTLIB::impl___aeabi_uldivmod:
485 case RTLIB::impl___rt_sdiv:
486 case RTLIB::impl___rt_udiv:
487 case RTLIB::impl___rt_sdiv64:
488 case RTLIB::impl___rt_udiv64: {
489 // The ARM AEABI (__aeabi_*divmod) and Windows (__rt_*div*) divmod functions
490 // return both values modeled as an inreg { iN, iN } struct (quotient,
491 // remainder). The __rt_*div* cases pass the arguments in opposite order,
492 // though this doesn't affect the declaration.
493 bool IsSigned;
494 unsigned Bits;
495 switch (LibcallImpl) {
496 case RTLIB::impl___aeabi_idivmod:
497 case RTLIB::impl___rt_sdiv:
498 IsSigned = true;
499 Bits = 32;
500 break;
501 case RTLIB::impl___aeabi_uidivmod:
502 case RTLIB::impl___rt_udiv:
503 IsSigned = false;
504 Bits = 32;
505 break;
506 case RTLIB::impl___aeabi_ldivmod:
507 case RTLIB::impl___rt_sdiv64:
508 IsSigned = true;
509 Bits = 64;
510 break;
511 case RTLIB::impl___aeabi_uldivmod:
512 case RTLIB::impl___rt_udiv64:
513 IsSigned = false;
514 Bits = 64;
515 break;
516 default:
517 llvm_unreachable("unexpected divmod libcall");
518 }
519
520 Type *IntTy = IntegerType::get(Ctx, Bits);
521 StructType *RetTy = StructType::get(IntTy, IntTy);
522 FunctionType *FuncTy = FunctionType::get(RetTy, {IntTy, IntTy}, false);
523
524 AttrBuilder FuncAttrBuilder(Ctx);
526 FuncAttrBuilder.addAttribute(Attr);
527 FuncAttrBuilder.addMemoryAttr(MemoryEffects::none());
528
529 AttributeList Attrs;
530 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
531
532 Attribute::AttrKind ExtKind = IsSigned ? Attribute::SExt : Attribute::ZExt;
533 Attrs = Attrs.addRetAttribute(Ctx, Attribute::InReg);
534 Attrs = Attrs.addParamAttribute(Ctx, 0, ExtKind);
535 Attrs = Attrs.addParamAttribute(Ctx, 1, ExtKind);
536
537 return {FuncTy, Attrs};
538 }
539 case RTLIB::impl_sqrtf:
540 case RTLIB::impl_sqrt: {
541 AttrBuilder FuncAttrBuilder(Ctx);
542
544 FuncAttrBuilder.addAttribute(Attr);
545 FuncAttrBuilder.addMemoryAttr(MemoryEffects::errnoMemOnly(ModRefInfo::Mod));
546
547 AttributeList Attrs;
548 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
549
550 Type *ScalarTy = LibcallImpl == RTLIB::impl_sqrtf ? Type::getFloatTy(Ctx)
551 : Type::getDoubleTy(Ctx);
552 FunctionType *FuncTy = FunctionType::get(ScalarTy, {ScalarTy}, false);
553
554 Attrs = Attrs.addRetAttribute(
556 fcNegNormal));
557 return {FuncTy, Attrs};
558 }
559 default:
560 break;
561 }
562
563 auto [FuncTy, Attrs] = getDefaultFunctionTy(Ctx, TT, DL, LibcallImpl);
564 if (!FuncTy || FuncTy->getNumParams() == 0 ||
565 !FuncTy->getParamType(0)->isVectorTy())
566 return {FuncTy, Attrs};
567
568 Type *VecTy = FuncTy->getParamType(0);
569 AttrBuilder ArgAttrBuilder(Ctx);
570 for (Attribute::AttrKind AK : CommonPtrArgAttrs)
571 ArgAttrBuilder.addAttribute(AK);
572 ArgAttrBuilder.addAlignmentAttr(DL.getABITypeAlign(VecTy));
573
574 bool HasPtrArg = false;
575 for (auto [Idx, ParamTy] : enumerate(FuncTy->params())) {
576 if (ParamTy->isPointerTy()) {
577 Attrs = Attrs.addParamAttributes(Ctx, Idx, ArgAttrBuilder);
578 HasPtrArg = true;
579 }
580 }
581
582 if (HasPtrArg) {
583 AttrBuilder FuncAttrBuilder(Ctx);
585 FuncAttrBuilder.addAttribute(Attr);
586 FuncAttrBuilder.addMemoryAttr(MemoryEffects::argMemOnly(ModRefInfo::Mod));
587 Attrs = Attrs.addFnAttributes(Ctx, FuncAttrBuilder);
588 }
589
590 return {FuncTy, Attrs};
591}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
constexpr LLT V2F32
constexpr LLT V2F64
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
@ RetAttr
#define LLVM_ATTRIBUTE_ALWAYS_INLINE
LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always...
Definition Compiler.h:376
Utilities for dealing with flags related to floating point properties and mode controls.
Module.h This file contains the declarations for the Module class.
#define T
static std::pair< Type *, Attribute > convertToIRTypeAndAttr(FuncArgTypeID ID, LLVMContext &Ctx, const DataLayout &DL, unsigned IntBits, LongDoubleFormat LdblFormat)
static Type * getLongDoubleType(LLVMContext &Ctx, LongDoubleFormat Format)
static IntegerType * getSizeTType(LLVMContext &Ctx, const DataLayout &DL)
TODO: There is really no guarantee that sizeof(size_t) is equal to the index size of the default addr...
static RuntimeLibrary getVectorRuntimeLibrary(VectorLibrary VecLib)
static constexpr Attribute::AttrKind CommonFnAttrs[]
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:106
static LLVM_ABI Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
static LLVM_ABI Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask)
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition Attributes.h:125
static CaptureInfo none()
Create CaptureInfo that does not capture any components of the pointer.
Definition ModRef.h:427
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition Type.cpp:843
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.
Class to represent integer types.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition Type.cpp:338
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
static MemoryEffectsBase argMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
Definition ModRef.h:143
static MemoryEffectsBase errnoMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
Definition ModRef.h:154
static MemoryEffectsBase none()
Definition ModRef.h:128
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
Class to represent pointers.
static LLVM_ABI PointerType * get(LLVMContext &C, unsigned AddressSpace)
This constructs an opaque pointer to an object in a numbered address space.
Definition Type.cpp:887
static LLVM_ABI ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition Type.cpp:865
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
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.
Definition Type.cpp:467
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:299
static LLVM_ABI Type * getPPC_FP128Ty(LLVMContext &C)
Definition Type.cpp:282
static LLVM_ABI Type * getFP128Ty(LLVMContext &C)
Definition Type.cpp:281
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
Definition Type.cpp:272
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
Definition Type.cpp:296
static LLVM_ABI Type * getDoubleTy(LLVMContext &C)
Definition Type.cpp:277
static LLVM_ABI Type * getX86_FP80Ty(LLVMContext &C)
Definition Type.cpp:280
static LLVM_ABI Type * getFloatTy(LLVMContext &C)
Definition Type.cpp:276
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI LLVM_READONLY ARMABI computeTargetABI(const Triple &TT, StringRef ABIName="")
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
void fill(R &&Range, T &&Value)
Provide wrappers to std::fill which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1775
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
Definition STLExtras.h:2570
AllocFnKind
Definition Attributes.h:54
LongDoubleFormat
The floating-point format used for the target's "long double" type.
Definition CodeGen.h:117
constexpr auto enum_seq(EnumT Begin, EnumT End)
Iterate over an enum type from Begin up to - but not including - End.
Definition Sequence.h:373
@ Mod
The access may modify the value stored in memory.
Definition ModRef.h:34
@ NoModRef
The access neither references nor modifies the value stored in memory.
Definition ModRef.h:30
ArrayRef(const T &OneElt) -> ArrayRef< T >
ExceptionHandling
Definition CodeGen.h:54
@ Default
Not specified; resolve to the target's default model.
Definition CodeGen.h:55
VectorLibrary
List of known vector-functions libraries.
static LLVM_ABI ArrayRef< RTLIB::RuntimeLibrary > getDefaultRuntimeLibraries(const Triple &TT)
Return the runtime libraries enabled by default for TT.
LLVM_ABI std::pair< FunctionType *, AttributeList > getFunctionTy(LLVMContext &Ctx, const Triple &TT, const DataLayout &DL, RTLIB::LibcallImpl LibcallImpl) const
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...
unsigned getIntSize(const Triple &TT) const
Get size of a C-level int or unsigned int, in bits.
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...