LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::GlobalValue Class Reference

#include <GlobalValue.h>

Inheritance diagram for llvm::GlobalValue:

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

Collaboration graph
[legend]
List of all members.

Public Types

enum  LinkageTypes {
  ExternalLinkage, LinkOnceLinkage, WeakLinkage, AppendingLinkage,
  InternalLinkage, GhostLinkage
}

Public Member Functions

 ~GlobalValue ()
bool use_empty_except_constants ()
 Determine if the usage of this global value is empty except for transitively dead constants.
const PointerTypegetType () const
 getType - Global values are always pointers.
bool hasExternalLinkage () const
bool hasLinkOnceLinkage () const
bool hasWeakLinkage () const
bool hasAppendingLinkage () const
bool hasInternalLinkage () const
void setLinkage (LinkageTypes LT)
LinkageTypes getLinkage () const
bool hasNotBeenReadFromBytecode () const
virtual bool isNullValue () const
virtual void destroyConstant ()
 Override from Constant class.
virtual bool isExternal () const =0
ModulegetParent ()
const ModulegetParent () const
void removeDeadConstantUsers ()

Static Public Member Functions

static bool classof (const GlobalValue *T)
static bool classof (const Value *V)

Protected Member Functions

 GlobalValue (const Type *Ty, ValueTy vty, LinkageTypes linkage, const std::string &name="")

Protected Attributes

LinkageTypes Linkage
ModuleParent

Detailed Description

Definition at line 27 of file GlobalValue.h.


Member Enumeration Documentation

enum llvm::GlobalValue::LinkageTypes
 

Enumerator:
ExternalLinkage 
LinkOnceLinkage 
WeakLinkage 
AppendingLinkage 
InternalLinkage 
GhostLinkage 

Definition at line 30 of file GlobalValue.h.


Constructor & Destructor Documentation

llvm::GlobalValue::GlobalValue const Type Ty,
ValueTy  vty,
LinkageTypes  linkage,
const std::string &  name = ""
[inline, protected]
 

Definition at line 39 of file GlobalValue.h.

llvm::GlobalValue::~GlobalValue  )  [inline]
 

Definition at line 46 of file GlobalValue.h.

References removeDeadConstantUsers().


Member Function Documentation

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

Reimplemented from llvm::Constant.

Reimplemented in llvm::Function, and llvm::GlobalVariable.

Definition at line 105 of file GlobalValue.h.

References llvm::Value::FunctionVal, llvm::Value::getValueType(), and llvm::Value::GlobalVariableVal.

static bool llvm::GlobalValue::classof const GlobalValue T  )  [inline, static]
 

Reimplemented from llvm::Constant.

Definition at line 104 of file GlobalValue.h.

void GlobalValue::destroyConstant  )  [virtual]
 

Override from Constant class.

Override destroyConstant to make sure it doesn't get called on GlobalValue's because they shouldn't be treated like other constants.

Reimplemented from llvm::Constant.

Definition at line 66 of file Globals.cpp.

References abort().

LinkageTypes llvm::GlobalValue::getLinkage  )  const [inline]
 

Definition at line 68 of file GlobalValue.h.

References Linkage.

Referenced by llvm::CloneFunction(), getEncodedLinkage(), GetLinkageResult(), LinkAppendingVars(), LinkFunctionProtos(), and LinkGlobals().

const Module* llvm::GlobalValue::getParent  )  const [inline]
 

Definition at line 91 of file GlobalValue.h.

References Parent.

Module* llvm::GlobalValue::getParent  )  [inline]
 

getParent - Get the module that this global value is contained inside of...

Definition at line 90 of file GlobalValue.h.

References Parent.

Referenced by llvm::GlobalVariable::eraseFromParent(), llvm::Function::eraseFromParent(), ForceRenaming(), llvm::Trace::getModule(), getModuleFromVal(), llvm::insertBB(), InsertInstrumentationCall(), InsertPrintInst(), llvm::InsertProfilingInitCall(), OptimizeGlobalAddressOfMalloc(), llvm::Instruction::print(), llvm::Function::print(), llvm::GlobalVariable::print(), llvm::GlobalVariable::removeFromParent(), llvm::Function::removeFromParent(), llvm::Function::renameLocalSymbols(), ReplaceCallWith(), llvm::FunctionPass::run(), llvm::JIT::runFunction(), llvm::ProfilePaths::runOnFunction(), llvm::FindUnsafePointerTypes::runOnModule(), llvm::BasicBlockPass::runPass(), llvm::GlobalVariable::setName(), llvm::Function::setName(), llvm::SlotCalculator::SlotCalculator(), SRAGlobal(), and llvm::verifyFunction().

const PointerType* llvm::GlobalValue::getType  )  const [inline]
 

getType - Global values are always pointers.

Reimplemented from llvm::Value.

Definition at line 58 of file GlobalValue.h.

References llvm::Value::getType().

Referenced by llvm::Interpreter::callExternalFunction(), llvm::SparcV9RegInfo::colorMethodArgs(), llvm::ExecutionEngine::EmitGlobalVariable(), ForceRenaming(), llvm::Function::getFunctionType(), llvm::JIT::getOrEmitGlobalVariable(), llvm::InsertProfilingInitCall(), LinkAppendingVars(), LinkFunctionProtos(), LinkGlobalInits(), LinkGlobals(), OptimizeGlobalAddressOfMalloc(), llvm::BytecodeReader::ParseFunction(), llvm::BytecodeReader::ParseModule(), ProcessGlobalsWithSameName(), ResolveFunctions(), and llvm::SparcV9RegInfo::suggestRegs4MethodArgs().

bool llvm::GlobalValue::hasAppendingLinkage  )  const [inline]
 

Definition at line 65 of file GlobalValue.h.

References AppendingLinkage, and Linkage.

Referenced by GetLinkageResult(), LinkGlobalInits(), and LinkGlobals().

bool llvm::GlobalValue::hasExternalLinkage  )  const [inline]
 

Definition at line 62 of file GlobalValue.h.

References ExternalLinkage, and Linkage.

Referenced by GetLinkageResult(), LinkFunctionProtos(), LinkGlobalInits(), and LinkGlobals().

bool llvm::GlobalValue::hasInternalLinkage  )  const [inline]
 

Definition at line 66 of file GlobalValue.h.

References InternalLinkage, and Linkage.

Referenced by ForceRenaming(), llvm::Module::getGlobalVariable(), GetLinkageResult(), InlineCallIfPossible(), LinkFunctionProtos(), LinkGlobals(), maybeAddInternalValueToVector(), and SRAGlobal().

bool llvm::GlobalValue::hasLinkOnceLinkage  )  const [inline]
 

Definition at line 63 of file GlobalValue.h.

References Linkage, and LinkOnceLinkage.

Referenced by GetLinkageResult(), LinkFunctionProtos(), and LinkGlobalInits().

bool llvm::GlobalValue::hasNotBeenReadFromBytecode  )  const [inline]
 

hasNotBeenReadFromBytecode - If a module provider is being used to lazily stream in functions from disk, this method can be used to check to see if the function has been read in yet or not. Unless you are working on the JIT or something else that streams stuff in lazily, you don't need to worry about this.

Definition at line 75 of file GlobalValue.h.

References GhostLinkage, and Linkage.

Referenced by llvm::JIT::getPointerToFunction().

bool llvm::GlobalValue::hasWeakLinkage  )  const [inline]
 

Definition at line 64 of file GlobalValue.h.

References Linkage, and WeakLinkage.

Referenced by GetLinkageResult(), LinkFunctionProtos(), and LinkGlobalInits().

virtual bool llvm::GlobalValue::isExternal  )  const [pure virtual]
 

isExternal - Return true if the primary definition of this global value is outside of the current translation unit...

Implemented in llvm::Function, and llvm::GlobalVariable.

Referenced by GetLinkageResult(), and ProcessGlobalsWithSameName().

virtual bool llvm::GlobalValue::isNullValue  )  const [inline, virtual]
 

Override from Constant class. No GlobalValue's are null values so this always returns false.

Implements llvm::Constant.

Definition at line 79 of file GlobalValue.h.

void GlobalValue::removeDeadConstantUsers  ) 
 

removeDeadConstantUsers - If there are any dead constant users dangling off of this global value, remove them. This method is useful for clients that want to check to see if a global is unused, but don't want to deal with potentially dead constants hanging off of the globals.

This method tries to make the global dead. If it detects a user that would prevent it from becoming completely dead, it gives up early, potentially leaving some dead constant users around.

Definition at line 53 of file Globals.cpp.

References llvm::Value::use_back(), and llvm::Value::use_empty().

Referenced by ~GlobalValue().

void llvm::GlobalValue::setLinkage LinkageTypes  LT  )  [inline]
 

Definition at line 67 of file GlobalValue.h.

References Linkage.

Referenced by llvm::CloneModule(), llvm::Function::deleteBody(), LinkFunctionProtos(), LinkGlobals(), llvm::BytecodeReader::ParseFunctionBody(), llvm::BytecodeReader::ParseFunctionLazily(), and ParseGlobalVariable().

bool llvm::GlobalValue::use_empty_except_constants  ) 
 

Determine if the usage of this global value is empty except for transitively dead constants.

If the usage is empty (except transitively dead constants), then this global value can can be safely deleted since the destructor will delete the dead constants as well.


Member Data Documentation

LinkageTypes llvm::GlobalValue::Linkage [protected]
 

Definition at line 43 of file GlobalValue.h.

Referenced by getLinkage(), hasAppendingLinkage(), hasExternalLinkage(), hasInternalLinkage(), hasLinkOnceLinkage(), hasNotBeenReadFromBytecode(), hasWeakLinkage(), and setLinkage().

Module* llvm::GlobalValue::Parent [protected]
 

Definition at line 44 of file GlobalValue.h.

Referenced by getParent().


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