LLVM  mainline
Public Types | Public Member Functions | Static Public Member Functions | Friends
llvm::Function Class Reference

#include <Function.h>

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

List of all members.

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 Member Functions

 ~Function () override
TypegetReturnType () const
FunctionTypegetFunctionType () const
LLVMContextgetContext () const
 getContext - Return a reference to the LLVMContext associated with this function.
bool isVarArg () const
 isVarArg - Return true if this function takes a variable number of arguments.
bool isMaterializable () const
 If this function's Module is being lazily streamed in functions from disk or some other source, this method can be used to check to see if the function has been read in yet or not.
void setIsMaterializable (bool V)
Intrinsic::ID getIntrinsicID () const LLVM_READONLY
 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.
bool isIntrinsic () const
void recalculateIntrinsicID ()
 Recalculate the ID for this function if it is an Intrinsic defined in llvm/Intrinsics.h.
CallingConv::ID getCallingConv () const
 getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this function.
void setCallingConv (CallingConv::ID CC)
AttributeSet getAttributes () const
 Return the attribute list for this Function.
void setAttributes (AttributeSet attrs)
 Set the attribute list for this Function.
void addFnAttr (Attribute::AttrKind N)
 Add function attributes to this function.
void removeFnAttr (Attribute::AttrKind N)
 Remove function attributes from this function.
void addFnAttr (StringRef Kind)
 Add function attributes to this function.
void addFnAttr (StringRef Kind, StringRef Value)
void setEntryCount (uint64_t Count)
 Set the entry count for this function.
Optional< uint64_t > getEntryCount () const
 Get the entry count for this function.
bool hasFnAttribute (Attribute::AttrKind Kind) const
 Return true if the function has the attribute.
bool hasFnAttribute (StringRef Kind) const
Attribute getFnAttribute (Attribute::AttrKind Kind) const
 Return the attribute for the given attribute kind.
Attribute getFnAttribute (StringRef Kind) const
unsigned getFnStackAlignment () const
 Return the stack alignment for the function.
bool hasGC () const
 hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generation.
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.
void addAttributes (unsigned i, AttributeSet attrs)
 adds the attributes to the list of attributes.
void removeAttributes (unsigned i, AttributeSet attr)
 removes the attributes from the list of attributes.
void addDereferenceableAttr (unsigned i, uint64_t Bytes)
 adds the dereferenceable attribute to the list of attributes.
void addDereferenceableOrNullAttr (unsigned i, uint64_t Bytes)
 adds the dereferenceable_or_null attribute to the list of attributes.
unsigned getParamAlignment (unsigned i) const
 Extract the alignment for a call or parameter (0=unknown).
uint64_t getDereferenceableBytes (unsigned i) const
 Extract the number of dereferenceable bytes for a call or parameter (0=unknown).
uint64_t getDereferenceableOrNullBytes (unsigned i) const
 Extract the number of dereferenceable_or_null bytes for a call or parameter (0=unknown).
bool doesNotAccessMemory () const
 Determine if the function does not access memory.
void setDoesNotAccessMemory ()
bool onlyReadsMemory () const
 Determine if the function does not access or only reads memory.
void setOnlyReadsMemory ()
bool doesNotReturn () const
 Determine if the function cannot return.
void setDoesNotReturn ()
bool doesNotThrow () const
 Determine if the function cannot unwind.
void setDoesNotThrow ()
bool cannotDuplicate () const
 Determine if the call cannot be duplicated.
void setCannotDuplicate ()
bool hasUWTable () const
 True if the ABI mandates (or the user requested) that this function be in a unwind table.
void setHasUWTable ()
bool needsUnwindTableEntry () const
 True if this function needs an unwind table.
bool hasStructRetAttr () const
 Determine if the function returns a structure through first pointer argument.
bool doesNotAlias (unsigned n) const
 Determine if the parameter does not alias other parameters.
void setDoesNotAlias (unsigned n)
bool doesNotCapture (unsigned n) const
 Determine if the parameter can be captured.
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) override
 copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the Function Src to this one.
void deleteBody ()
 deleteBody - This method deletes the body of the function, and converts the linkage to external.
void removeFromParent () override
 removeFromParent - This method unlinks 'this' from the containing module, but does not delete it.
void eraseFromParent () override
 eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
const ArgumentListTypegetArgumentList () const
 Get the underlying elements of the Function...
ArgumentListTypegetArgumentList ()
const BasicBlockListTypegetBasicBlockList () const
BasicBlockListTypegetBasicBlockList ()
const BasicBlockgetEntryBlock () const
BasicBlockgetEntryBlock ()
ValueSymbolTablegetValueSymbolTable ()
 getSymbolTable() - Return the symbol table...
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 ()
size_t arg_size () const
bool arg_empty () const
bool hasPrefixData () const
ConstantgetPrefixData () const
void setPrefixData (Constant *PrefixData)
bool hasPrologueData () const
ConstantgetPrologueData () const
void setPrologueData (Constant *PrologueData)
void print (raw_ostream &OS, AssemblyAnnotationWriter *AAW=nullptr) const
 Print the function to an output stream with an optional AssemblyAnnotationWriter.
void viewCFG () const
 viewCFG - This function is meant for use from the debugger.
void viewCFGOnly () const
 viewCFGOnly - This function is meant for use from the debugger.
void dropAllReferences ()
 dropAllReferences() - This method causes all the subinstructions to "let go" of all references that they are maintaining.
bool hasAddressTaken (const User **=nullptr) const
 hasAddressTaken - returns true if there are any uses of this function other than direct calls or invokes to it, or blockaddress expressions.
bool 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).
bool callsFunctionThatReturnsTwice () const
 callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function that gcc recognizes as "returning twice".
bool hasMetadata () const
 Check if this has any metadata.
void getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const
 Get all current metadata attachments.
void dropUnknownMetadata (ArrayRef< unsigned > KnownIDs)
 Drop metadata not in the given list.
Function Argument Iteration
arg_iterator arg_begin ()
const_arg_iterator arg_begin () const
arg_iterator arg_end ()
const_arg_iterator arg_end () const
iterator_range< arg_iteratorargs ()
iterator_range
< const_arg_iterator
args () const
MDNodegetMetadata (unsigned KindID) const
 Get the current metadata attachment, if any.
MDNodegetMetadata (StringRef Kind) const
void setMetadata (unsigned KindID, MDNode *MD)
 Set a particular kind of metadata attachment.
void setMetadata (StringRef Kind, MDNode *MD)

Static Public Member Functions

static FunctionCreate (FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)
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:

Friends

class SymbolTableListTraits< Function, Module >

Detailed Description

Definition at line 52 of file Function.h.


Member Typedef Documentation

Definition at line 61 of file Function.h.

Definition at line 54 of file Function.h.

Definition at line 55 of file Function.h.

Definition at line 62 of file Function.h.

Definition at line 59 of file Function.h.

Definition at line 58 of file Function.h.


Constructor & Destructor Documentation

Function::~Function ( ) [override]

Member Function Documentation

adds the attribute to the list of attributes.

Definition at line 338 of file Function.cpp.

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

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

adds the attributes to the list of attributes.

Definition at line 344 of file Function.cpp.

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

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

void Function::addDereferenceableAttr ( unsigned  i,
uint64_t  Bytes 
)

adds the dereferenceable attribute to the list of attributes.

Definition at line 356 of file Function.cpp.

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

void Function::addDereferenceableOrNullAttr ( unsigned  i,
uint64_t  Bytes 
)

adds the dereferenceable_or_null attribute to the list of attributes.

Definition at line 362 of file Function.cpp.

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

void llvm::Function::addFnAttr ( StringRef  Kind) [inline]

Add function attributes to this function.

Definition at line 187 of file Function.h.

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

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

Definition at line 444 of file Function.h.

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

Definition at line 303 of file Function.cpp.

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

Definition at line 452 of file Function.h.

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

size_t Function::arg_size ( ) const

Definition at line 457 of file Function.h.

References arg_begin(), and arg_end().

Referenced by buildSetsFrom(), llvm::CloneFunctionInto(), INITIALIZE_PASS(), and llvm::orc::makeStub().

Definition at line 461 of file Function.h.

References arg_begin(), and arg_end().

const BasicBlock& llvm::Function::back ( ) const [inline]

Definition at line 434 of file Function.h.

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

Referenced by llvm::InlineFunction().

Definition at line 435 of file Function.h.

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

Definition at line 426 of file Function.h.

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

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

Definition at line 893 of file Function.cpp.

References llvm::CS, llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::hasFnAttr(), I, llvm::inst_begin(), llvm::inst_end(), and llvm::Attribute::ReturnsTwice.

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

Determine if the call cannot be duplicated.

Definition at line 303 of file Function.h.

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

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

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

Reimplemented from llvm::GlobalObject.

Definition at line 504 of file Function.h.

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

Definition at line 396 of file Function.cpp.

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

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

void Function::copyAttributesFrom ( const GlobalValue Src) [override, virtual]

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

Reimplemented from llvm::GlobalObject.

Definition at line 413 of file Function.cpp.

References clearGC(), getAttributes(), getCallingConv(), getGC(), getPrefixData(), getPrologueData(), hasGC(), hasPrefixData(), hasPrologueData(), setAttributes(), setCallingConv(), setGC(), setPrefixData(), and setPrologueData().

Referenced by llvm::orc::cloneFunctionDecl(), llvm::CloneFunctionInto(), and llvm::CloneModule().

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

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

Definition at line 373 of file Function.h.

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

Referenced by llvm::orc::moveFunctionBody().

Determine if the function does not access memory.

Definition at line 266 of file Function.h.

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

Referenced by onlyReadsMemory().

Definition at line 351 of file Function.h.

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

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 335 of file Function.h.

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

Determine if the parameter can be captured.

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

Definition at line 344 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 285 of file Function.h.

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

bool llvm::Function::doesNotThrow ( ) const [inline]

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.

Reimplemented from llvm::User.

Definition at line 319 of file Function.cpp.

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

Referenced by deleteBody(), llvm::Module::dropAllReferences(), and ~Function().

bool llvm::Function::empty ( ) const [inline]
const_iterator llvm::Function::end ( ) const [inline]

Definition at line 428 of file Function.h.

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

void Function::eraseFromParent ( ) [override, virtual]

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

Implements llvm::GlobalValue.

Definition at line 243 of file Function.cpp.

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

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

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

Definition at line 433 of file Function.h.

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

void Function::getAllMetadata ( SmallVectorImpl< std::pair< unsigned, MDNode * >> &  MDs) const

Get all current metadata attachments.

Definition at line 1201 of file Metadata.cpp.

References llvm::LLVMContextImpl::FunctionMetadata, getContext(), hasMetadata(), and llvm::LLVMContext::pImpl.

Referenced by WriteMetadataAttachment().

Get the underlying elements of the Function...

the basic block list is empty for external functions.

Definition at line 392 of file Function.h.

Referenced by llvm::Argument::Argument(), and needsFPFromSig().

Definition at line 396 of file Function.h.

Definition at line 405 of file Function.h.

getContext - Return a reference to the LLVMContext associated with this function.

Reimplemented from llvm::Value.

Definition at line 225 of file Function.cpp.

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

Referenced by AddAliasScopeMetadata(), llvm::Argument::addAttr(), addAttribute(), addAttributes(), addDereferenceableAttr(), addDereferenceableOrNullAttr(), addFnAttr(), AdjustCallerSSPLevel(), llvm::ARMFrameLowering::adjustForSegmentedStacks(), checkStringCopyLibFuncSignature(), CloneAliasScopeMetadata(), llvm::CloneFunctionInto(), combineInstructionsOverFunction(), createFPFnStub(), createStubLandingPad(), dropUnknownMetadata(), duplicateCPV(), llvm::SIRegisterInfo::eliminateFrameIndex(), llvm::LoopAccessReport::emitAnalysis(), emitAnalysis(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), emitThumb1LoadConstPool(), emitThumb2LoadConstPool(), llvm::FastISel::fastEmit_ri_(), fixupLineNumbers(), llvm::BlockAddress::get(), getAllMetadata(), llvm::ScalarEvolution::getContext(), getMetadata(), getPrefixData(), getPrologueData(), llvm::SelectionDAG::init(), INITIALIZE_PASS(), insertFastDiv(), llvm::isFreeCall(), LLVMAddFunctionAttr(), LLVMAddTargetDependentFunctionAttr(), LLVMRemoveFunctionAttr(), llvm::XCoreInstrInfo::loadImmediate(), llvm::SIInstrInfo::loadRegFromStackSlot(), llvm::BlockAddress::lookup(), llvm::AMDGPUMCInstLower::lower(), llvm::NVPTXTargetLowering::LowerCall(), llvm::NVPTXTargetLowering::LowerFormalArguments(), llvm::NVPTXTargetLowering::LowerReturn(), llvm::overrideFunctionAttribute(), llvm::Argument::removeAttr(), removeAttributes(), removeFnAttr(), RemoveNestAttribute(), removeUseSoftFloat(), llvm::legacy::FunctionPassManagerImpl::run(), llvm::ExecutionEngine::runFunctionAsMain(), llvm::UnifyFunctionExitNodes::runOnFunction(), llvm::LPPassManager::runOnFunction(), llvm::Inliner::runOnSCC(), llvm::FastISel::selectExtractValue(), llvm::FunctionLoweringInfo::set(), setEntryCount(), setMetadata(), setPrefixData(), setPrologueData(), llvm::SIInstrInfo::storeRegToStackSlot(), llvm::UnrollLoop(), llvm::UpgradeIntrinsicFunction(), UpgradeIntrinsicFunction1(), and UpgradeSSE41Function().

uint64_t llvm::Function::getDereferenceableBytes ( unsigned  i) const [inline]

Extract the number of dereferenceable bytes for a call or parameter (0=unknown).

Definition at line 255 of file Function.h.

References llvm::AttributeSet::getDereferenceableBytes().

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

Extract the number of dereferenceable_or_null bytes for a call or parameter (0=unknown).

Definition at line 261 of file Function.h.

References llvm::AttributeSet::getDereferenceableOrNullBytes().

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

Definition at line 411 of file Function.h.

References front().

Optional< uint64_t > Function::getEntryCount ( ) const

Return the stack alignment for the function.

Definition at line 221 of file Function.h.

References llvm::AttributeSet::FunctionIndex, and llvm::AttributeSet::getStackAlignment().

Referenced by llvm::MachineFunction::MachineFunction().

const char * Function::getGC ( ) 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.

Definition at line 147 of file Function.h.

References llvm::GlobalValue::IntID.

Referenced by llvm::canConstantFoldCallTo(), computeKnownBitsFromAssume(), llvm::ConstantFoldCall(), llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getCallCost(), llvm::IntrinsicInst::getIntrinsicID(), handleBranchExpect(), handleSwitchExpect(), llvm::InlineCostAnalysis::isInlineViable(), llvm::isStatepoint(), lowerExpectIntrinsic(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::FastISel::selectInstruction(), SimplifyIntrinsic(), llvm::UpgradeIntrinsicCall(), llvm::UpgradeIntrinsicFunction(), and llvm::Interpreter::visitCallSite().

MDNode * Function::getMetadata ( unsigned  KindID) const

Get the current metadata attachment, if any.

Returns nullptr if such an attachment is missing.

Definition at line 1164 of file Metadata.cpp.

References llvm::LLVMContextImpl::FunctionMetadata, getContext(), hasMetadata(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::lookup(), and llvm::LLVMContext::pImpl.

Referenced by getEntryCount(), and getMetadata().

Definition at line 1170 of file Metadata.cpp.

References getContext(), getMetadata(), and hasMetadata().

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

Definition at line 249 of file Function.h.

References llvm::AttributeSet::getParamAlignment().

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

static iplist<Argument> Function::* llvm::Function::getSublistAccess ( Argument ) [inline, static]

Definition at line 400 of file Function.h.

static iplist<BasicBlock> Function::* llvm::Function::getSublistAccess ( BasicBlock ) [inline, static]

Definition at line 406 of file Function.h.

getSymbolTable() - Return the symbol table...

Definition at line 418 of file Function.h.

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

Definition at line 419 of file Function.h.

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

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

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

Optionally passes back an offending user for diagnostic purposes.

Definition at line 863 of file Function.cpp.

References llvm::CS, and llvm::Value::uses().

Return true if the function has the attribute.

Definition at line 205 of file Function.h.

References llvm::AttributeSet::FunctionIndex, and llvm::AttributeSet::hasAttribute().

Referenced by AdjustCallerSSPLevel(), llvm::NVPTXTargetLowering::allowFMA(), llvm::AArch64RegisterInfo::canRealignStack(), llvm::ARMBaseRegisterInfo::canRealignStack(), llvm::PPCRegisterInfo::canRealignStack(), llvm::AArch64FrameLowering::canUseRedZone(), checkNumAlignedDPRCS2Regs(), combineInstructionsOverFunction(), llvm::PPCFrameLowering::determineFrameLayout(), llvm::TargetOptions::DisableFramePointerElim(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::MipsAsmPrinter::EmitFunctionBodyStart(), llvm::X86FrameLowering::emitPrologue(), ExpandPowI(), get64BitArgumentXMMs(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), llvm::InlineCostAnalysis::getInlineCost(), llvm::Inliner::getInlineThreshold(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), getMemcpyLoadsAndStores(), getMemmoveLoadsAndStores(), getMemsetStores(), llvm::ARMBaseInstrInfo::getOperandLatency(), llvm::MipsTargetLowering::getOpndList(), llvm::ARMTargetLowering::getOptimalMemOpType(), llvm::AArch64TargetLowering::getOptimalMemOpType(), llvm::PPCTargetLowering::getOptimalMemOpType(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::MipsCCState::getSpecialCallingConvForCallee(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), hasReturnsTwiceAttr(), llvm::InlineCostAnalysis::isInlineViable(), llvm::ARMBaseInstrInfo::isProfitableToIfCvt(), llvm::ReductionDescriptor::isReductionPHI(), llvm::isSafeToSpeculativelyExecute(), LowerVectorBroadcast(), llvm::MachineFunction::MachineFunction(), llvm::PPCFrameLowering::needsFP(), llvm::ARMBaseRegisterInfo::needsStackRealignment(), llvm::PPCRegisterInfo::needsStackRealignment(), llvm::LibCallSimplifier::optimizeCall(), PerformOrCombine(), performSTORECombine(), PerformSTORECombine(), ProfitableToMerge(), llvm::Inliner::removeDeadFunctions(), removeUseSoftFloat(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::MachineFunction::shouldSplitStack(), llvm::LoopPass::skipOptnoneFunction(), llvm::FunctionPass::skipOptnoneFunction(), llvm::BasicBlockPass::skipOptnoneFunction(), llvm::tryFoldSPUpdateIntoPushPop(), llvm::ARMSubtarget::useMovt(), and WindowsRequiresStackProbe().

bool llvm::Function::hasFnAttribute ( StringRef  Kind) const [inline]
bool Function::hasGC ( ) const

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

Definition at line 376 of file Function.cpp.

References GCLock, and GCNames.

Referenced by copyAttributesFrom(), llvm::GCModuleInfo::getFunctionInfo(), getGC(), llvm::InlineFunction(), LLVMGetGC(), llvm::SelectionDAGISel::runOnMachineFunction(), shouldRewriteFunction(), and shouldRewriteStatepointsIn().

bool llvm::Function::hasMetadata ( ) const [inline]

Check if this has any metadata.

Definition at line 539 of file Function.h.

Referenced by dropUnknownMetadata(), getAllMetadata(), getMetadata(), setMetadata(), and WriteFunction().

bool llvm::Function::hasPrefixData ( ) const [inline]

Definition at line 470 of file Function.h.

References llvm::Value::getSubclassDataFromValue().

Referenced by copyAttributesFrom(), getPrefixData(), and setPrefixData().

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 313 of file Function.h.

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

Referenced by needsUnwindTableEntry().

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 877 of file Function.cpp.

References llvm::GlobalValue::hasAvailableExternallyLinkage(), llvm::GlobalValue::hasLinkOnceLinkage(), llvm::GlobalValue::hasLocalLinkage(), and llvm::Value::users().

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

bool llvm::Function::isIntrinsic ( ) const [inline]

If this function's Module is being lazily streamed in functions from disk or some other source, this method can be used to check to see if the function has been read in yet or not.

Reimplemented from llvm::GlobalValue.

Definition at line 217 of file Function.cpp.

References llvm::GlobalObject::getGlobalObjectSubClassData().

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

Definition at line 275 of file Function.h.

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

Referenced by HandleByValArgument().

void Function::print ( raw_ostream OS,
AssemblyAnnotationWriter AAW = nullptr 
) const

Print the function to an output stream with an optional AssemblyAnnotationWriter.

Definition at line 3099 of file AsmWriter.cpp.

References llvm::GlobalValue::getParent().

Recalculate the ID for this function if it is an Intrinsic defined in llvm/Intrinsics.h.

Sets the intrinsic ID to Intrinsic::not_intrinsic if the name of this function does not match an intrinsic in that header. Note, this method does not need to be called directly, as it is called from Value::setName() whenever the name of this function changes.

Definition at line 446 of file Function.cpp.

References llvm::Value::getValueName(), llvm::GlobalValue::IntID, isIntrinsic(), lookupIntrinsicID(), and llvm::Intrinsic::not_intrinsic.

removes the attributes from the list of attributes.

Definition at line 350 of file Function.cpp.

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

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

Remove function attributes from this function.

Definition at line 181 of file Function.h.

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

void Function::removeFromParent ( ) [override, virtual]

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

Implements llvm::GlobalValue.

Definition at line 239 of file Function.cpp.

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

void llvm::Function::setAttributes ( AttributeSet  attrs) [inline]

Definition at line 163 of file Function.h.

References llvm::Value::getSubclassDataFromValue().

Referenced by copyAttributesFrom().

Definition at line 307 of file Function.h.

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

Definition at line 270 of file Function.h.

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

Definition at line 354 of file Function.h.

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

Definition at line 338 of file Function.h.

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

Definition at line 347 of file Function.h.

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

Definition at line 289 of file Function.h.

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

Definition at line 298 of file Function.h.

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

void Function::setEntryCount ( uint64_t  Count)

Set the entry count for this function.

Definition at line 975 of file Function.cpp.

References llvm::MDBuilder::createFunctionEntryCount(), getContext(), llvm::LLVMContext::MD_prof, and setMetadata().

void Function::setGC ( const char *  Str)

Definition at line 387 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 317 of file Function.h.

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

Definition at line 221 of file Function.cpp.

Referenced by dropAllReferences().

void Function::setMetadata ( unsigned  KindID,
MDNode MD 
)

Set a particular kind of metadata attachment.

Sets the given attachment to MD, erasing it if MD is nullptr or replacing it if it already exists.

Definition at line 1176 of file Metadata.cpp.

References llvm::LLVMContextImpl::FunctionMetadata, getContext(), hasMetadata(), llvm::LLVMContext::pImpl, and llvm::SPII::Store.

Referenced by setEntryCount(), and setMetadata().

void Function::setMetadata ( StringRef  Kind,
MDNode MD 
)

Definition at line 1195 of file Metadata.cpp.

References getContext(), hasMetadata(), and setMetadata().

Definition at line 280 of file Function.h.

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

Definition at line 362 of file Function.h.

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

void Function::setPrefixData ( Constant PrefixData)
void Function::setPrologueData ( Constant PrologueData)
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 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.

Definition at line 154 of file CFGPrinter.cpp.

References llvm::Value::getName(), and llvm::ViewGraph().

Referenced by LLVMViewFunctionCFGOnly().


Friends And Related Function Documentation

friend class SymbolTableListTraits< Function, Module > [friend]

Definition at line 92 of file Function.h.


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