LLVM API Documentation
#include <GlobalVariable.h>
Definition at line 35 of file GlobalVariable.h.
| GlobalVariable::GlobalVariable | ( | LLVMContext & | Context, | |
| const Type * | Ty, | |||
| bool | isConstant, | |||
| LinkageTypes | Linkage, | |||
| Constant * | Initializer = 0, |
|||
| const Twine & | Name = "", |
|||
| 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 97 of file Globals.cpp.
References llvm::LeakDetector::addGarbageObject(), and llvm::Value::getType().
| GlobalVariable::GlobalVariable | ( | Module & | M, | |
| const Type * | Ty, | |||
| bool | isConstant, | |||
| LinkageTypes | Linkage, | |||
| Constant * | Initializer, | |||
| const Twine & | Name, | |||
| GlobalVariable * | InsertBefore = 0, |
|||
| bool | ThreadLocal = false, |
|||
| unsigned | AddressSpace = 0 | |||
| ) |
GlobalVariable ctor - This creates a global and inserts it before the specified other global.
Definition at line 115 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] |
Reimplemented from llvm::User.
Definition at line 48 of file GlobalVariable.h.
References operator new().
| 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 75 of file GlobalVariable.h.
References llvm::User::getNumOperands().
Referenced by llvm::JIT::getOrEmitGlobalVariable(), hasInitializer(), isSimpleEnoughPointerToCommit(), LinkGlobals(), llvm::X86IntelAsmPrinter::PrintGlobalVariable(), llvm::ExecutionEngine::runStaticConstructorsDestructors(), and llvm::PIC16TargetObjectFile::SelectSectionForGlobal().
| 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 81 of file GlobalVariable.h.
References isDeclaration().
Referenced by llvm::MachineModuleInfo::AnalyzeModule(), CommitValueTo(), llvm::AsmPrinter::EmitComments(), llvm::AsmPrinter::EmitSpecialLLVMGlobal(), llvm::DbgStopPointInst::getDirectory(), llvm::DbgStopPointInst::getFileName(), llvm::ProgramInfo::getFunction(), getInitializer(), llvm::TargetData::getPreferredAlignment(), llvm::ProgramInfo::getSourceFile(), GetStringLengthH(), llvm::DIDescriptor::getUInt64Field(), hasDefinitiveInitializer(), isSimpleEnoughPointerToCommit(), LinkGlobalInits(), LinkGlobals(), llvm::X86ATTAsmPrinter::PrintGlobalVariable(), llvm::DebugInfoFinder::processModule(), llvm::PIC16TargetObjectFile::SelectSectionForGlobal(), setInitializer(), llvm::SourceFileInfo::SourceFileInfo(), and llvm::SourceFunctionInfo::SourceFunctionInfo().
| bool llvm::GlobalVariable::hasDefinitiveInitializer | ( | ) | const [inline] |
hasDefinitiveInitializer - Whether the global variable has an initializer, and this is the initializer that will be used in the final executable.
Definition at line 85 of file GlobalVariable.h.
References hasInitializer(), and llvm::GlobalValue::mayBeOverridden().
Referenced by ComputeLoadResult(), and llvm::GetConstantStringInfo().
| 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 96 of file GlobalVariable.h.
References hasInitializer().
Referenced by llvm::MachineModuleInfo::AnalyzeModule(), CommitValueTo(), ComputeLoadResult(), llvm::AsmPrinter::EmitComments(), llvm::ExecutionEngine::EmitGlobalVariable(), llvm::AsmPrinter::EmitSpecialLLVMGlobal(), FindStaticTors(), findUsedValues(), GetAddressedElementFromGlobal(), llvm::GetConstantStringInfo(), llvm::DIDescriptor::getDescriptorField(), llvm::DbgStopPointInst::getDirectory(), llvm::DbgStopPointInst::getFileName(), llvm::ProgramInfo::getFunction(), llvm::DIDescriptor::getGlobalVariableField(), llvm::TargetLoweringObjectFile::getKindForGlobal(), llvm::DIArray::getNumElements(), llvm::ProgramInfo::getSourceFile(), llvm::DIDescriptor::getStringField(), GetStringLengthH(), llvm::DIDescriptor::getUInt64Field(), InstallGlobalCtors(), isSimpleEnoughPointerToCommit(), isSuitableForBSS(), LinkAppendingVars(), LinkGlobalInits(), OptimizeOnceStoredGlobal(), ParseGlobalCtors(), llvm::X86IntelAsmPrinter::PrintGlobalVariable(), llvm::X86ATTAsmPrinter::PrintGlobalVariable(), llvm::MSILWriter::printVariableDefinition(), llvm::ExecutionEngine::runStaticConstructorsDestructors(), llvm::PIC16TargetObjectFile::SelectSectionForGlobal(), llvm::SourceFileInfo::SourceFileInfo(), llvm::SourceFunctionInfo::SourceFunctionInfo(), and SRAGlobal().
| Constant* llvm::GlobalVariable::getInitializer | ( | ) | [inline] |
| void llvm::GlobalVariable::setInitializer | ( | Constant * | CPV | ) | [inline] |
Definition at line 104 of file GlobalVariable.h.
References hasInitializer(), and llvm::User::NumOperands.
Referenced by llvm::CloneModule(), CommitValueTo(), InstallGlobalCtors(), and LinkAppendingVars().
| 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 121 of file GlobalVariable.h.
Referenced by llvm::GetConstantStringInfo(), llvm::TargetLoweringObjectFile::getKindForGlobal(), llvm::JIT::getMemoryForGV(), GetStringLengthH(), InstallGlobalCtors(), isSuitableForBSS(), LinkAppendingVars(), LinkGlobals(), llvm::DebugInfoFinder::processModule(), and SRAGlobal().
| void llvm::GlobalVariable::setConstant | ( | bool | Val | ) | [inline] |
Definition at line 122 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 125 of file GlobalVariable.h.
Referenced by copyAttributesFrom(), llvm::ExecutionEngine::EmitGlobalVariable(), llvm::SelectionDAG::getGlobalAddress(), llvm::TargetLoweringObjectFile::getKindForGlobal(), llvm::JIT::getMemoryForGV(), InstallGlobalCtors(), LinkAppendingVars(), OptimizeGlobalAddressOfMalloc(), PerformHeapAllocSRoA(), llvm::X86ATTAsmPrinter::PrintGlobalVariable(), and SRAGlobal().
| void llvm::GlobalVariable::setThreadLocal | ( | bool | Val | ) | [inline] |
Definition at line 126 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 177 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 147 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 151 of file Globals.cpp.
References llvm::Module::getGlobalList(), and llvm::GlobalValue::getParent().
Referenced by InstallGlobalCtors(), OptimizeAwayTrappingUsesOfLoads(), OptimizeGlobalAddressOfMalloc(), PerformHeapAllocSRoA(), and llvm::DIDerivedType::replaceAllUsesWith().
Override Constant's implementation of this method so we can replace constant initializers.
Reimplemented from llvm::Constant.
Definition at line 155 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 147 of file GlobalVariable.h.
Reimplemented from llvm::GlobalValue.
Definition at line 148 of file GlobalVariable.h.
References llvm::Value::getValueID(), and llvm::Value::GlobalVariableVal.
friend class SymbolTableListTraits< GlobalVariable, Module > [friend] |
Definition at line 36 of file GlobalVariable.h.