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 SymbolTableList< ArgumentArgumentListType
typedef SymbolTableList
< BasicBlock
BasicBlockListType
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
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Provide fast operand accessors.
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 std::string & getGC () const
void setGC (const std::string 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 onlyAccessesArgMemory () const
 Determine if the call can access memmory only using pointers based on its arguments.
void setOnlyAccessesArgMemory ()
bool onlyAccessesInaccessibleMemory () const
 Determine if the function may only access memory that is inaccessible from the IR.
void setOnlyAccessesInaccessibleMemory ()
bool onlyAccessesInaccessibleMemOrArgMem () const
 Determine if the function may only access memory that is.
void setOnlyAccessesInaccessibleMemOrArgMem ()
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 isConvergent () const
 Determine if the call is convergent.
void setConvergent ()
bool doesNotRecurse () const
 Determine if the function is known not to recurse, directly or indirectly.
void setDoesNotRecurse ()
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 or return value is marked with NoAlias attribute.
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)
bool optForMinSize () const
 Optimize this function for minimum size (-Oz).
bool optForSize () const
 Optimize this function for size (-Os) or minimum size (-Oz).
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 hasPersonalityFn () const
 Check whether this function has a personality function.
ConstantgetPersonalityFn () const
 Get the personality function associated with this function.
void setPersonalityFn (Constant *Fn)
bool hasPrefixData () const
 Check whether this function has prefix data.
ConstantgetPrefixData () const
 Get the prefix data associated with this function.
void setPrefixData (Constant *PrefixData)
bool hasPrologueData () const
 Check whether this function has prologue data.
ConstantgetPrologueData () const
 Get the prologue data associated with this function.
void setPrologueData (Constant *PrologueData)
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.
void setSubprogram (DISubprogram *SP)
 Set the attached subprogram.
DISubprogramgetSubprogram () const
 Get the attached subprogram.
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 ArgumentListType Function::* getSublistAccess (Argument *)
static BasicBlockListType
Function::* 
getSublistAccess (BasicBlock *)
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast:

Friends

class SymbolTableListTraits< Function >

Detailed Description

Definition at line 41 of file Function.h.


Member Typedef Documentation

Definition at line 50 of file Function.h.

Definition at line 43 of file Function.h.

Definition at line 44 of file Function.h.

Definition at line 51 of file Function.h.

Definition at line 48 of file Function.h.

Definition at line 47 of file Function.h.


Constructor & Destructor Documentation

Function::~Function ( ) [override]

Member Function Documentation

adds the attributes to the list of attributes.

Definition at line 346 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 358 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 364 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 183 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 496 of file Function.h.

References llvm::codeview::ArgumentList.

Definition at line 302 of file Function.cpp.

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

Definition at line 504 of file Function.h.

References llvm::codeview::ArgumentList.

size_t Function::arg_size ( ) const

Definition at line 513 of file Function.h.

References arg_begin(), arg_end(), and llvm::make_range().

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

Definition at line 486 of file Function.h.

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

Definition at line 487 of file Function.h.

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

Definition at line 478 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 949 of file Function.cpp.

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

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

Determine if the call cannot be duplicated.

Definition at line 329 of file Function.h.

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

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

References llvm::Value::getValueID().

Definition at line 380 of file Function.cpp.

References llvm::LLVMContext::deleteGC(), getContext(), and hasGC().

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.

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

References clearGC(), llvm::dyn_cast(), getAttributes(), getCallingConv(), getGC(), getPersonalityFn(), getPrefixData(), getPrologueData(), hasGC(), hasPersonalityFn(), hasPrefixData(), hasPrologueData(), setAttributes(), setCallingConv(), setGC(), setPersonalityFn(), 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]

Provide fast operand accessors.

void llvm::Function::deleteBody ( ) [inline]

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

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

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

Referenced by llvm::BasicAAResult::getModRefBehavior(), onlyReadsMemory(), and setDoesNotAccessMemory().

Definition at line 397 of file Function.h.

References llvm::AttributeSet::hasAttribute().

Determine if the parameter or return value is marked with NoAlias attribute.

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

Definition at line 381 of file Function.h.

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

Referenced by addNoAliasAttrs(), and setDoesNotAlias().

Determine if the parameter can be captured.

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

Definition at line 390 of file Function.h.

References llvm::AttributeSet::hasAttribute().

Referenced by setDoesNotCapture().

Determine if the function is known not to recurse, directly or indirectly.

Definition at line 348 of file Function.h.

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

Referenced by addNoRecurseAttrs(), addNoRecurseAttrsTopDown(), and setDoesNotRecurse().

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

Determine if the function cannot return.

Definition at line 311 of file Function.h.

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

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

References llvm::iplist< NodeTy, Traits >::begin(), begin(), E, llvm::iplist< NodeTy, Traits >::empty(), end(), llvm::User::getNumOperands(), llvm::Value::getSubclassDataFromValue(), I, setIsMaterializable(), and llvm::User::setNumHungOffUseOperands().

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

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

Definition at line 480 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(), llvm::ilist_node< Function >::getIterator(), and llvm::GlobalValue::getParent().

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

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

Definition at line 485 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 1277 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 445 of file Function.h.

References llvm::codeview::ArgumentList.

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

Definition at line 449 of file Function.h.

References llvm::codeview::ArgumentList.

Definition at line 458 of file Function.h.

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

Reimplemented from llvm::Value.

Definition at line 223 of file Function.cpp.

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

Referenced by AddAliasScopeMetadata(), addArgumentAttrs(), llvm::Argument::addAttr(), addAttribute(), addAttributes(), addDereferenceableAttr(), addDereferenceableOrNullAttr(), addFnAttr(), adjustCallerSSPLevel(), llvm::ARMFrameLowering::adjustForSegmentedStacks(), checkStringCopyLibFuncSignature(), clearGC(), CloneAliasScopeMetadata(), llvm::CloneFunctionInto(), combineInstructionsOverFunction(), ComputeLegalValueVTs(), createFPFnStub(), dropUnknownMetadata(), duplicateCPV(), llvm::LoopAccessReport::emitAnalysis(), emitAnalysis(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), emitThumb1LoadConstPool(), emitThumb2LoadConstPool(), llvm::expandAtomicRMWToCmpXchg(), llvm::FastISel::fastEmit_ri_(), fixupLineNumbers(), llvm::BlockAddress::get(), getAllMetadata(), llvm::ScalarEvolution::getContext(), getGC(), llvm::AMDGPU::getIntegerAttribute(), getMetadata(), llvm::SIMachineFunctionInfo::getSpilledReg(), HandleInlinedEHPad(), 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::LowerReturn(), llvm::Argument::removeAttr(), removeAttributes(), removeFnAttr(), RemoveNestAttribute(), removeUseSoftFloat(), llvm::legacy::FunctionPassManagerImpl::run(), llvm::ExecutionEngine::runFunctionAsMain(), llvm::LPPassManager::runOnFunction(), llvm::Inliner::runOnSCC(), llvm::FastISel::selectExtractValue(), llvm::FunctionLoweringInfo::set(), setEntryCount(), setGC(), setMetadata(), llvm::SIInstrInfo::storeRegToStackSlot(), tryToUnrollLoop(), 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 253 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 259 of file Function.h.

References llvm::AttributeSet::getDereferenceableOrNullBytes().

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

Definition at line 464 of file Function.h.

References front().

Optional< uint64_t > Function::getEntryCount ( ) const

Return the stack alignment for the function.

Definition at line 217 of file Function.h.

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

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

const std::string & 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 141 of file Function.h.

References llvm::GlobalValue::IntID.

Referenced by llvm::CallGraphNode::addCalledFunction(), llvm::canConstantFoldCallTo(), computeKnownBitsFromAssume(), llvm::ConstantFoldCall(), llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getCallCost(), llvm::IntrinsicInst::getIntrinsicID(), handleBranchExpect(), handleSwitchExpect(), llvm::isInlineViable(), llvm::isStatepoint(), lowerExpectIntrinsic(), llvm::IntrinsicLowering::LowerIntrinsicCall(), optimizeUnaryDoubleFP(), 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 1240 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(), getMetadata(), and getSubprogram().

Definition at line 1246 of file Metadata.cpp.

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

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

Definition at line 247 of file Function.h.

References llvm::AttributeSet::getParamAlignment().

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

Get the prefix data associated with this function.

Definition at line 970 of file Function.cpp.

References llvm::User::getNumOperands(), and hasPrefixData().

Referenced by copyAttributesFrom().

Get the prologue data associated with this function.

Definition at line 980 of file Function.cpp.

References llvm::User::getNumOperands(), and hasPrologueData().

Referenced by copyAttributesFrom().

static ArgumentListType Function::* llvm::Function::getSublistAccess ( Argument ) [inline, static]

Definition at line 453 of file Function.h.

References llvm::codeview::ArgumentList.

static BasicBlockListType Function::* llvm::Function::getSublistAccess ( BasicBlock ) [inline, static]

Definition at line 459 of file Function.h.

Get the attached subprogram.

Calls getMetadata() with LLVMContext::MD_dbg and casts the result to DISubprogram.

Definition at line 1320 of file Metadata.cpp.

References getMetadata().

Referenced by llvm::DwarfDebug::beginFunction(), llvm::DwarfDebug::endFunction(), and llvm::stripDebugInfo().

getSymbolTable() - Return the symbol table...

Definition at line 471 of file Function.h.

Referenced by llvm::MIRParserImpl::initializeFrameInfo(), and WriteFunction().

Definition at line 472 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 919 of file Function.cpp.

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

Referenced by shouldRecordFunctionAddr().

Return true if the function has the attribute.

Definition at line 201 of file Function.h.

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

Referenced by addForcedAttributes(), adjustCallerSSPLevel(), llvm::NVPTXTargetLowering::allowFMA(), llvm::TargetRegisterInfo::canRealignStack(), llvm::AArch64FrameLowering::canUseRedZone(), checkNumAlignedDPRCS2Regs(), llvm::TargetFrameLowering::determineCalleeSaves(), llvm::PPCFrameLowering::determineFrameLayout(), llvm::TargetOptions::DisableFramePointerElim(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::MipsSEFrameLowering::emitEpilogue(), llvm::MipsAsmPrinter::EmitFunctionBodyStart(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::X86FrameLowering::enableShrinkWrapping(), get64BitArgumentXMMs(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), llvm::getInlineCost(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), llvm::ARMBaseInstrInfo::getOperandLatency(), llvm::MipsTargetLowering::getOpndList(), llvm::ARMTargetLowering::getOptimalMemOpType(), llvm::AArch64TargetLowering::getOptimalMemOpType(), llvm::PPCTargetLowering::getOptimalMemOpType(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::MipsCCState::getSpecialCallingConvForCallee(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), hasReturnsTwiceAttr(), inferPrototypeAttributes(), llvm::AArch64TargetLowering::insertCopiesSplitCSR(), llvm::isInlineViable(), isNoReturnDef(), llvm::RecurrenceDescriptor::isReductionPHI(), llvm::isSafeToSpeculativelyExecute(), llvm::MipsSEInstrInfo::loadRegFromStack(), llvm::MachineFunction::MachineFunction(), llvm::PPCFrameLowering::needsFP(), llvm::TargetRegisterInfo::needsStackRealignment(), optForMinSize(), optForSize(), PerformSTORECombine(), llvm::Inliner::removeDeadFunctions(), removeUseSoftFloat(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::ARMAsmPrinter::runOnMachineFunction(), llvm::MachineFunction::shouldSplitStack(), llvm::LoopPass::skipOptnoneFunction(), llvm::FunctionPass::skipOptnoneFunction(), llvm::BasicBlockPass::skipOptnoneFunction(), llvm::MipsSEFrameLowering::spillCalleeSavedRegisters(), llvm::MipsSEInstrInfo::storeRegToStack(), llvm::AArch64TargetLowering::supportSplitCSR(), and WindowsRequiresStackProbe().

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

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

Definition at line 223 of file Function.h.

References llvm::Value::getSubclassDataFromValue().

Referenced by clearGC(), 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 600 of file Function.h.

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

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

Check whether this function has prefix data.

Definition at line 532 of file Function.h.

References llvm::Value::getSubclassDataFromValue().

Referenced by copyAttributesFrom(), and getPrefixData().

Check whether this function has prologue data.

Definition at line 541 of file Function.h.

References llvm::Value::getSubclassDataFromValue().

Referenced by copyAttributesFrom(), and getPrologueData().

Determine if the function returns a structure through first pointer argument.

Definition at line 373 of file Function.h.

References llvm::AttributeSet::hasAttribute().

Referenced by llvm::Mangler::getNameWithPrefix(), llvm::HexagonTargetLowering::LowerCall(), llvm::SparcTargetLowering::LowerFormalArguments_32(), and llvm::SparcTargetLowering::LowerReturn_32().

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

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

Referenced by needsUnwindTableEntry().

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

Determine if the call is convergent.

Definition at line 338 of file Function.h.

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

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

References llvm::GlobalObject::getGlobalObjectSubClassData().

Determine if the call can access memmory only using pointers based on its arguments.

Definition at line 284 of file Function.h.

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

Referenced by llvm::BasicAAResult::getModRefBehavior(), and setOnlyAccessesArgMemory().

Determine if the function may only access memory that is.

Definition at line 302 of file Function.h.

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

Determine if the function may only access memory that is inaccessible from the IR.

Definition at line 292 of file Function.h.

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

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

Definition at line 273 of file Function.h.

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

Referenced by addArgumentAttrs(), llvm::BasicAAResult::getModRefBehavior(), HandleByValArgument(), and setOnlyReadsMemory().

Definition at line 404 of file Function.h.

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

bool llvm::Function::optForMinSize ( ) const [inline]
bool llvm::Function::optForSize ( ) const [inline]

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 474 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 352 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 177 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::ilist_node< Function >::getIterator(), llvm::GlobalValue::getParent(), and llvm::iplist< NodeTy, Traits >::remove().

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

Definition at line 158 of file Function.h.

References llvm::Value::getSubclassDataFromValue(), and llvm::CallingConv::MaxID.

Referenced by copyAttributesFrom().

Definition at line 333 of file Function.h.

References addFnAttr().

void llvm::Function::setConvergent ( ) [inline]

Definition at line 342 of file Function.h.

References addFnAttr(), and llvm::MCID::Convergent.

Definition at line 268 of file Function.h.

References addFnAttr().

Referenced by setDoesNotAccessMemory().

Definition at line 400 of file Function.h.

References addAttribute().

Definition at line 384 of file Function.h.

References addAttribute(), and llvm::NoAlias.

Referenced by addNoAliasAttrs(), and setDoesNotAlias().

Definition at line 393 of file Function.h.

References addAttribute().

Referenced by setDoesNotCapture().

Definition at line 352 of file Function.h.

References addFnAttr().

Referenced by setDoesNotRecurse().

Definition at line 315 of file Function.h.

References addFnAttr().

Definition at line 324 of file Function.h.

References addFnAttr().

Referenced by setDoesNotThrow().

void Function::setEntryCount ( uint64_t  Count)

Set the entry count for this function.

Definition at line 1024 of file Function.cpp.

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

void Function::setGC ( const std::string  Str)

Definition at line 375 of file Function.cpp.

References getContext(), and llvm::LLVMContext::setGC().

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

void llvm::Function::setHasUWTable ( ) [inline]

Definition at line 362 of file Function.h.

References addFnAttr().

Definition at line 219 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 1252 of file Metadata.cpp.

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

Referenced by setEntryCount(), setMetadata(), and setSubprogram().

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

Definition at line 1271 of file Metadata.cpp.

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

Definition at line 288 of file Function.h.

References addFnAttr().

Referenced by setOnlyAccessesArgMemory().

Definition at line 306 of file Function.h.

References addFnAttr().

Definition at line 296 of file Function.h.

References addFnAttr().

Definition at line 278 of file Function.h.

References addFnAttr().

Referenced by setOnlyReadsMemory().

Definition at line 408 of file Function.h.

References addAttribute().

void Function::setPrefixData ( Constant PrefixData)

Definition at line 975 of file Function.cpp.

Referenced by copyAttributesFrom().

void Function::setPrologueData ( Constant PrologueData)

Definition at line 985 of file Function.cpp.

Referenced by copyAttributesFrom().

Set the attached subprogram.

Calls setMetadata() with LLVMContext::MD_dbg.

Definition at line 1316 of file Metadata.cpp.

References setMetadata().

Referenced by CloneDebugInfoMetadata(), and llvm::stripDebugInfo().

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 > [friend]

Definition at line 83 of file Function.h.


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