LLVM API Documentation

llvm::GlobalVariable Class Reference

#include <GlobalVariable.h>

Inheritance diagram for llvm::GlobalVariable:

Inheritance graph
[legend]
Collaboration diagram for llvm::GlobalVariable:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void * operator new (size_t s)
 GlobalVariable (const Type *Ty, bool isConstant, LinkageTypes Linkage, Constant *Initializer=0, const std::string &Name="", Module *Parent=0, bool ThreadLocal=false, unsigned AddressSpace=0)
 GlobalVariable (const Type *Ty, bool isConstant, LinkageTypes Linkage, Constant *Initializer, const std::string &Name, GlobalVariable *InsertBefore, bool ThreadLocal=false, unsigned AddressSpace=0)
 ~GlobalVariable ()
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Provide fast operand accessors.
virtual bool isDeclaration () const
bool hasInitializer () const
ConstantgetInitializer () const
ConstantgetInitializer ()
void setInitializer (Constant *CPV)
bool isConstant () const
void setConstant (bool Val)
bool isThreadLocal () const
 If the value is "Thread Local", its value isn't shared by the threads.
void setThreadLocal (bool Val)
void copyAttributesFrom (const GlobalValue *Src)
virtual void removeFromParent ()
virtual void eraseFromParent ()
virtual void replaceUsesOfWithOnConstant (Value *From, Value *To, Use *U)

Static Public Member Functions

static bool classof (const GlobalVariable *)
static bool classof (const Value *V)

Friends

class SymbolTableListTraits< GlobalVariable, Module >


Detailed Description

Definition at line 34 of file GlobalVariable.h.


Constructor & Destructor Documentation

GlobalVariable::GlobalVariable ( const Type Ty,
bool  isConstant,
LinkageTypes  Linkage,
Constant Initializer = 0,
const std::string &  Name = "",
Module Parent = 0,
bool  ThreadLocal = false,
unsigned  AddressSpace = 0 
)

GlobalVariable ctor - If a parent module is specified, the global is automatically inserted into the end of the specified modules global list.

Definition at line 96 of file Globals.cpp.

References llvm::LeakDetector::addGarbageObject(), llvm::Module::getGlobalList(), and llvm::Value::getType().

GlobalVariable::GlobalVariable ( const Type Ty,
bool  isConstant,
LinkageTypes  Linkage,
Constant Initializer,
const std::string &  Name,
GlobalVariable InsertBefore,
bool  ThreadLocal = false,
unsigned  AddressSpace = 0 
)

GlobalVariable ctor - This creates a global and inserts it before the specified other global.

Definition at line 116 of file Globals.cpp.

References llvm::LeakDetector::addGarbageObject(), llvm::Module::getGlobalList(), llvm::GlobalValue::getParent(), and llvm::Value::getType().

llvm::GlobalVariable::~GlobalVariable (  )  [inline]

Definition at line 63 of file GlobalVariable.h.

References llvm::User::NumOperands.


Member Function Documentation

void* llvm::GlobalVariable::operator new ( size_t  s  )  [inline]

Reimplemented from llvm::User.

Definition at line 47 of file GlobalVariable.h.

llvm::GlobalVariable::DECLARE_TRANSPARENT_OPERAND_ACCESSORS ( Value   ) 

Provide fast operand accessors.

virtual bool llvm::GlobalVariable::isDeclaration (  )  const [inline, virtual]

isDeclaration - Is this global variable lacking an initializer? If so, the global variable is defined in some other translation unit, and is thus only a declaration here.

Implements llvm::GlobalValue.

Definition at line 73 of file GlobalVariable.h.

References llvm::User::getNumOperands().

Referenced by llvm::JIT::getOrEmitGlobalVariable(), hasInitializer(), isSimpleEnoughPointerToCommit(), LinkGlobals(), and llvm::ExecutionEngine::runStaticConstructorsDestructors().

bool llvm::GlobalVariable::hasInitializer (  )  const [inline]

Constant* llvm::GlobalVariable::getInitializer (  )  const [inline]

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!

Definition at line 85 of file GlobalVariable.h.

References hasInitializer().

Referenced by llvm::MachineModuleInfo::AnalyzeModule(), CommitValueTo(), ComputeLoadResult(), llvm::ExecutionEngine::EmitGlobalVariable(), llvm::AsmPrinter::EmitSpecialLLVMGlobal(), FindStaticTors(), GetAddressedElementFromGlobal(), llvm::GetConstantStringInfo(), llvm::DIDescriptor::getDescriptorField(), llvm::DbgStopPointInst::getDirectory(), llvm::DbgStopPointInst::getFileName(), llvm::ProgramInfo::getFunction(), llvm::DIDescriptor::getGlobalVariableField(), llvm::DIArray::getNumElements(), llvm::ProgramInfo::getSourceFile(), llvm::DIDescriptor::getStringField(), GetStringLengthH(), llvm::DIDescriptor::getUInt64Field(), getUIntOperand(), InstallGlobalCtors(), isSimpleEnoughPointerToCommit(), isSuitableForBSS(), LinkAppendingVars(), LinkGlobalInits(), llvm::XCoreTargetAsmInfo::MergeableConstSection(), llvm::ELFTargetAsmInfo::MergeableConstSection(), llvm::DarwinTargetAsmInfo::MergeableConstSection(), OptimizeOnceStoredGlobal(), ParseGlobalCtors(), llvm::X86ATTAsmPrinter::printModuleLevelGV(), llvm::ExecutionEngine::runStaticConstructorsDestructors(), llvm::TargetAsmInfo::SectionKindForGlobal(), llvm::SourceFileInfo::SourceFileInfo(), llvm::SourceFunctionInfo::SourceFunctionInfo(), SRAGlobal(), and llvm::DIVerifier::Verify().

Constant* llvm::GlobalVariable::getInitializer (  )  [inline]

Definition at line 89 of file GlobalVariable.h.

References hasInitializer().

void llvm::GlobalVariable::setInitializer ( Constant CPV  )  [inline]

bool llvm::GlobalVariable::isConstant (  )  const [inline]

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.

Definition at line 110 of file GlobalVariable.h.

Referenced by llvm::GetConstantStringInfo(), GetStringLengthH(), InstallGlobalCtors(), isSuitableForBSS(), LinkAppendingVars(), LinkGlobals(), llvm::TargetAsmInfo::SectionKindForGlobal(), and SRAGlobal().

void llvm::GlobalVariable::setConstant ( bool  Val  )  [inline]

Definition at line 111 of file GlobalVariable.h.

Referenced by llvm::CloneModule(), and LinkGlobals().

bool llvm::GlobalVariable::isThreadLocal (  )  const [inline]

void llvm::GlobalVariable::setThreadLocal ( bool  Val  )  [inline]

Definition at line 115 of file GlobalVariable.h.

Referenced by llvm::CloneModule(), and copyAttributesFrom().

void GlobalVariable::copyAttributesFrom ( const GlobalValue Src  )  [virtual]

copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) from the GlobalVariable Src to this one.

copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) from the GlobalVariable Src to this one.

Reimplemented from llvm::GlobalValue.

Definition at line 174 of file Globals.cpp.

References llvm::GlobalValue::copyAttributesFrom(), isThreadLocal(), and setThreadLocal().

void GlobalVariable::removeFromParent (  )  [virtual]

removeFromParent - This method unlinks 'this' from the containing module, but does not delete it.

Implements llvm::GlobalValue.

Definition at line 144 of file Globals.cpp.

References llvm::Module::getGlobalList(), and llvm::GlobalValue::getParent().

void GlobalVariable::eraseFromParent (  )  [virtual]

eraseFromParent - This method unlinks 'this' from the containing module and deletes it.

Implements llvm::GlobalValue.

Definition at line 148 of file Globals.cpp.

References llvm::Module::getGlobalList(), and llvm::GlobalValue::getParent().

Referenced by InstallGlobalCtors(), OptimizeAwayTrappingUsesOfLoads(), OptimizeGlobalAddressOfMalloc(), and PerformHeapAllocSRoA().

void GlobalVariable::replaceUsesOfWithOnConstant ( Value From,
Value To,
Use U 
) [virtual]

Override Constant's implementation of this method so we can replace constant initializers.

Reimplemented from llvm::Constant.

Definition at line 152 of file Globals.cpp.

References llvm::User::getNumOperands(), llvm::Constant::getOperand(), and llvm::Constant::setOperand().

static bool llvm::GlobalVariable::classof ( const GlobalVariable  )  [inline, static]

Definition at line 136 of file GlobalVariable.h.

static bool llvm::GlobalVariable::classof ( const Value V  )  [inline, static]

Reimplemented from llvm::GlobalValue.

Definition at line 137 of file GlobalVariable.h.

References llvm::Value::getValueID(), and llvm::Value::GlobalVariableVal.


Friends And Related Function Documentation

friend class SymbolTableListTraits< GlobalVariable, Module > [friend]

Definition at line 35 of file GlobalVariable.h.


The documentation for this class was generated from the following files:



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.