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

Inherited from GlobalObject:

Inherited from GlobalValue:

Inherited from Constant:

Inherited from User:

Inherited from Value:

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)

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&)

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)

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())

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)

Description

Add attribute to this global.

Declared at: llvm/include/llvm/IR/GlobalVariable.h:188

Parameters

Attribute::AttrKind Kind

void addDebugInfo(
    llvm::DIGlobalVariableExpression* GV)

Description

Attach a DIGlobalVariableExpression.

Declared at: llvm/include/llvm/IR/GlobalVariable.h:182

Parameters

llvm::DIGlobalVariableExpression* GV

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)

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()

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()

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

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

Description

Return the attribute object.

Declared at: llvm/include/llvm/IR/GlobalVariable.h:213

Parameters

Attribute::AttrKind Kind

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

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

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()

Declared at: llvm/include/llvm/IR/GlobalVariable.h:140

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

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

Description

Return true if the attribute exists.

Declared at: llvm/include/llvm/IR/GlobalVariable.h:203

Parameters

llvm::StringRef Kind

bool hasAttributes() const

Description

Return true if any attributes exist.

Declared at: llvm/include/llvm/IR/GlobalVariable.h:208

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

Description

Check if section name is present

Declared at: llvm/include/llvm/IR/GlobalVariable.h:243

inline bool hasInitializer() const

Description

Definitions have initializers, declarations don't.

Declared at: llvm/include/llvm/IR/GlobalVariable.h:92

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

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

Declared at: llvm/include/llvm/IR/GlobalVariable.h:156

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)

Description

Set attribute list for this global

Declared at: llvm/include/llvm/IR/GlobalVariable.h:238

Parameters

llvm::AttributeSet A

void setConstant(bool Val)

Declared at: llvm/include/llvm/IR/GlobalVariable.h:154

Parameters

bool Val

void setExternallyInitialized(bool Val)

Declared at: llvm/include/llvm/IR/GlobalVariable.h:159

Parameters

bool Val

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()

Declared at: llvm/include/llvm/IR/GlobalVariable.h:68