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, AvailableExternallyLinkage, LinkOnceAnyLinkage, LinkOnceODRLinkage,
  WeakAnyLinkage, WeakODRLinkage, AppendingLinkage, InternalLinkage,
  PrivateLinkage, LinkerPrivateLinkage, 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 hasDefaultVisibility () const
bool hasHiddenVisibility () const
bool hasProtectedVisibility () const
void setVisibility (VisibilityTypes V)
bool hasSection () const
const std::string & getSection () const
void setSection (const StringRef &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 hasAvailableExternallyLinkage () const
bool hasLinkOnceLinkage () const
bool hasWeakLinkage () const
bool hasAppendingLinkage () const
bool hasInternalLinkage () const
bool hasPrivateLinkage () const
bool hasLinkerPrivateLinkage () const
bool hasLocalLinkage () const
bool hasDLLImportLinkage () const
bool hasDLLExportLinkage () const
bool hasExternalWeakLinkage () const
bool hasGhostLinkage () const
bool hasCommonLinkage () const
void setLinkage (LinkageTypes LT)
LinkageTypes getLinkage () const
bool mayBeOverridden () const
bool isWeakForLinker () 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 () const

Static Public Member Functions

static LinkageTypes getLinkOnceLinkage (bool ODR)
static LinkageTypes getWeakLinkage (bool ODR)
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 Twine &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.
AvailableExternallyLinkage  Available for inspection, not emission.
LinkOnceAnyLinkage  Keep one copy of function when linking (inline).
LinkOnceODRLinkage  Same, but only replaced by something equivalent.
WeakAnyLinkage  Keep one copy of named function when linking (weak).
WeakODRLinkage  Same, but only replaced by something equivalent.
AppendingLinkage  Special purpose, only applies to global arrays.
InternalLinkage  Rename collisions when linking (static functions).
PrivateLinkage  Like Internal, but omit from symbol table.
LinkerPrivateLinkage  Like Private, but linker removes.
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 51 of file GlobalValue.h.


Constructor & Destructor Documentation

llvm::GlobalValue::GlobalValue ( const Type *  ty,
ValueTy  vty,
Use *  Ops,
unsigned  NumOps,
LinkageTypes  linkage,
const Twine &  Name = "" 
) [inline, protected]

Definition at line 58 of file GlobalValue.h.

References llvm::Value::setName().

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

Definition at line 73 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::hasDefaultVisibility (  )  const [inline]

Definition at line 84 of file GlobalValue.h.

References DefaultVisibility, and Visibility.

Referenced by llvm::X86Subtarget::ClassifyGlobalReference().

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

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

Definition at line 86 of file GlobalValue.h.

References ProtectedVisibility, and Visibility.

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

Definition at line 89 of file GlobalValue.h.

References Visibility.

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

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

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

void llvm::GlobalValue::setSection ( const StringRef &  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]

static LinkageTypes llvm::GlobalValue::getLinkOnceLinkage ( bool  ODR  )  [inline, static]

Definition at line 107 of file GlobalValue.h.

References LinkOnceAnyLinkage, and LinkOnceODRLinkage.

static LinkageTypes llvm::GlobalValue::getWeakLinkage ( bool  ODR  )  [inline, static]

Definition at line 110 of file GlobalValue.h.

References WeakAnyLinkage, and WeakODRLinkage.

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

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

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

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

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

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

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

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

Definition at line 127 of file GlobalValue.h.

References Linkage, and LinkerPrivateLinkage.

Referenced by llvm::Mangler::getMangledName(), and hasLocalLinkage().

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

References GhostLinkage, and Linkage.

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

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

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

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

mayBeOverridden - Whether the definition of this global may be replaced by something non-equivalent at link time. For example, if a function has weak linkage then the code defining it may be replaced by different code.

Definition at line 144 of file GlobalValue.h.

References CommonLinkage, ExternalWeakLinkage, Linkage, LinkOnceAnyLinkage, and WeakAnyLinkage.

Referenced by llvm::ComputeMaskedBits(), llvm::InlineCostAnalyzer::getInlineCost(), GetStringLengthH(), llvm::GlobalVariable::hasDefinitiveInitializer(), and llvm::GlobalAlias::resolveAliasedGlobal().

bool llvm::GlobalValue::isWeakForLinker (  )  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 86 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 172 of file GlobalValue.h.

References GhostLinkage, and Linkage.

Referenced by llvm::X86Subtarget::ClassifyGlobalReference(), llvm::BitcodeReader::dematerializeFunction(), llvm::JIT::getPointerToFunction(), 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 176 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 80 of file Globals.cpp.

References llvm_unreachable.

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

References Parent.

void GlobalValue::removeDeadConstantUsers (  )  const

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

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


Member Data Documentation

Definition at line 65 of file GlobalValue.h.

Referenced by getParent().

Definition at line 70 of file GlobalValue.h.

Referenced by getAlignment(), and setAlignment().

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

Definition at line 71 of file GlobalValue.h.

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


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