Go to the documentation of this file.
17 #ifndef LLVM_IR_GLOBALVALUE_H
18 #define LLVM_IR_GLOBALVALUE_H
127 void destroyConstantImpl();
133 bool mayBeDerefined()
const {
230 return const_cast<Comdat *
>(
242 "local linkage requires default visibility");
456 return !mayBeDerefined();
531 if (!
Name.empty() &&
Name[0] ==
'\1')
532 return Name.substr(1);
625 return V->
getValueID() == Value::FunctionVal ||
626 V->
getValueID() == Value::GlobalVariableVal ||
641 #endif // LLVM_IR_GLOBALVALUE_H
bool hasSanitizerMetadata() const
void removeFromParent()
This method unlinks 'this' from the containing module, but does not delete it.
This is an optimization pass for GlobalISel generic memory operations.
bool hasCommonLinkage() const
std::string getGlobalIdentifier() const
Return the modified name for this global value suitable to be used as the key for a global lookup (e....
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
bool hasExternalLinkage() const
LinkageTypes getLinkage() const
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1',...
@ HiddenVisibility
The GV is hidden.
bool hasProtectedVisibility() const
bool isImplicitDSOLocal() const
bool hasWeakLinkage() const
static bool isLocalLinkage(LinkageTypes Linkage)
Error materialize()
Make sure this GlobalValue is fully read.
unsigned HasPartition
True if this symbol has a partition name assigned (see https://lld.llvm.org/Partitions....
void setThreadLocalMode(ThreadLocalMode Val)
bool hasHiddenVisibility() const
The instances of the Type class are immutable: once they are created, they are never changed.
unsigned IsDSOLocal
If true then there is a definition within the same linkage unit and that definition cannot be runtime...
@ DefaultVisibility
The GV is visible.
void setSanitizerMetadata(SanitizerMetadata Meta)
void setUnnamedAddr(UnnamedAddr Val)
LinkageTypes
An enumeration for the kinds of linkage for global values.
static bool isLinkOnceODRLinkage(LinkageTypes Linkage)
@ DLLImportStorageClass
Function to be imported from DLL.
bool isDiscardableIfUnused() const
void setDSOLocal(bool Local)
bool hasExternalWeakLinkage() const
static const unsigned GlobalValueSubClassDataBits
static bool isValidDeclarationLinkage(LinkageTypes Linkage)
StringRef getSection() const
static bool isCommonLinkage(LinkageTypes Linkage)
bool hasExactDefinition() const
Return true if this global has an exact defintion.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
VisibilityTypes
An enumeration for the kinds of visibility of global values.
bool hasAppendingLinkage() const
static bool isLinkOnceAnyLinkage(LinkageTypes Linkage)
static bool isAppendingLinkage(LinkageTypes Linkage)
const SanitizerMetadata & getSanitizerMetadata() const
(vector float) vec_cmpeq(*A, *B) C
ThreadLocalMode getThreadLocalMode() const
unsigned HasSanitizerMetadata
True if this symbol has sanitizer metadata available.
static bool isInternalLinkage(LinkageTypes Linkage)
bool hasPrivateLinkage() const
void copyAttributesFrom(const GlobalValue *Src)
Copy all additional attributes (those not needed to create a GlobalValue) from the GlobalValue Src to...
bool hasAtLeastLocalUnnamedAddr() const
Returns true if this value's address is not significant in this module.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static bool isWeakODRLinkage(LinkageTypes Linkage)
unsigned getValueID() const
Return an ID for the concrete type of this object.
bool hasLinkOnceAnyLinkage() const
void setName(const Twine &Name)
Change the name of the value.
bool hasInternalLinkage() const
bool hasGlobalUnnamedAddr() const
@ InternalLinkage
Rename collisions when linking (static functions).
Intrinsic::ID IntID
The intrinsic ID for this subclass (which must be a Function).
static GUID getGUID(StringRef GlobalName)
Return a 64-bit global unique ID constructed from global value name (i.e.
bool hasDefaultVisibility() const
@ DLLExportStorageClass
Function to be accessible from DLL.
bool isWeakForLinker() const
const Module * getParent() const
bool hasAvailableExternallyLinkage() const
bool canBenefitFromLocalAlias() const
This is an important base class in LLVM.
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
static bool isWeakForLinker(LinkageTypes Linkage)
Whether the definition of this global may be replaced at link time.
VisibilityTypes getVisibility() const
Module * getParent()
Get the module that this global value is contained inside of...
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
DLLStorageClassTypes getDLLStorageClass() const
StringRef getPartition() const
Class to represent pointers.
void setLinkage(LinkageTypes LT)
static bool isDiscardableIfUnused(LinkageTypes Linkage)
Whether the definition of this global may be discarded if it is not used in its compilation unit.
void setThreadLocal(bool Val)
static bool classof(const Value *V)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isExternalLinkage(LinkageTypes Linkage)
bool hasLocalLinkage() const
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
GlobalObject * getAliaseeObject()
static bool isWeakLinkage(LinkageTypes Linkage)
static bool isAvailableExternallyLinkage(LinkageTypes Linkage)
A Module instance is used to store all the information related to an LLVM module.
@ AppendingLinkage
Special purpose, only applies to global arrays.
ValueTy
Concrete subclass of this.
bool isMaterializable() const
If this function's Module is being lazily streamed in functions from disk or some other source,...
static LinkageTypes getWeakLinkage(bool ODR)
bool canBeOmittedFromSymbolTable() const
True if GV can be left out of the object symbol table.
void removeDeadConstantUsers() const
If there are any dead constant users dangling off of this constant, remove them.
unsigned getGlobalValueSubClassData() const
StringRef - Represent a constant reference to a string, i.e.
bool isDefinitionExact() const
Return true if the currently visible definition of this global (if any) is exactly the definition we ...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
@ WeakODRLinkage
Same, but only replaced by something equivalent.
void setDLLStorageClass(DLLStorageClassTypes C)
Machine Check Debug Module
@ AvailableExternallyLinkage
Available for inspection, not emission.
const GlobalObject * getAliaseeObject() const
@ CommonLinkage
Tentative definitions.
void eraseFromParent()
This method unlinks 'this' from the containing module and deletes it.
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
static bool isLinkOnceLinkage(LinkageTypes Linkage)
UnnamedAddr getUnnamedAddr() const
bool isInterposable() const
Return true if this global's definition can be substituted with an arbitrary definition at link time ...
void setParent(Module *parent)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool hasLinkOnceODRLinkage() const
bool hasDLLExportStorageClass() const
static bool isInterposableLinkage(LinkageTypes Linkage)
Whether the definition of this global may be replaced by something non-equivalent at link time.
Should compile to something r4 addze r3 instead we get
bool hasValidDeclarationLinkage() const
Lightweight error class with error context and mandatory checking.
const Comdat * getComdat() const
GUID getGUID() const
Return a 64-bit global unique ID constructed from global value name (i.e.
static bool isPrivateLinkage(LinkageTypes Linkage)
@ ProtectedVisibility
The GV is protected.
GlobalValue::SanitizerMetadata SanitizerMetadata
unsigned getAddressSpace() const
void setGlobalValueSubClassData(unsigned V)
@ ExternalLinkage
Externally visible function.
unsigned HasLLVMReservedName
True if the function's name starts with "llvm.".
DLLStorageClassTypes
Storage classes of global values for PE targets.
bool isAbsoluteSymbolRef() const
Returns whether this is a reference to an absolute symbol.
@ PrivateLinkage
Like Internal, but omit from symbol table.
void removeSanitizerMetadata()
Optional< ConstantRange > getAbsoluteSymbolRange() const
If this is an absolute symbol reference, returns the range of the symbol, otherwise returns None.
bool hasWeakODRLinkage() const
ThreadLocal - A class used to abstract thread-local storage.
bool isDeclarationForLinker() const
bool hasDLLImportStorageClass() const
void setPartition(StringRef Part)
bool hasWeakAnyLinkage() const
static bool isWeakAnyLinkage(LinkageTypes Linkage)
bool hasLinkOnceLinkage() const
PointerType * getType() const
Global values are always pointers.
Type * getValueType() const
bool hasPartition() const
GlobalValue(Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace)
BlockVerifier::State From
@ ExternalWeakLinkage
ExternalWeak linkage description.
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
void setVisibility(VisibilityTypes V)
LLVM Value Representation.
static bool isExternalWeakLinkage(LinkageTypes Linkage)
static UnnamedAddr getMinUnnamedAddr(UnnamedAddr A, UnnamedAddr B)
A Use represents the edge between a Value definition and its users.
uint64_t MD5Hash(StringRef Str)
Helper to compute and return lower 64 bits of the given string's MD5 hash.
static LinkageTypes getLinkOnceLinkage(bool ODR)