LLVM API Documentation

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

 ExternalLinkage
 LinkOnceLinkage
 Externally visible function.
 WeakLinkage
 Keep one copy of named function when linking (inline).
 AppendingLinkage
 Keep one copy of named function when linking (weak).
 InternalLinkage
 Special purpose, only applies to global arrays.
 GhostLinkage
 Stand-in functions for streaming fns from BC files.
enum  LinkageTypes {
  ExternalLinkage, LinkOnceLinkage, WeakLinkage, AppendingLinkage,
  InternalLinkage, GhostLinkage
}

Public Member Functions

 ~GlobalValue ()
unsigned getAlignment () const
void setAlignment (unsigned Align)
bool hasSection () const
const std::string & getSection () const
void setSection (const std::string &S)
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 *)
static bool classof (const Value *V)

Protected Member Functions

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

Protected Attributes

ModuleParent
LinkageTypes Linkage
unsigned Alignment
std::string Section

Detailed Description

Definition at line 27 of file GlobalValue.h.


Member Enumeration Documentation

enum llvm::GlobalValue::LinkageTypes

Enumerator:
ExternalLinkage 
LinkOnceLinkage  Externally visible function.
WeakLinkage  Keep one copy of named function when linking (inline).
AppendingLinkage  Keep one copy of named function when linking (weak).
InternalLinkage  Special purpose, only applies to global arrays.
GhostLinkage  Stand-in functions for streaming fns from BC files.

Definition at line 30 of file GlobalValue.h.


Constructor & Destructor Documentation

llvm::GlobalValue::GlobalValue ( const Type Ty,
ValueTy  vty,
Use Ops,
unsigned  NumOps,
LinkageTypes  linkage,
const std::string &  name = "" 
) [inline, protected]

Definition at line 39 of file GlobalValue.h.

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

Definition at line 49 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 118 of file GlobalValue.h.

References llvm::Value::FunctionVal, llvm::Value::GlobalVariableVal, and V.

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

Reimplemented from llvm::Constant.

Definition at line 117 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().

Referenced by RemoveDeadConstant().

unsigned llvm::GlobalValue::getAlignment (  )  const [inline]

Definition at line 53 of file GlobalValue.h.

References Alignment.

Referenced by llvm::AsmPrinter::EmitAlignment(), GetKnownAlignment(), and llvm::AsmPrinter::getPreferredAlignmentLog().

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

Definition at line 81 of file GlobalValue.h.

References Linkage.

Referenced by getEncodedLinkage(), InstallGlobalCtors(), LinkAppendingVars(), LinkGlobals(), and llvm::DIVerifier::Verify().

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

Definition at line 104 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 103 of file GlobalValue.h.

References Parent.

Referenced by createSlotMachine(), llvm::GlobalVariable::eraseFromParent(), llvm::Function::eraseFromParent(), ForceRenaming(), getFnForValue(), llvm::Trace::getModule(), getModuleFromVal(), llvm::InlineFunction(), InsertInstrumentationCall(), InsertPrintInst(), llvm::InsertProfilingInitCall(), InstallGlobalCtors(), OptimizeGlobalAddressOfMalloc(), llvm::Function::print(), llvm::GlobalVariable::print(), PrintOps(), llvm::GlobalVariable::removeFromParent(), llvm::Function::removeFromParent(), llvm::Function::renameLocalSymbols(), ReplaceCallWith(), ResolveFunctions(), llvm::Value::setName(), ShrinkGlobalToBoolean(), and SRAGlobal().

const std::string& llvm::GlobalValue::getSection (  )  const [inline]

Definition at line 60 of file GlobalValue.h.

References Section.

Referenced by llvm::AsmPrinter::EmitSpecialLLVMGlobal(), getGlobalVariableClass(), and llvm::AsmPrinter::SwitchSection().

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

getType - Global values are always pointers.

Reimplemented from llvm::Value.

Definition at line 71 of file GlobalValue.h.

References llvm::Value::getType().

Referenced by llvm::SparcV9RegInfo::colorMethodArgs(), llvm::ConvertExpressionToType(), llvm::ExecutionEngine::EmitGlobalVariable(), ForceRenaming(), llvm::Function::getFunctionType(), GetKnownAlignment(), llvm::JIT::getOrEmitGlobalVariable(), llvm::AsmPrinter::getPreferredAlignmentLog(), llvm::InsertProfilingInitCall(), InstallGlobalCtors(), LinkAppendingVars(), LinkGlobals(), OptimizeGlobalAddressOfMalloc(), OptimizeOnceStoredGlobal(), llvm::BytecodeReader::ParseFunction(), llvm::BytecodeReader::ParseModule(), ProcessGlobalsWithSameName(), ResolveFunctions(), llvm::SparcV9RegInfo::suggestRegs4MethodArgs(), and SCCPSolver::TrackValueOfGlobalVariable().

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

Definition at line 78 of file GlobalValue.h.

References AppendingLinkage, and Linkage.

Referenced by llvm::AsmPrinter::EmitSpecialLLVMGlobal(), getGlobalVariableClass(), LinkGlobalInits(), and LinkGlobals().

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

Definition at line 75 of file GlobalValue.h.

References ExternalLinkage, and Linkage.

Referenced by isSimpleEnoughPointerToCommit().

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

Definition at line 79 of file GlobalValue.h.

References InternalLinkage, and Linkage.

Referenced by ForceRenaming(), llvm::Module::getGlobalVariable(), InlineCallIfPossible(), isSimpleEnoughPointerToCommit(), LinkGlobals(), maybeAddInternalValueToVector(), RemoveDeadConstant(), llvm::ExecutionEngine::runStaticConstructorsDestructors(), and SRAGlobal().

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

Definition at line 76 of file GlobalValue.h.

References Linkage, and LinkOnceLinkage.

Referenced by DarwinGVRequiresExtraLoad(), getGlobalVariablesUsing(), LinkGlobalInits(), llvm::X86IntelAsmPrinter::printOp(), and llvm::X86ATTAsmPrinter::printOperand().

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 88 of file GlobalValue.h.

References GhostLinkage, and Linkage.

Referenced by DarwinGVRequiresExtraLoad().

bool llvm::GlobalValue::hasSection (  )  const [inline]

Definition at line 59 of file GlobalValue.h.

References Section.

Referenced by llvm::AsmPrinter::SwitchSection().

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

Definition at line 77 of file GlobalValue.h.

References Linkage, and WeakLinkage.

Referenced by DarwinGVRequiresExtraLoad(), LinkGlobalInits(), llvm::X86IntelAsmPrinter::printOp(), and llvm::X86ATTAsmPrinter::printOperand().

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 DarwinGVRequiresExtraLoad(), llvm::DSGraph::DSGraph(), llvm::JIT::getOrEmitGlobalVariable(), isSimpleEnoughPointerToCommit(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86ATTAsmPrinter::printOperand(), ProcessGlobalsWithSameName(), and llvm::ExecutionEngine::runStaticConstructorsDestructors().

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 92 of file GlobalValue.h.

Referenced by OptimizeOnceStoredGlobal(), and ProcessGlobalsWithSameName().

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 AddressIsTaken(), and ~GlobalValue().

void llvm::GlobalValue::setAlignment ( unsigned  Align  )  [inline]

Definition at line 54 of file GlobalValue.h.

References Alignment.

Referenced by llvm::BytecodeReader::ParseModuleGlobalInfo().

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

Definition at line 80 of file GlobalValue.h.

References Linkage.

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

void llvm::GlobalValue::setSection ( const std::string &  S  )  [inline]

Definition at line 61 of file GlobalValue.h.

References Section.

Referenced by DISerializeVisitor::Apply(), llvm::DISerializer::getString(), and llvm::DISerializer::Serialize().

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

unsigned llvm::GlobalValue::Alignment [protected]

Definition at line 46 of file GlobalValue.h.

Referenced by getAlignment(), and setAlignment().

LinkageTypes llvm::GlobalValue::Linkage [protected]

Definition at line 45 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().

std::string llvm::GlobalValue::Section [protected]

Definition at line 47 of file GlobalValue.h.

Referenced by getSection(), hasSection(), and setSection().


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