14#ifndef LLVM_IR_GLOBALOBJECT_H
15#define LLVM_IR_GLOBALOBJECT_H
64 static const unsigned AlignmentMask = (1 << AlignmentBits) - 1;
77 unsigned AlignmentData =
Data & AlignmentMask;
164 return V->getValueID() == Value::FunctionVal ||
165 V->getValueID() == Value::GlobalVariableVal ||
166 V->getValueID() == Value::GlobalIFuncVal;
170 void setGlobalObjectFlag(
unsigned Bit,
bool Val) {
171 unsigned Mask = 1 << Bit;
176 LLVM_ABI StringRef getSectionImpl()
const;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
StringRef getSection() const
Get the custom section of this global if it has one.
LLVM_ABI void addTypeMetadata(unsigned Offset, Metadata *TypeID)
MaybeAlign getAlign() const
Returns the alignment of the given variable or function.
static bool classof(const Value *V)
static const unsigned GlobalObjectSubClassDataBits
GlobalObject(const GlobalObject &)=delete
LLVM_ABI void setAlignment(Align Align)
Sets the alignment attribute of the GlobalObject.
GlobalObject(Type *Ty, ValueTy VTy, AllocInfo AllocInfo, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace=0)
LLVM_ABI void copyMetadata(const GlobalObject *Src, unsigned Offset)
Copy metadata from Src, adjusting offsets by Offset.
LLVM_ABI void setComdat(Comdat *C)
LLVM_ABI VCallVisibility getVCallVisibility() const
LLVM_ABI void copyAttributesFrom(const GlobalObject *Src)
LLVM_ABI void setSection(StringRef S)
Change the section for this global.
const Comdat * getComdat() const
LLVM_ABI void setSectionPrefix(StringRef Prefix)
Set the section prefix for this global object.
@ VCallVisibilityLinkageUnit
@ VCallVisibilityTranslationUnit
LLVM_ABI std::optional< StringRef > getSectionPrefix() const
Get the section prefix for this global object.
void setGlobalObjectSubClassData(unsigned Val)
unsigned getGlobalObjectSubClassData() const
bool hasSection() const
Check if this global has a custom object file section.
LLVM_ABI bool canIncreaseAlignment() const
Returns true if the alignment of the value can be unilaterally increased.
LLVM_ABI void setVCallVisibilityMetadata(VCallVisibility Visibility)
static const unsigned GlobalValueSubClassDataBits
unsigned getGlobalValueSubClassData() const
void setGlobalValueSubClassData(unsigned V)
LinkageTypes
An enumeration for the kinds of linkage for global values.
GlobalValue(Type *Ty, ValueTy VTy, AllocInfo AllocInfo, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace)
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
bool hasMetadata() const
Return true if this value has any metadata attached to it.
LLVM_ABI void setMetadata(unsigned KindID, MDNode *Node)
Set a particular kind of metadata attachment.
LLVM_ABI void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const
Appends all metadata attached to this value to MDs, sorting by KindID.
LLVM_ABI bool eraseMetadata(unsigned KindID)
Erase all metadata attachments with the given kind.
LLVM_ABI void addMetadata(unsigned KindID, MDNode &MD)
Add a metadata attachment.
LLVM_ABI void eraseMetadataIf(function_ref< bool(unsigned, MDNode *)> Pred)
Erase all metadata attachments matching the given predicate.
LLVM_ABI void clearMetadata()
Erase all metadata attached to this Value.
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
ValueTy
Concrete subclass of this.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
MaybeAlign decodeMaybeAlign(unsigned Value)
Dual operation of the encode function above.
This struct is a compact representation of a valid (non-zero power of two) alignment.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Information about how a User object was allocated, to be passed into the User constructor.