LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::Function Class Reference

#include <Function.h>

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

Public Types

typedef iplist< ArgumentArgumentListType
 
typedef iplist< BasicBlockBasicBlockListType
 
typedef
BasicBlockListType::iterator 
iterator
 
typedef
BasicBlockListType::const_iterator 
const_iterator
 
typedef ArgumentListType::iterator arg_iterator
 
typedef
ArgumentListType::const_iterator 
const_arg_iterator
 
- Public Types inherited from llvm::GlobalValue
enum  LinkageTypes {
  ExternalLinkage = 0, AvailableExternallyLinkage, LinkOnceAnyLinkage, LinkOnceODRLinkage,
  WeakAnyLinkage, WeakODRLinkage, AppendingLinkage, InternalLinkage,
  PrivateLinkage, LinkerPrivateLinkage, LinkerPrivateWeakLinkage, DLLImportLinkage,
  DLLExportLinkage, ExternalWeakLinkage, 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 Types inherited from llvm::Constant
enum  PossibleRelocationsTy { NoRelocation = 0, LocalRelocation = 1, GlobalRelocations = 2 }
 
- Public Types inherited from llvm::User
typedef Useop_iterator
 
typedef const Useconst_op_iterator
 
- Public Types inherited from llvm::Value
enum  ValueTy {
  ArgumentVal, BasicBlockVal, FunctionVal, GlobalAliasVal,
  GlobalVariableVal, UndefValueVal, BlockAddressVal, ConstantExprVal,
  ConstantAggregateZeroVal, ConstantDataArrayVal, ConstantDataVectorVal, ConstantIntVal,
  ConstantFPVal, ConstantArrayVal, ConstantStructVal, ConstantVectorVal,
  ConstantPointerNullVal, MDNodeVal, MDStringVal, InlineAsmVal,
  PseudoSourceValueVal, FixedStackPseudoSourceValueVal, InstructionVal, ConstantFirstVal = FunctionVal,
  ConstantLastVal = ConstantPointerNullVal
}
 
typedef value_use_iterator< Useruse_iterator
 
typedef value_use_iterator
< const User
const_use_iterator
 

Public Member Functions

 ~Function ()
 
TypegetReturnType () const
 
FunctionTypegetFunctionType () const
 
LLVMContextgetContext () const
 
bool isVarArg () const
 
unsigned getIntrinsicID () const LLVM_READONLY
 
bool isIntrinsic () const
 
CallingConv::ID getCallingConv () const
 
void setCallingConv (CallingConv::ID CC)
 
AttributeSet getAttributes () const
 Return the attribute list for this Function. More...
 
void setAttributes (AttributeSet attrs)
 Set the attribute list for this Function. More...
 
void addFnAttr (Attribute::AttrKind N)
 Add function attributes to this function. More...
 
void removeFnAttr (Attribute::AttrKind N)
 Remove function attributes from this function. More...
 
void addFnAttr (StringRef Kind)
 Add function attributes to this function. More...
 
void addFnAttr (StringRef Kind, StringRef Value)
 
bool hasFnAttribute (Attribute::AttrKind Kind) const
 Return true if the function has the attribute. More...
 
bool hasFnAttribute (StringRef Kind) const
 
Attribute getFnAttribute (Attribute::AttrKind Kind) const
 Return the attribute for the given attribute kind. More...
 
Attribute getFnAttribute (StringRef Kind) const
 
bool hasGC () const
 
const char * getGC () const
 
void setGC (const char *Str)
 
void clearGC ()
 
void addAttribute (unsigned i, Attribute::AttrKind attr)
 adds the attribute to the list of attributes. More...
 
void addAttributes (unsigned i, AttributeSet attrs)
 adds the attributes to the list of attributes. More...
 
void removeAttributes (unsigned i, AttributeSet attr)
 removes the attributes from the list of attributes. More...
 
unsigned getParamAlignment (unsigned i) const
 Extract the alignment for a call or parameter (0=unknown). More...
 
bool doesNotAccessMemory () const
 Determine if the function does not access memory. More...
 
void setDoesNotAccessMemory ()
 
bool onlyReadsMemory () const
 Determine if the function does not access or only reads memory. More...
 
void setOnlyReadsMemory ()
 
bool doesNotReturn () const
 Determine if the function cannot return. More...
 
void setDoesNotReturn ()
 
bool doesNotThrow () const
 Determine if the function cannot unwind. More...
 
void setDoesNotThrow ()
 
bool cannotDuplicate () const
 Determine if the call cannot be duplicated. More...
 
void setCannotDuplicate ()
 
bool hasUWTable () const
 True if the ABI mandates (or the user requested) that this function be in a unwind table. More...
 
void setHasUWTable ()
 
bool needsUnwindTableEntry () const
 True if this function needs an unwind table. More...
 
bool hasStructRetAttr () const
 Determine if the function returns a structure through first pointer argument. More...
 
bool doesNotAlias (unsigned n) const
 Determine if the parameter does not alias other parameters. More...
 
void setDoesNotAlias (unsigned n)
 
bool doesNotCapture (unsigned n) const
 Determine if the parameter can be captured. More...
 
void setDoesNotCapture (unsigned n)
 
bool doesNotAccessMemory (unsigned n) const
 
void setDoesNotAccessMemory (unsigned n)
 
bool onlyReadsMemory (unsigned n) const
 
void setOnlyReadsMemory (unsigned n)
 
void copyAttributesFrom (const GlobalValue *Src)
 
void deleteBody ()
 
virtual void removeFromParent ()
 
virtual void eraseFromParent ()
 
const ArgumentListTypegetArgumentList () const
 
ArgumentListTypegetArgumentList ()
 
const BasicBlockListTypegetBasicBlockList () const
 
BasicBlockListTypegetBasicBlockList ()
 
const BasicBlockgetEntryBlock () const
 
BasicBlockgetEntryBlock ()
 
ValueSymbolTablegetValueSymbolTable ()
 
const ValueSymbolTablegetValueSymbolTable () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
size_t size () const
 
bool empty () const
 
const BasicBlockfront () const
 
BasicBlockfront ()
 
const BasicBlockback () const
 
BasicBlockback ()
 
arg_iterator arg_begin ()
 
const_arg_iterator arg_begin () const
 
arg_iterator arg_end ()
 
const_arg_iterator arg_end () const
 
size_t arg_size () const
 
bool arg_empty () const
 
bool hasPrefixData () const
 
ConstantgetPrefixData () const
 
void setPrefixData (Constant *PrefixData)
 
void viewCFG () const
 
void viewCFGOnly () const
 
void dropAllReferences ()
 
bool hasAddressTaken (const User **=0) const
 
bool isDefTriviallyDead () const
 
bool callsFunctionThatReturnsTwice () const
 
- Public Member Functions inherited from llvm::GlobalValue
 ~GlobalValue ()
 
unsigned getAlignment () const
 
void setAlignment (unsigned Align)
 
bool hasUnnamedAddr () const
 
void setUnnamedAddr (bool Val)
 
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 (StringRef S)
 
bool use_empty_except_constants ()
 Determine if the usage of this global value is empty except for transitively dead constants. More...
 
PointerTypegetType () const
 getType - Global values are always pointers. More...
 
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 hasLinkerPrivateWeakLinkage () const
 
bool hasLocalLinkage () const
 
bool hasDLLImportLinkage () const
 
bool hasDLLExportLinkage () const
 
bool hasExternalWeakLinkage () const
 
bool hasCommonLinkage () const
 
void setLinkage (LinkageTypes LT)
 
LinkageTypes getLinkage () const
 
bool isDiscardableIfUnused () const
 
bool mayBeOverridden () const
 
bool isWeakForLinker () const
 
virtual void destroyConstant ()
 Override from Constant class. More...
 
bool isDeclaration () const
 
ModulegetParent ()
 
const ModulegetParent () const
 
bool isMaterializable () const
 
bool isDematerializable () const
 
bool Materialize (std::string *ErrInfo=0)
 
void Dematerialize ()
 
- Public Member Functions inherited from llvm::Constant
bool isNullValue () const
 
bool isAllOnesValue () const
 
bool isNegativeZeroValue () const
 
bool isZeroValue () const
 Return true if the value is negative zero or null value. More...
 
bool canTrap () const
 
bool isThreadDependent () const
 isThreadDependent - Return true if the value can vary between threads. More...
 
bool isConstantUsed () const
 
PossibleRelocationsTy getRelocationInfo () const
 
ConstantgetAggregateElement (unsigned Elt) const
 
ConstantgetAggregateElement (Constant *Elt) const
 
ConstantgetSplatValue () const
 
const APIntgetUniqueInteger () const
 
virtual void replaceUsesOfWithOnConstant (Value *, Value *, Use *)
 
void removeDeadConstantUsers () const
 
- Public Member Functions inherited from llvm::User
 ~User ()
 
void operator delete (void *Usr)
 operator delete - free memory allocated for User and Use objects More...
 
void operator delete (void *, unsigned)
 placement delete - required by std, but never called. More...
 
void operator delete (void *, unsigned, bool)
 placement delete - required by std, but never called. More...
 
ValuegetOperand (unsigned i) const
 
void setOperand (unsigned i, Value *Val)
 
const UsegetOperandUse (unsigned i) const
 
UsegetOperandUse (unsigned i)
 
unsigned getNumOperands () const
 
op_iterator op_begin ()
 
const_op_iterator op_begin () const
 
op_iterator op_end ()
 
const_op_iterator op_end () const
 
value_op_iterator value_op_begin ()
 
value_op_iterator value_op_end ()
 
void dropAllReferences ()
 
void replaceUsesOfWith (Value *From, Value *To)
 
- Public Member Functions inherited from llvm::Value
virtual ~Value ()
 
void dump () const
 dump - Support for debugging, callable in GDB: V->dump() More...
 
void print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const
 
TypegetType () const
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 
void setName (const Twine &Name)
 
void takeName (Value *V)
 
void replaceAllUsesWith (Value *V)
 
bool use_empty () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
Useruse_back ()
 
const Useruse_back () const
 
bool hasOneUse () const
 
bool hasNUses (unsigned N) const
 
bool hasNUsesOrMore (unsigned N) const
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 
unsigned getNumUses () const
 
void addUse (Use &U)
 
unsigned getValueID () const
 
unsigned getRawSubclassOptionalData () const
 
void clearSubclassOptionalData ()
 
bool hasSameSubclassOptionalData (const Value *V) const
 
void intersectOptionalDataWith (const Value *V)
 
bool hasValueHandle () const
 
ValuestripPointerCasts ()
 Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCasts () const
 
ValuestripPointerCastsNoFollowAliases ()
 Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCastsNoFollowAliases () const
 
ValuestripInBoundsConstantOffsets ()
 Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsConstantOffsets () const
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More...
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 
ValuestripInBoundsOffsets ()
 Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsOffsets () const
 
bool isDereferenceablePointer () const
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 
void mutateType (Type *Ty)
 
- Public Member Functions inherited from llvm::ilist_node< Function >
FunctiongetPrevNode ()
 Get the previous node, or 0 for the list head. More...
 
const FunctiongetPrevNode () const
 Get the previous node, or 0 for the list head. More...
 
FunctiongetNextNode ()
 Get the next node, or 0 for the list tail. More...
 
const FunctiongetNextNode () const
 Get the next node, or 0 for the list tail. More...
 

Static Public Member Functions

static FunctionCreate (FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=0)
 
static iplist< Argument >
Function::* 
getSublistAccess (Argument *)
 
static iplist< BasicBlock >
Function::* 
getSublistAccess (BasicBlock *)
 
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
- Static Public Member Functions inherited from llvm::GlobalValue
static LinkageTypes getLinkOnceLinkage (bool ODR)
 
static LinkageTypes getWeakLinkage (bool ODR)
 
static bool isExternalLinkage (LinkageTypes Linkage)
 
static bool isAvailableExternallyLinkage (LinkageTypes Linkage)
 
static bool isLinkOnceLinkage (LinkageTypes Linkage)
 
static bool isWeakLinkage (LinkageTypes Linkage)
 
static bool isAppendingLinkage (LinkageTypes Linkage)
 
static bool isInternalLinkage (LinkageTypes Linkage)
 
static bool isPrivateLinkage (LinkageTypes Linkage)
 
static bool isLinkerPrivateLinkage (LinkageTypes Linkage)
 
static bool isLinkerPrivateWeakLinkage (LinkageTypes Linkage)
 
static bool isLocalLinkage (LinkageTypes Linkage)
 
static bool isDLLImportLinkage (LinkageTypes Linkage)
 
static bool isDLLExportLinkage (LinkageTypes Linkage)
 
static bool isExternalWeakLinkage (LinkageTypes Linkage)
 
static bool isCommonLinkage (LinkageTypes Linkage)
 
static bool isDiscardableIfUnused (LinkageTypes Linkage)
 
static bool mayBeOverridden (LinkageTypes Linkage)
 
static bool isWeakForLinker (LinkageTypes Linkage)
 
static StringRef getRealLinkageName (StringRef Name)
 
static bool classof (const Value *V)
 
- Static Public Member Functions inherited from llvm::Constant
static bool classof (const Value *V)
 
static ConstantgetNullValue (Type *Ty)
 
static ConstantgetAllOnesValue (Type *Ty)
 Get the all ones value. More...
 
static ConstantgetIntegerValue (Type *Ty, const APInt &V)
 
- Static Public Member Functions inherited from llvm::User
static bool classof (const Value *V)
 

Friends

class SymbolTableListTraits< Function, Module >
 

Additional Inherited Members

- Static Public Attributes inherited from llvm::Value
static const unsigned MaximumAlignment = 1u << 29
 
- Protected Member Functions inherited from llvm::GlobalValue
 GlobalValue (Type *ty, ValueTy vty, Use *Ops, unsigned NumOps, LinkageTypes linkage, const Twine &Name)
 
- Protected Member Functions inherited from llvm::Constant
 Constant (Type *ty, ValueTy vty, Use *Ops, unsigned NumOps)
 
void destroyConstantImpl ()
 
- Protected Member Functions inherited from llvm::User
void * operator new (size_t s, unsigned Us)
 
 User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps)
 
UseallocHungoffUses (unsigned) const
 
void dropHungoffUses ()
 
template<int Idx>
UseOp ()
 
template<int Idx>
const UseOp () const
 
- Protected Member Functions inherited from llvm::Value
virtual void printCustom (raw_ostream &O) const
 
 Value (Type *Ty, unsigned scid)
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 
- Protected Member Functions inherited from llvm::ilist_node< Function >
 ilist_node ()
 
- Static Protected Member Functions inherited from llvm::User
template<int Idx, typename U >
static UseOpFrom (const U *that)
 
- Protected Attributes inherited from llvm::GlobalValue
LinkageTypes Linkage: 5
 
unsigned Visibility: 2
 
unsigned Alignment: 16
 
unsigned UnnamedAddr: 1
 
ModuleParent
 
std::string Section
 
- Protected Attributes inherited from llvm::User
UseOperandList
 
unsigned NumOperands
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 

Detailed Description

Definition at line 70 of file Function.h.

Member Typedef Documentation

Definition at line 80 of file Function.h.

Definition at line 73 of file Function.h.

Definition at line 74 of file Function.h.

Definition at line 81 of file Function.h.

Definition at line 78 of file Function.h.

Definition at line 77 of file Function.h.

Constructor & Destructor Documentation

Function::~Function ( )

Member Function Documentation

void Function::addAttribute ( unsigned  i,
Attribute::AttrKind  attr 
)

adds the attribute to the list of attributes.

Definition at line 284 of file Function.cpp.

References llvm::AttributeSet::addAttribute(), getAttributes(), getContext(), and setAttributes().

Referenced by setDoesNotAccessMemory(), setDoesNotAlias(), setDoesNotCapture(), and setOnlyReadsMemory().

void Function::addAttributes ( unsigned  i,
AttributeSet  attrs 
)

adds the attributes to the list of attributes.

Definition at line 290 of file Function.cpp.

References llvm::AttributeSet::addAttributes(), getAttributes(), getContext(), and setAttributes().

Referenced by llvm::Argument::addAttr(), LLVMAddTargetDependentFunctionAttr(), and removeUseSoftFloat().

void llvm::Function::addFnAttr ( Attribute::AttrKind  N)
inline
void llvm::Function::addFnAttr ( StringRef  Kind)
inline

Add function attributes to this function.

Definition at line 188 of file Function.h.

References llvm::AttributeSet::addAttribute(), getContext(), and setAttributes().

void llvm::Function::addFnAttr ( StringRef  Kind,
StringRef  Value 
)
inline

Definition at line 193 of file Function.h.

References llvm::AttributeSet::addAttribute(), getContext(), and setAttributes().

arg_iterator llvm::Function::arg_begin ( )
inline
const_arg_iterator llvm::Function::arg_begin ( ) const
inline

Definition at line 414 of file Function.h.

References llvm::iplist< NodeTy, Traits >::begin().

bool Function::arg_empty ( ) const

Definition at line 251 of file Function.cpp.

References getFunctionType(), and llvm::FunctionType::getNumParams().

arg_iterator llvm::Function::arg_end ( )
inline
const_arg_iterator llvm::Function::arg_end ( ) const
inline

Definition at line 422 of file Function.h.

References llvm::iplist< NodeTy, Traits >::end().

size_t Function::arg_size ( ) const
const BasicBlock& llvm::Function::back ( ) const
inline

Definition at line 404 of file Function.h.

References llvm::iplist< NodeTy, Traits >::back().

Referenced by llvm::InlineFunction().

BasicBlock& llvm::Function::back ( )
inline

Definition at line 405 of file Function.h.

References llvm::iplist< NodeTy, Traits >::back().

iterator llvm::Function::begin ( )
inline

Definition at line 395 of file Function.h.

References llvm::iplist< NodeTy, Traits >::begin().

Referenced by llvm::Interpreter::callFunction(), llvm::CloneAndPruneFunctionInto(), llvm::CloneFunctionInto(), ComputePostOrders(), cxxDtorIsEmpty(), llvm::InstCombiner::DoOneIteration(), dropAllReferences(), llvm::dumpBlock(), llvm::AsmPrinter::EmitFunctionBody(), fixupFPReturnAndCall(), getCommonReturnValue(), llvm::GraphTraits< BlockFrequencyInfo * >::getEntryNode(), HandleByValArgument(), llvm::ValueEnumerator::incorporateFunction(), IncorporateFunctionInfoGlobalBBIDs(), llvm::InlineFunction(), llvm::InlineCostAnalysis::isInlineViable(), isOnlyUsedInEntryBlock(), iterativelyFlattenCFG(), iterativelySimplifyCFG(), LLVMGetBasicBlocks(), LLVMGetFirstBasicBlock(), LLVMGetLastBasicBlock(), LLVMGetPreviousBasicBlock(), llvm::LowerDbgDeclare(), mergeEmptyReturnBlocks(), llvm::GraphTraits< BlockFrequencyInfo * >::nodes_begin(), llvm::GraphTraits< Function * >::nodes_begin(), llvm::GraphTraits< const Function * >::nodes_begin(), llvm::BranchProbabilityInfo::print(), llvm::SparseSolver::Print(), llvm::AssemblyWriter::printFunction(), llvm::removeUnreachableBlocks(), llvm::NVPTXSplitBBatBar::runOnFunction(), llvm::NVPTXLowerAggrCopies::runOnFunction(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::Inliner::runOnSCC(), llvm::FunctionLoweringInfo::set(), SplitCriticalSideEffectEdges(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), WriteFunction(), WriteFunctionUseList(), and WriteMetadataAttachment().

const_iterator llvm::Function::begin ( ) const
inline

Definition at line 396 of file Function.h.

References llvm::iplist< NodeTy, Traits >::begin().

bool Function::callsFunctionThatReturnsTwice ( ) const

callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function that gcc recognizes as "returning twice".

Definition at line 728 of file Function.cpp.

References llvm::CallInst::canReturnTwice(), llvm::dyn_cast(), I, llvm::inst_begin(), and llvm::inst_end().

Referenced by llvm::SelectionDAGISel::runOnMachineFunction().

bool llvm::Function::cannotDuplicate ( ) const
inline

Determine if the call cannot be duplicated.

Definition at line 274 of file Function.h.

References llvm::AttributeSet::hasAttribute(), and llvm::Attribute::NoDuplicate.

static bool llvm::Function::classof ( const Value V)
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition at line 453 of file Function.h.

References llvm::Value::FunctionVal, and llvm::Value::getValueID().

void Function::clearGC ( )

Definition at line 330 of file Function.cpp.

References llvm::StringPool::empty(), GCLock, GCNamePool, and GCNames.

Referenced by copyAttributesFrom(), LLVMSetGC(), and ~Function().

void Function::copyAttributesFrom ( const GlobalValue Src)
virtual

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

Reimplemented from llvm::GlobalValue.

Definition at line 347 of file Function.cpp.

References clearGC(), llvm::GlobalValue::copyAttributesFrom(), getAttributes(), getCallingConv(), getGC(), getPrefixData(), hasGC(), hasPrefixData(), setAttributes(), setCallingConv(), setGC(), and setPrefixData().

Referenced by llvm::CloneModule().

static Function* llvm::Function::Create ( FunctionType Ty,
LinkageTypes  Linkage,
const Twine N = "",
Module M = 0 
)
inlinestatic
void llvm::Function::deleteBody ( )
inline

deleteBody - This method deletes the body of the function, and converts the linkage to external.

Definition at line 343 of file Function.h.

References dropAllReferences(), llvm::GlobalValue::ExternalLinkage, and llvm::GlobalValue::setLinkage().

Referenced by llvm::BitcodeReader::Dematerialize().

bool llvm::Function::doesNotAccessMemory ( ) const
inline

Determine if the function does not access memory.

Definition at line 237 of file Function.h.

References llvm::AttributeSet::hasAttribute(), and llvm::Attribute::ReadNone.

Referenced by onlyReadsMemory().

bool llvm::Function::doesNotAccessMemory ( unsigned  n) const
inline

Definition at line 321 of file Function.h.

References llvm::AttributeSet::hasAttribute(), and llvm::Attribute::ReadNone.

bool llvm::Function::doesNotAlias ( unsigned  n) const
inline

Determine if the parameter does not alias other parameters.

Parameters
nThe parameter to check. 1 is the first parameter, 0 is the return

Definition at line 305 of file Function.h.

References llvm::AttributeSet::hasAttribute(), and llvm::Attribute::NoAlias.

bool llvm::Function::doesNotCapture ( unsigned  n) const
inline

Determine if the parameter can be captured.

Parameters
nThe parameter to check. 1 is the first parameter, 0 is the return

Definition at line 314 of file Function.h.

References llvm::AttributeSet::hasAttribute(), and llvm::Attribute::NoCapture.

bool llvm::Function::doesNotReturn ( ) const
inline

Determine if the function cannot return.

Definition at line 256 of file Function.h.

References llvm::AttributeSet::hasAttribute(), and llvm::Attribute::NoReturn.

bool llvm::Function::doesNotThrow ( ) const
inline
void Function::dropAllReferences ( )

dropAllReferences() - This method causes all the subinstructions to "let go" of all references that they are maintaining. This allows one to 'delete' a whole module at a time, even though there may be circular references... first all references are dropped, and all use counts go to zero. Then everything is deleted for real. Note that no operations are valid on an object that has "dropped all references", except operator delete.

Since no other object in the module can have references into the body of a function, dropping all references deletes the entire body of the function, including any contained basic blocks.

Definition at line 271 of file Function.cpp.

References llvm::iplist< NodeTy, Traits >::begin(), begin(), llvm::iplist< NodeTy, Traits >::empty(), end(), I, and setPrefixData().

Referenced by deleteBody(), and ~Function().

bool llvm::Function::empty ( ) const
inline

Definition at line 401 of file Function.h.

References llvm::iplist< NodeTy, Traits >::empty().

iterator llvm::Function::end ( )
inline
const_iterator llvm::Function::end ( ) const
inline

Definition at line 398 of file Function.h.

References llvm::iplist< NodeTy, Traits >::end().

void Function::eraseFromParent ( )
virtual

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

Implements llvm::GlobalValue.

Definition at line 187 of file Function.cpp.

References llvm::iplist< NodeTy, Traits >::erase(), llvm::Module::getFunctionList(), and llvm::GlobalValue::getParent().

Referenced by INITIALIZE_PASS(), llvm::JIT::runFunction(), and llvm::UpgradeCallsToIntrinsic().

const BasicBlock& llvm::Function::front ( ) const
inline
BasicBlock& llvm::Function::front ( )
inline

Definition at line 403 of file Function.h.

References llvm::iplist< NodeTy, Traits >::front().

const ArgumentListType& llvm::Function::getArgumentList ( ) const
inline

Get the underlying elements of the Function... the basic block list is empty for external functions.

Definition at line 362 of file Function.h.

Referenced by llvm::Argument::Argument().

ArgumentListType& llvm::Function::getArgumentList ( )
inline

Definition at line 366 of file Function.h.

AttributeSet llvm::Function::getAttributes ( ) const
inline

Return the attribute list for this Function.

Definition at line 170 of file Function.h.

Referenced by addAttribute(), addAttributes(), AdjustCallerSSPLevel(), llvm::AMDGPUMachineFunction::AMDGPUMachineFunction(), checkNumAlignedDPRCS2Regs(), llvm::CloneFunctionInto(), copyAttributesFrom(), llvm::PPCFrameLowering::determineFrameLayout(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::XCoreFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), ExpandPowI(), llvm::X86InstrInfo::foldMemoryOperandImpl(), llvm::Inliner::getInlineThreshold(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), getMemcpyLoadsAndStores(), getMemmoveLoadsAndStores(), getMemsetStores(), llvm::ARMBaseInstrInfo::getOperandLatency(), llvm::ARMTargetLowering::getOptimalMemOpType(), llvm::X86TargetLowering::getOptimalMemOpType(), llvm::Argument::hasByValAttr(), llvm::Argument::hasNestAttr(), llvm::Argument::hasNoAliasAttr(), llvm::Argument::hasNoCaptureAttr(), llvm::Argument::hasReturnedAttr(), llvm::Argument::hasStructRetAttr(), llvm::ValueEnumerator::incorporateFunction(), llvm::InlineCostAnalysis::isInlineViable(), llvm::TargetLowering::isInTailCallPosition(), LLVMAddFunctionAttr(), LLVMGetAttribute(), LLVMGetFunctionAttr(), LLVMRemoveFunctionAttr(), llvm::NVPTXTargetLowering::LowerFormalArguments(), llvm::MachineFunction::MachineFunction(), llvm::PPCFrameLowering::needsFP(), llvm::PPCRegisterInfo::needsStackRealignment(), llvm::X86RegisterInfo::needsStackRealignment(), llvm::ARMBaseRegisterInfo::needsStackRealignment(), llvm::Argument::onlyReadsMemory(), PerformSTORECombine(), llvm::AssemblyWriter::printFunction(), ProfitableToMerge(), removeAttributes(), llvm::Inliner::removeDeadFunctions(), RemoveNestAttribute(), llvm::MipsSubtarget::resetSubtarget(), llvm::PPCSubtarget::resetSubtargetFeatures(), llvm::X86Subtarget::resetSubtargetFeatures(), llvm::ARMSubtarget::resetSubtargetFeatures(), llvm::returnTypeIsEligibleForTailCall(), llvm::InstCombiner::runOnFunction(), llvm::StackProtector::runOnFunction(), llvm::FunctionLoweringInfo::set(), and llvm::InstCombiner::visitFPTrunc().

const BasicBlockListType& llvm::Function::getBasicBlockList ( ) const
inline
BasicBlockListType& llvm::Function::getBasicBlockList ( )
inline

Definition at line 375 of file Function.h.

CallingConv::ID llvm::Function::getCallingConv ( ) const
inline
LLVMContext & Function::getContext ( ) const

getContext - Return a pointer to the LLVMContext associated with this function, or NULL if this function is not bound to a context yet.

Definition at line 167 of file Function.cpp.

References llvm::Type::getContext(), and llvm::GlobalValue::getType().

Referenced by llvm::Argument::addAttr(), addAttribute(), addAttributes(), addFnAttr(), AdjustCallerSSPLevel(), llvm::DwarfDebug::beginFunction(), llvm::DwarfDebug::beginInstruction(), llvm::CloneFunctionInto(), llvm::ConstantFoldCall(), createFPFnStub(), duplicateCPV(), llvm::NVPTXAsmPrinter::emitLineNumberAsDotLoc(), llvm::Thumb2RegisterInfo::emitLoadConstPool(), llvm::Thumb1RegisterInfo::emitLoadConstPool(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), llvm::FastISel::FastEmit_ri_(), llvm::LexicalScopes::findLexicalScope(), llvm::X86InstrInfo::foldMemoryOperandImpl(), llvm::BlockAddress::get(), llvm::ScalarEvolution::getContext(), getIntrinsicID(), getPrefixData(), llvm::SelectionDAG::init(), INITIALIZE_PASS(), insertFastDiv(), llvm::isFreeCall(), LLVMAddFunctionAttr(), LLVMAddTargetDependentFunctionAttr(), LLVMRemoveFunctionAttr(), llvm::NVPTXTargetLowering::LowerCall(), llvm::NVPTXTargetLowering::LowerFormalArguments(), llvm::NVPTXTargetLowering::LowerReturn(), printDebugLoc(), llvm::Argument::removeAttr(), removeAttributes(), removeFnAttr(), RemoveNestAttribute(), removeUseSoftFloat(), llvm::JIT::runFunction(), llvm::ExecutionEngine::runFunctionAsMain(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::InstCombiner::runOnFunction(), llvm::FunctionLoweringInfo::set(), setPrefixData(), llvm::UpgradeIntrinsicFunction(), UpgradeIntrinsicFunction1(), UpgradeSSE41Function(), and ~Function().

const BasicBlock& llvm::Function::getEntryBlock ( ) const
inline
BasicBlock& llvm::Function::getEntryBlock ( )
inline

Definition at line 381 of file Function.h.

References front().

Attribute llvm::Function::getFnAttribute ( Attribute::AttrKind  Kind) const
inline

Return the attribute for the given attribute kind.

Definition at line 208 of file Function.h.

References llvm::AttributeSet::getAttribute().

Referenced by llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), and LowerInterruptReturn().

Attribute llvm::Function::getFnAttribute ( StringRef  Kind) const
inline

Definition at line 211 of file Function.h.

References llvm::AttributeSet::getAttribute().

FunctionType * Function::getFunctionType ( ) const
const char * Function::getGC ( ) const
unsigned Function::getIntrinsicID ( ) const

getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intrinsic if the function is not an intrinsic, or if the pointer is null. This value is always defined to be zero to allow easy checking for whether a function is intrinsic or not. The particular intrinsic functions which correspond to this value are defined in llvm/Intrinsics.h. Results are cached in the LLVM context, subsequent requests for the same ID return results much faster from the cache.

Definition at line 371 of file Function.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::count(), getContext(), llvm::Value::getValueName(), llvm::tgtok::Id, llvm::LLVMContextImpl::IntrinsicIDCache, isIntrinsic(), and llvm::LLVMContext::pImpl.

Referenced by llvm::canConstantFoldCallTo(), llvm::ConstantFoldCall(), llvm::IntrinsicInst::getIntrinsicID(), llvm::IntrinsicLowering::LowerIntrinsicCall(), SimplifyCall(), llvm::UpgradeIntrinsicCall(), llvm::UpgradeIntrinsicFunction(), llvm::Interpreter::visitCallSite(), and llvm::InstCombiner::visitFPTrunc().

unsigned llvm::Function::getParamAlignment ( unsigned  i) const
inline

Extract the alignment for a call or parameter (0=unknown).

Definition at line 232 of file Function.h.

References llvm::AttributeSet::getParamAlignment().

Referenced by llvm::Argument::getParamAlignment(), and llvm::InlineFunction().

Constant * Function::getPrefixData ( ) const
Type * Function::getReturnType ( ) const
static iplist<Argument> Function::* llvm::Function::getSublistAccess ( Argument )
inlinestatic

Definition at line 370 of file Function.h.

static iplist<BasicBlock> Function::* llvm::Function::getSublistAccess ( BasicBlock )
inlinestatic

Definition at line 376 of file Function.h.

ValueSymbolTable& llvm::Function::getValueSymbolTable ( )
inline

getSymbolTable() - Return the symbol table...

Definition at line 388 of file Function.h.

Referenced by llvm::ilist_traits< BasicBlock >::getSymTab(), llvm::ilist_traits< Argument >::getSymTab(), and WriteFunction().

const ValueSymbolTable& llvm::Function::getValueSymbolTable ( ) const
inline

Definition at line 389 of file Function.h.

bool Function::hasAddressTaken ( const User **  PutOffender = 0) const

hasAddressTaken - returns true if there are any uses of this function other than direct calls or invokes to it, or blockaddress expressions. Optionally passes back an offending user for diagnostic purposes.

hasAddressTaken - returns true if there are any uses of this function other than direct calls or invokes to it.

Definition at line 698 of file Function.cpp.

References I, llvm::Value::use_begin(), and llvm::Value::use_end().

bool llvm::Function::hasFnAttribute ( Attribute::AttrKind  Kind) const
inline
bool llvm::Function::hasFnAttribute ( StringRef  Kind) const
inline

Definition at line 203 of file Function.h.

References llvm::AttributeSet::hasAttribute().

bool Function::hasGC ( ) const

hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generation.

Definition at line 310 of file Function.cpp.

References GCLock, and GCNames.

Referenced by copyAttributesFrom(), llvm::GCModuleInfo::getFunctionInfo(), getGC(), llvm::InlineFunction(), LLVMGetGC(), llvm::AssemblyWriter::printFunction(), profileFunction(), and llvm::SelectionDAGISel::runOnMachineFunction().

bool llvm::Function::hasPrefixData ( ) const
inline
bool llvm::Function::hasStructRetAttr ( ) const
inline
bool llvm::Function::hasUWTable ( ) const
inline

True if the ABI mandates (or the user requested) that this function be in a unwind table.

Definition at line 284 of file Function.h.

References llvm::AttributeSet::hasAttribute(), and llvm::Attribute::UWTable.

Referenced by needsUnwindTableEntry().

bool Function::isDefTriviallyDead ( ) const

isDefTriviallyDead - Return true if it is trivially safe to remove this function definition from the module (because it isn't externally visible, does not have its address taken, and has no callers). To make this more accurate, call removeDeadConstantUsers first.

Definition at line 712 of file Function.cpp.

References llvm::GlobalValue::hasAvailableExternallyLinkage(), llvm::GlobalValue::hasLinkOnceLinkage(), llvm::GlobalValue::hasLocalLinkage(), I, llvm::Value::use_begin(), and llvm::Value::use_end().

Referenced by llvm::Inliner::removeDeadFunctions().

bool llvm::Function::isIntrinsic ( ) const
inline
bool Function::isVarArg ( ) const
bool llvm::Function::needsUnwindTableEntry ( ) const
inline
bool llvm::Function::onlyReadsMemory ( ) const
inline

Determine if the function does not access or only reads memory.

Definition at line 246 of file Function.h.

References doesNotAccessMemory(), llvm::AttributeSet::hasAttribute(), and llvm::Attribute::ReadOnly.

Referenced by HandleByValArgument().

bool llvm::Function::onlyReadsMemory ( unsigned  n) const
inline
void Function::removeAttributes ( unsigned  i,
AttributeSet  attr 
)

removes the attributes from the list of attributes.

Definition at line 296 of file Function.cpp.

References getAttributes(), getContext(), llvm::AttributeSet::removeAttributes(), and setAttributes().

Referenced by AdjustCallerSSPLevel(), llvm::Argument::removeAttr(), and removeUseSoftFloat().

void llvm::Function::removeFnAttr ( Attribute::AttrKind  N)
inline

Remove function attributes from this function.

Definition at line 182 of file Function.h.

References getContext(), llvm::AttributeSet::removeAttribute(), and setAttributes().

void Function::removeFromParent ( )
virtual

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

Implements llvm::GlobalValue.

Definition at line 183 of file Function.cpp.

References llvm::Module::getFunctionList(), llvm::GlobalValue::getParent(), and llvm::iplist< NodeTy, Traits >::remove().

void llvm::Function::setAttributes ( AttributeSet  attrs)
inline
void llvm::Function::setCallingConv ( CallingConv::ID  CC)
inline

Definition at line 164 of file Function.h.

References llvm::Value::getSubclassDataFromValue().

Referenced by copyAttributesFrom().

void llvm::Function::setCannotDuplicate ( )
inline

Definition at line 278 of file Function.h.

References addFnAttr(), and llvm::Attribute::NoDuplicate.

void llvm::Function::setDoesNotAccessMemory ( )
inline

Definition at line 241 of file Function.h.

References addFnAttr(), and llvm::Attribute::ReadNone.

void llvm::Function::setDoesNotAccessMemory ( unsigned  n)
inline

Definition at line 324 of file Function.h.

References addAttribute(), and llvm::Attribute::ReadNone.

void llvm::Function::setDoesNotAlias ( unsigned  n)
inline

Definition at line 308 of file Function.h.

References addAttribute(), and llvm::Attribute::NoAlias.

void llvm::Function::setDoesNotCapture ( unsigned  n)
inline

Definition at line 317 of file Function.h.

References addAttribute(), and llvm::Attribute::NoCapture.

void llvm::Function::setDoesNotReturn ( )
inline

Definition at line 260 of file Function.h.

References addFnAttr(), and llvm::Attribute::NoReturn.

void llvm::Function::setDoesNotThrow ( )
inline

Definition at line 269 of file Function.h.

References addFnAttr(), and llvm::Attribute::NoUnwind.

void Function::setGC ( const char *  Str)

Definition at line 321 of file Function.cpp.

References GCLock, GCNamePool, GCNames, and llvm::StringPool::intern().

Referenced by copyAttributesFrom(), llvm::InlineFunction(), and LLVMSetGC().

void llvm::Function::setHasUWTable ( )
inline

Definition at line 288 of file Function.h.

References addFnAttr(), and llvm::Attribute::UWTable.

void llvm::Function::setOnlyReadsMemory ( )
inline

Definition at line 251 of file Function.h.

References addFnAttr(), and llvm::Attribute::ReadOnly.

void llvm::Function::setOnlyReadsMemory ( unsigned  n)
inline

Definition at line 332 of file Function.h.

References addAttribute(), and llvm::Attribute::ReadOnly.

void Function::setPrefixData ( Constant PrefixData)
size_t llvm::Function::size ( ) const
inline
void llvm::Function::viewCFG ( ) const

viewCFG - This function is meant for use from the debugger. You can just say 'call F->viewCFG()' and a ghostview window should pop up from the program, displaying the CFG of the current function with the code for each basic block inside. This depends on there being a 'dot' and 'gv' program in your path.

Referenced by LLVMViewFunctionCFG().

void llvm::Function::viewCFGOnly ( ) const

viewCFGOnly - This function is meant for use from the debugger. It works just like viewCFG, but it does not include the contents of basic blocks into the nodes, just the label. If you are only interested in the CFG this can make the graph smaller.

Referenced by LLVMViewFunctionCFGOnly().

Friends And Related Function Documentation

friend class SymbolTableListTraits< Function, Module >
friend

Definition at line 96 of file Function.h.


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