LLVM API Documentation

llvm::GlobalValue Class Reference

#include <GlobalValue.h>

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

List of all members.

Public Types

enum  LinkageTypes {
  ExternalLinkage = 0, LinkOnceLinkage, WeakLinkage, AppendingLinkage,
  InternalLinkage, PrivateLinkage, DLLImportLinkage, DLLExportLinkage,
  ExternalWeakLinkage, GhostLinkage, CommonLinkage
}
 An enumeration for the kinds of linkage for global values. More...
enum  VisibilityTypes { DefaultVisibility = 0, HiddenVisibility, ProtectedVisibility }
 An enumeration for the kinds of visibility of global values. More...

Public Member Functions

 ~GlobalValue ()
unsigned getAlignment () const
void setAlignment (unsigned Align)
VisibilityTypes getVisibility () const
bool hasHiddenVisibility () const
bool hasProtectedVisibility () const
void setVisibility (VisibilityTypes V)
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 PointerType * getType () const
 getType - Global values are always pointers.
bool hasExternalLinkage () const
bool hasLinkOnceLinkage () const
bool hasWeakLinkage () const
bool hasCommonLinkage () const
bool hasAppendingLinkage () const
bool hasInternalLinkage () const
bool hasPrivateLinkage () const
bool hasLocalLinkage () const
bool hasDLLImportLinkage () const
bool hasDLLExportLinkage () const
bool hasExternalWeakLinkage () const
bool hasGhostLinkage () const
void setLinkage (LinkageTypes LT)
LinkageTypes getLinkage () const
bool mayBeOverridden () const
virtual void copyAttributesFrom (const GlobalValue *Src)
bool hasNotBeenReadFromBitcode () const
virtual bool isNullValue () const
virtual void destroyConstant ()
 Override from Constant class.
virtual bool isDeclaration () const =0
virtual void removeFromParent ()=0
virtual void eraseFromParent ()=0
Module * getParent ()
const Module * getParent () 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

Module * Parent
LinkageTypes Linkage: 5
unsigned Visibility: 2
unsigned Alignment: 16
std::string Section


Detailed Description

Definition at line 28 of file GlobalValue.h.


Member Enumeration Documentation

An enumeration for the kinds of linkage for global values.

Enumerator:
ExternalLinkage  Externally visible function.
LinkOnceLinkage  Keep one copy of function when linking (inline).
WeakLinkage  Keep one copy of named function when linking (weak).
AppendingLinkage  Special purpose, only applies to global arrays.
InternalLinkage  Rename collisions when linking (static functions).
PrivateLinkage  Like Internal, but omit from symbol table.
DLLImportLinkage  Function to be imported from DLL.
DLLExportLinkage  Function to be accessible from DLL.
ExternalWeakLinkage  ExternalWeak linkage description.
GhostLinkage  Stand-in functions for streaming fns from BC files.
CommonLinkage  Tentative definitions.

Definition at line 32 of file GlobalValue.h.

An enumeration for the kinds of visibility of global values.

Enumerator:
DefaultVisibility  The GV is visible.
HiddenVisibility  The GV is hidden.
ProtectedVisibility  The GV is protected.

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

References llvm::Value::setName().

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

Definition at line 69 of file GlobalValue.h.

References removeDeadConstantUsers().


Member Function Documentation

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

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

VisibilityTypes llvm::GlobalValue::getVisibility (  )  const [inline]

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

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

void llvm::GlobalValue::setVisibility ( VisibilityTypes  V  )  [inline]

Definition at line 84 of file GlobalValue.h.

References Visibility.

Referenced by copyAttributesFrom(), fold(), LinkFunctionProtos(), and LinkGlobals().

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

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

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

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.

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

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

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

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

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

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

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

Definition at line 107 of file GlobalValue.h.

References InternalLinkage, and Linkage.

Referenced by CalculateAliasLinkage(), and llvm::X86ATTAsmPrinter::emitFunctionHeader().

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

Definition at line 108 of file GlobalValue.h.

References Linkage, and PrivateLinkage.

Referenced by CalculateAliasLinkage(), and llvm::Mangler::getValueName().

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

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

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

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

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

Definition at line 115 of file GlobalValue.h.

References GhostLinkage, and Linkage.

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

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

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

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

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

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

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

Definition at line 85 of file Globals.cpp.

References getAlignment(), getSection(), getVisibility(), setAlignment(), setSection(), and setVisibility().

Referenced by llvm::GlobalVariable::copyAttributesFrom(), llvm::Function::copyAttributesFrom(), and CopyGVAttributes().

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

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

References GhostLinkage, and Linkage.

Referenced by llvm::BitcodeReader::dematerializeFunction(), llvm::JIT::getPointerToFunction(), GVIsIndirectSymbol(), llvm::X86Subtarget::GVRequiresExtraLoad(), llvm::PPCSubtarget::hasLazyResolverStub(), llvm::BitcodeReader::materializeFunction(), and llvm::BitcodeReader::materializeModule().

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 142 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 78 of file Globals.cpp.

virtual bool llvm::GlobalValue::isDeclaration (  )  const [pure virtual]

virtual void llvm::GlobalValue::removeFromParent (  )  [pure virtual]

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

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

virtual void llvm::GlobalValue::eraseFromParent (  )  [pure virtual]

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

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

Referenced by RemoveDeadConstant().

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

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

Definition at line 162 of file GlobalValue.h.

References Parent.

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.

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.

Definition at line 49 of file Globals.cpp.

References E, removeDeadUsersOfConstant(), llvm::Value::use_begin(), and llvm::Value::use_end().

Referenced by AddressIsTaken(), and ~GlobalValue().

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

Reimplemented from llvm::Constant.

Definition at line 171 of file GlobalValue.h.

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


Member Data Documentation

Definition at line 61 of file GlobalValue.h.

Referenced by getParent().

Definition at line 66 of file GlobalValue.h.

Referenced by getAlignment(), and setAlignment().

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

Definition at line 67 of file GlobalValue.h.


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