LLVM API Documentation
#include <GlobalVariable.h>


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 |
| Constant * | getInitializer () const |
| Constant * | getInitializer () |
| 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 > |
Definition at line 34 of file GlobalVariable.h.
| 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] |
| void* llvm::GlobalVariable::operator new | ( | size_t | s | ) | [inline] |
| 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] |
hasInitializer - Unless a global variable isExternal(), it has an initializer. The initializer for the global variable/constant is held by Initializer if an initializer is specified.
Definition at line 79 of file GlobalVariable.h.
References isDeclaration().
Referenced by llvm::MachineModuleInfo::AnalyzeModule(), CommitValueTo(), ComputeLoadResult(), llvm::AsmPrinter::EmitSpecialLLVMGlobal(), llvm::GetConstantStringInfo(), llvm::DbgStopPointInst::getDirectory(), llvm::DbgStopPointInst::getFileName(), llvm::ProgramInfo::getFunction(), getInitializer(), llvm::TargetData::getPreferredAlignment(), llvm::ProgramInfo::getSourceFile(), GetStringLengthH(), getUIntOperand(), isSimpleEnoughPointerToCommit(), isSuitableForBSS(), LinkGlobalInits(), LinkGlobals(), llvm::X86ATTAsmPrinter::printModuleLevelGV(), setInitializer(), llvm::SourceFileInfo::SourceFileInfo(), and llvm::SourceFunctionInfo::SourceFunctionInfo().
| 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] |
| void llvm::GlobalVariable::setInitializer | ( | Constant * | CPV | ) | [inline] |
Definition at line 93 of file GlobalVariable.h.
References hasInitializer(), and llvm::User::NumOperands.
Referenced by llvm::CloneModule(), CommitValueTo(), InstallGlobalCtors(), LinkAppendingVars(), and llvm::DISerializer::Serialize().
| 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] |
If the value is "Thread Local", its value isn't shared by the threads.
Definition at line 114 of file GlobalVariable.h.
Referenced by copyAttributesFrom(), llvm::ExecutionEngine::EmitGlobalVariable(), llvm::SelectionDAG::getGlobalAddress(), llvm::JIT::getMemoryForGV(), llvm::JIT::getOrEmitGlobalVariable(), InstallGlobalCtors(), LinkAppendingVars(), OptimizeGlobalAddressOfMalloc(), PerformHeapAllocSRoA(), llvm::X86ATTAsmPrinter::printModuleLevelGV(), llvm::X86ATTAsmPrinter::printOperand(), llvm::TargetAsmInfo::SectionKindForGlobal(), and SRAGlobal().
| 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().
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.
friend class SymbolTableListTraits< GlobalVariable, Module > [friend] |
Definition at line 35 of file GlobalVariable.h.
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.