14#ifndef LLVM_IR_GLOBALOBJECT_H
15#define LLVM_IR_GLOBALOBJECT_H
69 static const unsigned AlignmentMask = (1 << AlignmentBits) - 1;
82 unsigned AlignmentData =
Data & AlignmentMask;
206 return V->getValueID() == Value::FunctionVal ||
207 V->getValueID() == Value::GlobalVariableVal ||
208 V->getValueID() == Value::GlobalIFuncVal;
212 void setGlobalObjectFlag(
unsigned Bit,
bool Val) {
213 unsigned Mask = 1 << Bit;
218 LLVM_ABI StringRef getSectionImpl()
const;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
LLVM_ABI bool hasMetadataOtherThanDebugLoc() const
StringRef getSection() const
Get the custom section of this global if it has one.
LLVM_ABI void addTypeMetadata(unsigned Offset, Metadata *TypeID)
unsigned MetadataIndex
Index of first metadata attachment in context, or zero.
MaybeAlign getAlign() const
Returns the alignment of the given variable or function.
LLVM_ABI bool setSectionPrefix(StringRef Prefix)
If existing prefix is different from Prefix, set it to Prefix.
static bool classof(const Value *V)
static const unsigned GlobalObjectSubClassDataBits
GlobalObject(const GlobalObject &)=delete
bool hasMetadata() const
Return true if this GlobalObject has any metadata attached to it.
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)
MDNode * getMetadata(StringRef Kind) const
Get the metadata of given kind attached to this GlobalObject.
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
@ VCallVisibilityLinkageUnit
@ VCallVisibilityTranslationUnit
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this GlobalObject.
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.
bool hasMetadata(StringRef Kind) const
Return true if this instruction has the given type of metadata attached.
bool hasMetadata(unsigned KindID) const
Return true if this instruction has the given type of metadata attached.
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)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
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_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 MDNode * getMetadataImpl(unsigned KindID) const LLVM_READONLY
Get metadata for the given kind, if any.
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 MDNode * getMetadata(StringRef Kind) const LLVM_READONLY
Get the current metadata attachments for the given kind, if any.
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.
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.