class GlobalVariable
Declaration
class GlobalVariable : public GlobalObject { /* full declaration omitted */ };
Declared at: llvm/include/llvm/IR/GlobalVariable.h:41
Inherits from: GlobalObject
Member Variables
Inherited from GlobalObject:
- protected ObjComdat
- protected static GlobalObjectSubClassDataBits = GlobalValueSubClassDataBits - GlobalObjectBits
Inherited from GlobalValue:
- protected ValueType
- protected Linkage
- protected Visibility
- protected UnnamedAddrVal
- protected DllStorageClass
- protected ThreadLocal
- protected HasLLVMReservedName
- protected IsDSOLocal
- protected HasPartition
- protected IntID
- protected Parent
- protected static GlobalValueSubClassDataBits = 16
Inherited from Value:
- protected SubclassOptionalData
- protected NumUserOperands
- protected IsUsedByMD
- protected HasName
- protected HasHungOffUses
- protected HasDescriptor
- public static MaxAlignmentExponent = 29
- public static MaximumAlignment = 1U << MaxAlignmentExponent
Method Overview
- public GlobalVariable(llvm::Module & M, llvm::Type * Ty, bool isConstant, llvm::GlobalValue::LinkageTypes Linkage, llvm::Constant * Initializer, const llvm::Twine & Name = "", llvm::GlobalVariable * InsertBefore = nullptr, llvm::GlobalValue::ThreadLocalMode = NotThreadLocal, unsigned int AddressSpace = 0, bool isExternallyInitialized = false)
- public GlobalVariable(const llvm::GlobalVariable &)
- public GlobalVariable(llvm::Type * Ty, bool isConstant, llvm::GlobalValue::LinkageTypes Linkage, llvm::Constant * Initializer = nullptr, const llvm::Twine & Name = "", llvm::GlobalValue::ThreadLocalMode = NotThreadLocal, unsigned int AddressSpace = 0, bool isExternallyInitialized = false)
- public void addAttribute(llvm::StringRef Kind, llvm::StringRef Val = llvm::StringRef())
- public void addAttribute(Attribute::AttrKind Kind)
- public void addDebugInfo(llvm::DIGlobalVariableExpression * GV)
- public static bool classof(const llvm::Value * V)
- public void copyAttributesFrom(const llvm::GlobalVariable * Src)
- public void dropAllReferences()
- public void eraseFromParent()
- public llvm::Attribute getAttribute(llvm::StringRef Kind) const
- public llvm::Attribute getAttribute(Attribute::AttrKind Kind) const
- public llvm::AttributeSet getAttributes() const
- public llvm::AttributeList getAttributesAsList(unsigned int index) const
- public void getDebugInfo(SmallVectorImpl<llvm::DIGlobalVariableExpression *> & GVs) const
- public inline llvm::Constant * getInitializer()
- public inline const llvm::Constant * getInitializer() const
- public bool hasAttribute(Attribute::AttrKind Kind) const
- public bool hasAttribute(llvm::StringRef Kind) const
- public bool hasAttributes() const
- public inline bool hasDefinitiveInitializer() const
- public bool hasImplicitSection() const
- public inline bool hasInitializer() const
- public inline bool hasUniqueInitializer() const
- public bool isConstant() const
- public bool isExternallyInitialized() const
- public void removeFromParent()
- public void setAttributes(llvm::AttributeSet A)
- public void setConstant(bool Val)
- public void setExternallyInitialized(bool Val)
- public void setInitializer(llvm::Constant * InitVal)
- public ~GlobalVariable()
Inherited from GlobalObject:
- public addMetadata
- public addMetadata
- public addTypeMetadata
- public addVCallVisibilityMetadata
- public classof
- public clearMetadata
- protected copyAttributesFrom
- public copyMetadata
- public eraseMetadata
- public getAlignment
- public getAllMetadata
- public getComdat
- public getComdat
- public getGlobalObjectSubClassData
- public getMetadata
- public getMetadata
- public getMetadata
- public getMetadata
- public getSection
- public getVCallVisibility
- public hasComdat
- public hasMetadata
- public hasMetadata
- public hasMetadata
- public hasSection
- public setAlignment
- public setComdat
- public setGlobalObjectSubClassData
- public setMetadata
- public setMetadata
- public setSection
Inherited from GlobalValue:
- public canBeOmittedFromSymbolTable
- public canIncreaseAlignment
- public classof
- protected copyAttributesFrom
- public dropLLVMManglingEscape
- public eraseFromParent
- public getAbsoluteSymbolRange
- public getAddressSpace
- public getAlignment
- public getBaseObject
- public getBaseObject
- public getComdat
- public getComdat
- public getDLLStorageClass
- public getGUID
- public getGUID
- public getGlobalIdentifier
- public getGlobalIdentifier
- protected getGlobalValueSubClassData
- public getLinkOnceLinkage
- public getLinkage
- public getMinUnnamedAddr
- public getParent
- public getParent
- public getPartition
- public getSection
- public getThreadLocalMode
- public getType
- public getUnnamedAddr
- public getValueType
- public getVisibility
- public getWeakLinkage
- public hasAppendingLinkage
- public hasAtLeastLocalUnnamedAddr
- public hasAvailableExternallyLinkage
- public hasComdat
- public hasCommonLinkage
- public hasDLLExportStorageClass
- public hasDLLImportStorageClass
- public hasDefaultVisibility
- public hasExactDefinition
- public hasExternalLinkage
- public hasExternalWeakLinkage
- public hasGlobalUnnamedAddr
- public hasHiddenVisibility
- public hasInternalLinkage
- public hasLinkOnceLinkage
- public hasLinkOnceODRLinkage
- public hasLocalLinkage
- public hasPartition
- public hasPrivateLinkage
- public hasProtectedVisibility
- public hasSection
- public hasValidDeclarationLinkage
- public hasWeakAnyLinkage
- public hasWeakLinkage
- public hasWeakODRLinkage
- public isAbsoluteSymbolRef
- public isAppendingLinkage
- public isAvailableExternallyLinkage
- public isCommonLinkage
- public isDSOLocal
- public isDeclaration
- public isDeclarationForLinker
- public isDefinitionExact
- public isDiscardableIfUnused
- public isDiscardableIfUnused
- public isExternalLinkage
- public isExternalWeakLinkage
- public isInternalLinkage
- public isInterposable
- public isInterposableLinkage
- public isLinkOnceLinkage
- public isLinkOnceODRLinkage
- public isLocalLinkage
- public isMaterializable
- public isPrivateLinkage
- public isStrongDefinitionForLinker
- public isThreadLocal
- public isValidDeclarationLinkage
- public isWeakAnyLinkage
- public isWeakForLinker
- public isWeakForLinker
- public isWeakLinkage
- public isWeakODRLinkage
- public materialize
- public removeFromParent
- public setDLLStorageClass
- public setDSOLocal
- protected setGlobalValueSubClassData
- public setLinkage
- protected setParent
- public setPartition
- public setThreadLocal
- public setThreadLocalMode
- public setUnnamedAddr
- public setVisibility
Inherited from Constant:
- public canTrap
- public classof
- public containsConstantExpression
- public containsUndefElement
- public destroyConstant
- public getAggregateElement
- public getAggregateElement
- public getAllOnesValue
- public getIntegerValue
- public getNullValue
- public getSplatValue
- public getUniqueInteger
- public handleOperandChange
- public hasExactInverseFP
- public isAllOnesValue
- public isConstantUsed
- public isDLLImportDependent
- public isElementWiseEqual
- public isFiniteNonZeroFP
- public isMinSignedValue
- public isNaN
- public isNegativeZeroValue
- public isNormalFP
- public isNotMinSignedValue
- public isNotOneValue
- public isNullValue
- public isOneValue
- public isThreadDependent
- public isZeroValue
- public needsRelocation
- public removeDeadConstantUsers
- public replaceUndefsWith
- public stripPointerCasts
- public stripPointerCasts
Inherited from User:
- protected Op
- protected Op
- protected OpFrom
- protected allocHungoffUses
- public classof
- public dropAllReferences
- public getDescriptor
- public getDescriptor
- public getNumOperands
- public getOperand
- public getOperandList
- public getOperandList
- public getOperandUse
- public getOperandUse
- protected growHungoffUses
- public op_begin
- public op_begin
- public op_end
- public op_end
- public operand_values
- public operand_values
- public operands
- public operands
- public replaceUsesOfWith
- public setGlobalVariableNumOperands
- public setNumHungOffUseOperands
- public setOperand
- public value_op_begin
- public value_op_begin
- public value_op_end
- public value_op_end
Inherited from Value:
- public DoPHITranslation
- public DoPHITranslation
- public addUse
- public assertModuleIsMaterialized
- public assertModuleIsMaterializedImpl
- public clearSubclassOptionalData
- public deleteValue
- public dump
- public getContext
- public getName
- public getNumUses
- public getPointerAlignment
- public getPointerDereferenceableBytes
- public getRawSubclassOptionalData
- protected getSubclassDataFromValue
- public getType
- public getValueID
- public getValueName
- public hasNUses
- public hasNUsesOrMore
- public hasName
- public hasOneUse
- public hasSameSubclassOptionalData
- public hasValueHandle
- public isSwiftError
- public isUsedByMetadata
- public isUsedInBasicBlock
- public materialized_use_begin
- public materialized_use_begin
- public materialized_use_empty
- public materialized_user_begin
- public materialized_user_begin
- public materialized_users
- public materialized_users
- public materialized_uses
- public materialized_uses
- public mutateType
- public print
- public print
- public printAsOperand
- public printAsOperand
- public replaceAllUsesWith
- public replaceNonMetadataUsesWith
- public replaceUsesOutsideBlock
- public replaceUsesWithIf
- public reverseUseList
- public setName
- public setValueName
- protected setValueSubclassData
- public sortUseList
- public stripAndAccumulateConstantOffsets
- public stripAndAccumulateConstantOffsets
- public stripAndAccumulateInBoundsConstantOffsets
- public stripAndAccumulateInBoundsConstantOffsets
- public stripInBoundsConstantOffsets
- public stripInBoundsConstantOffsets
- public stripInBoundsOffsets
- public stripInBoundsOffsets
- public stripPointerCasts
- public stripPointerCasts
- public stripPointerCastsAndAliases
- public stripPointerCastsAndAliases
- public stripPointerCastsAndInvariantGroups
- public stripPointerCastsAndInvariantGroups
- public stripPointerCastsSameRepresentation
- public stripPointerCastsSameRepresentation
- public takeName
- public use_begin
- public use_begin
- public use_empty
- public use_end
- public use_end
- public user_back
- public user_back
- public user_begin
- public user_begin
- public user_empty
- public user_end
- public user_end
- public users
- public users
- public uses
- public uses
Methods
¶GlobalVariable(
llvm::Module& M,
llvm::Type* Ty,
bool isConstant,
llvm::GlobalValue::LinkageTypes Linkage,
llvm::Constant* Initializer,
const llvm::Twine& Name = "",
llvm::GlobalVariable* InsertBefore = nullptr,
llvm::GlobalValue::ThreadLocalMode =
NotThreadLocal,
unsigned int AddressSpace = 0,
bool isExternallyInitialized = false)
GlobalVariable(
llvm::Module& M,
llvm::Type* Ty,
bool isConstant,
llvm::GlobalValue::LinkageTypes Linkage,
llvm::Constant* Initializer,
const llvm::Twine& Name = "",
llvm::GlobalVariable* InsertBefore = nullptr,
llvm::GlobalValue::ThreadLocalMode =
NotThreadLocal,
unsigned int AddressSpace = 0,
bool isExternallyInitialized = false)
Description
GlobalVariable ctor - This creates a global and inserts it before the specified other global.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:60
Parameters
- llvm::Module& M
- llvm::Type* Ty
- bool isConstant
- llvm::GlobalValue::LinkageTypes Linkage
- llvm::Constant* Initializer
- const llvm::Twine& Name = ""
- llvm::GlobalVariable* InsertBefore = nullptr
- llvm::GlobalValue::ThreadLocalMode = NotThreadLocal
- unsigned int AddressSpace = 0
- bool isExternallyInitialized = false
¶GlobalVariable(const llvm::GlobalVariable&)
GlobalVariable(const llvm::GlobalVariable&)
Declared at: llvm/include/llvm/IR/GlobalVariable.h:65
Parameters
- const llvm::GlobalVariable&
¶GlobalVariable(
llvm::Type* Ty,
bool isConstant,
llvm::GlobalValue::LinkageTypes Linkage,
llvm::Constant* Initializer = nullptr,
const llvm::Twine& Name = "",
llvm::GlobalValue::ThreadLocalMode =
NotThreadLocal,
unsigned int AddressSpace = 0,
bool isExternallyInitialized = false)
GlobalVariable(
llvm::Type* Ty,
bool isConstant,
llvm::GlobalValue::LinkageTypes Linkage,
llvm::Constant* Initializer = nullptr,
const llvm::Twine& Name = "",
llvm::GlobalValue::ThreadLocalMode =
NotThreadLocal,
unsigned int AddressSpace = 0,
bool isExternallyInitialized = false)
Description
GlobalVariable ctor - If a parent module is specified, the global is automatically inserted into the end of the specified modules global list.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:54
Parameters
- llvm::Type* Ty
- bool isConstant
- llvm::GlobalValue::LinkageTypes Linkage
- llvm::Constant* Initializer = nullptr
- const llvm::Twine& Name = ""
- llvm::GlobalValue::ThreadLocalMode = NotThreadLocal
- unsigned int AddressSpace = 0
- bool isExternallyInitialized = false
¶void addAttribute(
llvm::StringRef Kind,
llvm::StringRef Val = llvm::StringRef())
void addAttribute(
llvm::StringRef Kind,
llvm::StringRef Val = llvm::StringRef())
Description
Add attribute to this global.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:193
Parameters
- llvm::StringRef Kind
- llvm::StringRef Val = llvm::StringRef()
¶void addAttribute(Attribute::AttrKind Kind)
void addAttribute(Attribute::AttrKind Kind)
Description
Add attribute to this global.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:188
Parameters
- Attribute::AttrKind Kind
¶void addDebugInfo(
llvm::DIGlobalVariableExpression* GV)
void addDebugInfo(
llvm::DIGlobalVariableExpression* GV)
Description
Attach a DIGlobalVariableExpression.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:182
Parameters
¶static bool classof(const llvm::Value* V)
static bool classof(const llvm::Value* V)
Declared at: llvm/include/llvm/IR/GlobalVariable.h:251
Parameters
- const llvm::Value* V
¶void copyAttributesFrom(
const llvm::GlobalVariable* Src)
void copyAttributesFrom(
const llvm::GlobalVariable* Src)
Description
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) from the GlobalVariable Src to this one.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:165
Parameters
- const llvm::GlobalVariable* Src
¶void dropAllReferences()
void dropAllReferences()
Description
Drop all references in preparation to destroy the GlobalVariable. This drops not only the reference to the initializer but also to any metadata.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:179
¶void eraseFromParent()
void eraseFromParent()
Description
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:175
¶llvm::Attribute getAttribute(
llvm::StringRef Kind) const
llvm::Attribute getAttribute(
llvm::StringRef Kind) const
Description
Return the attribute object.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:218
Parameters
- llvm::StringRef Kind
¶llvm::Attribute getAttribute(
Attribute::AttrKind Kind) const
llvm::Attribute getAttribute(
Attribute::AttrKind Kind) const
Description
Return the attribute object.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:213
Parameters
- Attribute::AttrKind Kind
¶llvm::AttributeSet getAttributes() const
llvm::AttributeSet getAttributes() const
Description
Return the attribute set for this global
Declared at: llvm/include/llvm/IR/GlobalVariable.h:223
¶llvm::AttributeList getAttributesAsList(
unsigned int index) const
llvm::AttributeList getAttributesAsList(
unsigned int index) const
Description
Return attribute set as list with index. FIXME: This may not be required once ValueEnumerators in bitcode-writer can enumerate attribute-set.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:230
Parameters
- unsigned int index
¶void getDebugInfo(
SmallVectorImpl<
llvm::DIGlobalVariableExpression*>& GVs)
const
void getDebugInfo(
SmallVectorImpl<
llvm::DIGlobalVariableExpression*>& GVs)
const
Description
Fill the vector with all debug info attachements.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:185
Parameters
- SmallVectorImpl< llvm::DIGlobalVariableExpression*>& GVs
¶inline llvm::Constant* getInitializer()
inline llvm::Constant* getInitializer()
Declared at: llvm/include/llvm/IR/GlobalVariable.h:140
¶inline const llvm::Constant* getInitializer()
const
inline const llvm::Constant* getInitializer()
const
Description
getInitializer - Return the initializer for this global variable. It is illegal to call this method if the global is external, because we cannot tell what the value is initialized to!
Declared at: llvm/include/llvm/IR/GlobalVariable.h:136
¶bool hasAttribute(Attribute::AttrKind Kind) const
bool hasAttribute(Attribute::AttrKind Kind) const
Description
Return true if the attribute exists.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:198
Parameters
- Attribute::AttrKind Kind
¶bool hasAttribute(llvm::StringRef Kind) const
bool hasAttribute(llvm::StringRef Kind) const
Description
Return true if the attribute exists.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:203
Parameters
- llvm::StringRef Kind
¶bool hasAttributes() const
bool hasAttributes() const
Description
Return true if any attributes exist.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:208
¶inline bool hasDefinitiveInitializer() const
inline bool hasDefinitiveInitializer() const
Description
hasDefinitiveInitializer - Whether the global variable has an initializer, and any other instances of the global (this can happen due to weak linkage) are guaranteed to have the same initializer. Note that if you want to transform a global, you must use hasUniqueInitializer() instead, because of the *_odr linkage type. Example: @a = global SomeType* null - Initializer is both definitive and unique. @b = global weak SomeType* null - Initializer is neither definitive nor unique. @c = global weak_odr SomeType* null - Initializer is definitive, but not unique.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:110
¶bool hasImplicitSection() const
bool hasImplicitSection() const
Description
Check if section name is present
Declared at: llvm/include/llvm/IR/GlobalVariable.h:243
¶inline bool hasInitializer() const
inline bool hasInitializer() const
Description
Definitions have initializers, declarations don't.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:92
¶inline bool hasUniqueInitializer() const
inline bool hasUniqueInitializer() const
Description
hasUniqueInitializer - Whether the global variable has an initializer, and any changes made to the initializer will turn up in the final executable.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:122
¶bool isConstant() const
bool isConstant() const
Description
If the value is a global constant, its value is immutable throughout the runtime execution of the program. Assigning a value into the constant leads to undefined behavior.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:153
¶bool isExternallyInitialized() const
bool isExternallyInitialized() const
Declared at: llvm/include/llvm/IR/GlobalVariable.h:156
¶void removeFromParent()
void removeFromParent()
Description
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:170
¶void setAttributes(llvm::AttributeSet A)
void setAttributes(llvm::AttributeSet A)
Description
Set attribute list for this global
Declared at: llvm/include/llvm/IR/GlobalVariable.h:238
Parameters
¶void setConstant(bool Val)
void setConstant(bool Val)
Declared at: llvm/include/llvm/IR/GlobalVariable.h:154
Parameters
- bool Val
¶void setExternallyInitialized(bool Val)
void setExternallyInitialized(bool Val)
Declared at: llvm/include/llvm/IR/GlobalVariable.h:159
Parameters
- bool Val
¶void setInitializer(llvm::Constant* InitVal)
void setInitializer(llvm::Constant* InitVal)
Description
setInitializer - Sets the initializer for this global variable, removing any existing initializer if InitVal==NULL. If this GV has type T*, the initializer must have type T.
Declared at: llvm/include/llvm/IR/GlobalVariable.h:147
Parameters
- llvm::Constant* InitVal
¶~GlobalVariable()
~GlobalVariable()
Declared at: llvm/include/llvm/IR/GlobalVariable.h:68