17#ifndef LLVM_IR_GLOBALVALUE_H
18#define LLVM_IR_GLOBALVALUE_H
131 void destroyConstantImpl();
137 bool mayBeDerefined()
const {
164 bool isNobuiltinFnDef()
const;
244 return const_cast<Comdat *
>(
256 "local linkage requires default visibility");
286 "local linkage requires DefaultStorageClass");
491 return !mayBeDerefined();
568 Name.consume_front(
"\1");
666 return V->getValueID() == Value::FunctionVal ||
667 V->getValueID() == Value::GlobalVariableVal ||
668 V->getValueID() == Value::GlobalAliasVal ||
669 V->getValueID() == Value::GlobalIFuncVal;
BlockVerifier::State From
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
GlobalValue::SanitizerMetadata SanitizerMetadata
Machine Check Debug Module
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This is an important base class in LLVM.
void removeDeadConstantUsers() const
If there are any dead constant users dangling off of this constant, remove them.
A parsed version of the target data layout string in and methods for querying it.
Lightweight error class with error context and mandatory checking.
bool isDefinitionExact() const
Return true if the currently visible definition of this global (if any) is exactly the definition we ...
unsigned HasSanitizerMetadata
True if this symbol has sanitizer metadata available.
static bool isWeakAnyLinkage(LinkageTypes Linkage)
bool hasLinkOnceLinkage() const
const Module * getParent() const
static bool isAppendingLinkage(LinkageTypes Linkage)
bool hasPartition() const
static bool isLinkOnceAnyLinkage(LinkageTypes Linkage)
const SanitizerMetadata & getSanitizerMetadata() const
bool hasExternalLinkage() const
unsigned HasPartition
True if this symbol has a partition name assigned (see https://lld.llvm.org/Partitions....
void removeSanitizerMetadata()
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
static bool isExternalWeakLinkage(LinkageTypes Linkage)
VisibilityTypes getVisibility() const
bool isImplicitDSOLocal() const
static bool isLocalLinkage(LinkageTypes Linkage)
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
bool hasValidDeclarationLinkage() const
LinkageTypes getLinkage() const
void setUnnamedAddr(UnnamedAddr Val)
static bool isWeakODRLinkage(LinkageTypes Linkage)
bool hasLinkOnceAnyLinkage() const
bool hasLocalLinkage() const
bool hasDefaultVisibility() const
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1',...
bool hasPrivateLinkage() const
bool isAbsoluteSymbolRef() const
Returns whether this is a reference to an absolute symbol.
void setDLLStorageClass(DLLStorageClassTypes C)
const Comdat * getComdat() const
void setThreadLocalMode(ThreadLocalMode Val)
static bool isLinkOnceLinkage(LinkageTypes Linkage)
Intrinsic::ID IntID
The intrinsic ID for this subclass (which must be a Function).
bool hasHiddenVisibility() const
bool hasExternalWeakLinkage() const
ThreadLocalMode getThreadLocalMode() const
bool hasExactDefinition() const
Return true if this global has an exact defintion.
unsigned HasLLVMReservedName
True if the function's name starts with "llvm.".
static bool isAvailableExternallyLinkage(LinkageTypes Linkage)
bool hasWeakAnyLinkage() const
void setParent(Module *parent)
bool hasDLLImportStorageClass() const
void setLinkage(LinkageTypes LT)
DLLStorageClassTypes
Storage classes of global values for PE targets.
@ DLLExportStorageClass
Function to be accessible from DLL.
@ DLLImportStorageClass
Function to be imported from DLL.
bool hasDLLExportStorageClass() const
bool isDeclarationForLinker() const
bool hasSanitizerMetadata() const
static UnnamedAddr getMinUnnamedAddr(UnnamedAddr A, UnnamedAddr B)
GlobalObject * getAliaseeObject()
unsigned getAddressSpace() const
GUID getGUID() const
Return a 64-bit global unique ID constructed from global value name (i.e.
StringRef getSection() const
StringRef getPartition() const
Module * getParent()
Get the module that this global value is contained inside of...
static bool isCommonLinkage(LinkageTypes Linkage)
const GlobalObject * getAliaseeObject() const
void setDSOLocal(bool Local)
std::optional< ConstantRange > getAbsoluteSymbolRange() const
If this is an absolute symbol reference, returns the range of the symbol, otherwise returns std::null...
bool hasInternalLinkage() const
void eraseFromParent()
This method unlinks 'this' from the containing module and deletes it.
static bool isPrivateLinkage(LinkageTypes Linkage)
bool isDiscardableIfUnused() const
static bool isExternalLinkage(LinkageTypes Linkage)
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
PointerType * getType() const
Global values are always pointers.
VisibilityTypes
An enumeration for the kinds of visibility of global values.
@ DefaultVisibility
The GV is visible.
@ HiddenVisibility
The GV is hidden.
@ ProtectedVisibility
The GV is protected.
void copyAttributesFrom(const GlobalValue *Src)
Copy all additional attributes (those not needed to create a GlobalValue) from the GlobalValue Src to...
static bool isValidDeclarationLinkage(LinkageTypes Linkage)
static const unsigned GlobalValueSubClassDataBits
static bool isInternalLinkage(LinkageTypes Linkage)
void setNoSanitizeMetadata()
bool isInterposable() const
Return true if this global's definition can be substituted with an arbitrary definition at link time ...
void setVisibility(VisibilityTypes V)
const DataLayout & getDataLayout() const
Get the data layout of the module this global belongs to.
bool canBenefitFromLocalAlias() const
static bool isInterposableLinkage(LinkageTypes Linkage)
Whether the definition of this global may be replaced by something non-equivalent at link time.
bool hasWeakLinkage() const
bool hasAtLeastLocalUnnamedAddr() const
Returns true if this value's address is not significant in this module.
unsigned getGlobalValueSubClassData() const
static LinkageTypes getWeakLinkage(bool ODR)
bool hasWeakODRLinkage() const
void setGlobalValueSubClassData(unsigned V)
unsigned IsDSOLocal
If true then there is a definition within the same linkage unit and that definition cannot be runtime...
static LinkageTypes getLinkOnceLinkage(bool ODR)
bool isMaterializable() const
If this function's Module is being lazily streamed in functions from disk or some other source,...
bool isWeakForLinker() const
bool hasCommonLinkage() const
bool hasGlobalUnnamedAddr() const
Error materialize()
Make sure this GlobalValue is fully read.
UnnamedAddr getUnnamedAddr() const
static bool isWeakForLinker(LinkageTypes Linkage)
Whether the definition of this global may be replaced at link time.
GlobalValue(const GlobalValue &)=delete
bool hasAppendingLinkage() const
static bool isWeakLinkage(LinkageTypes Linkage)
static bool isDiscardableIfUnused(LinkageTypes Linkage)
Whether the definition of this global may be discarded if it is not used in its compilation unit.
void setSanitizerMetadata(SanitizerMetadata Meta)
static bool classof(const Value *V)
bool hasLinkOnceODRLinkage() const
bool canBeOmittedFromSymbolTable() const
True if GV can be left out of the object symbol table.
void removeFromParent()
This method unlinks 'this' from the containing module, but does not delete it.
bool hasAvailableExternallyLinkage() 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....
LinkageTypes
An enumeration for the kinds of linkage for global values.
@ PrivateLinkage
Like Internal, but omit from symbol table.
@ CommonLinkage
Tentative definitions.
@ InternalLinkage
Rename collisions when linking (static functions).
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
@ WeakODRLinkage
Same, but only replaced by something equivalent.
@ ExternalLinkage
Externally visible function.
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
@ AppendingLinkage
Special purpose, only applies to global arrays.
@ AvailableExternallyLinkage
Available for inspection, not emission.
@ ExternalWeakLinkage
ExternalWeak linkage description.
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
void setThreadLocal(bool Val)
DLLStorageClassTypes getDLLStorageClass() const
Type * getValueType() const
GlobalValue(Type *Ty, ValueTy VTy, AllocInfo AllocInfo, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace)
static bool isLinkOnceODRLinkage(LinkageTypes Linkage)
bool hasProtectedVisibility() const
void setPartition(StringRef Part)
A Module instance is used to store all the information related to an LLVM module.
Class to represent pointers.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
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.
Type * getType() const
All values are typed, get the type of this value.
void setName(const Twine &Name)
Change the name of the value.
unsigned getValueID() const
Return an ID for the concrete type of this object.
ValueTy
Concrete subclass of this.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
constexpr char GlobalIdentifierDelimiter
Information about how a User object was allocated, to be passed into the User constructor.