25 "struct.__tgt_offload_entry", PointerType::getUnqual(
C),
26 PointerType::getUnqual(
C), M.getDataLayout().getIntPtrType(
C),
32std::pair<Constant *, GlobalVariable *>
35 int32_t Flags, int32_t Data) {
37 Type *Int8PtrTy = PointerType::getUnqual(M.getContext());
39 Type *SizeTy = M.getDataLayout().getIntPtrType(M.getContext());
44 Triple.
isNVPTX() ?
"$offloading$entry_name" :
".offloading.entry_name";
50 Str->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
56 ConstantInt::get(SizeTy,
Size),
57 ConstantInt::get(Int32Ty, Flags),
58 ConstantInt::get(Int32Ty, Data),
61 return {EntryInitializer, Str};
69 auto [EntryInitializer, NameGV] =
73 Triple.
isNVPTX() ?
"$offloading$entry$" :
".offloading.entry.";
78 M.getDataLayout().getDefaultGlobalsAddressSpace());
85 Entry->setAlignment(
Align(1));
88std::pair<GlobalVariable *, GlobalVariable *>
92 auto *ZeroInitilaizer =
95 auto *EntryType = ArrayType::get(
getEntryTy(M), 0);
114 M, ZeroInitilaizer->getType(),
true, GlobalVariable::InternalLinkage,
127 return std::make_pair(EntriesB, EntriesE);
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static ConstantAggregateZero * get(Type *Ty)
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
static Constant * getPointerBitCastOrAddrSpaceCast(Constant *C, Type *Ty)
Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.
static Constant * get(StructType *T, ArrayRef< Constant * > V)
This is an important base class in LLVM.
@ HiddenVisibility
The GV is hidden.
@ InternalLinkage
Rename collisions when linking (static functions).
@ WeakODRLinkage
Same, but only replaced by something equivalent.
@ ExternalLinkage
Externally visible function.
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
This is an important class for using LLVM in a threaded context.
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 StructType * getTypeByName(LLVMContext &C, StringRef Name)
Return the type with the specified name, or null if there is none by that name.
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Triple - Helper class for working with autoconf configuration names.
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
The instances of the Type class are immutable: once they are created, they are never changed.
static IntegerType * getInt32Ty(LLVMContext &C)
Type * getType() const
All values are typed, get the type of this value.
@ C
The default llvm calling convention, compatible with C.
std::pair< Constant *, GlobalVariable * > getOffloadingEntryInitializer(Module &M, Constant *Addr, StringRef Name, uint64_t Size, int32_t Flags, int32_t Data)
Create a constant struct initializer used to register this global at runtime.
StructType * getEntryTy(Module &M)
Returns the type of the offloading entry we use to store kernels and globals that will be registered ...
void emitOffloadingEntry(Module &M, Constant *Addr, StringRef Name, uint64_t Size, int32_t Flags, int32_t Data, StringRef SectionName)
Create an offloading section struct used to register this global at runtime.
std::pair< GlobalVariable *, GlobalVariable * > getOffloadEntryArray(Module &M, StringRef SectionName)
Creates a pair of globals used to iterate the array of offloading entries by accessing the section va...
This is an optimization pass for GlobalISel generic memory operations.
void appendToCompilerUsed(Module &M, ArrayRef< GlobalValue * > Values)
Adds global values to the llvm.compiler.used list.
This struct is a compact representation of a valid (non-zero power of two) alignment.