class Function

Declaration

class Function : public GlobalObject, public ilist_node { /* full declaration omitted */ };

Description

This is an important base class in LLVM. It provides the common facilities of all constant values in an LLVM program. A constant is a value that is immutable at runtime. Functions are constants because their address is immutable. Same with global variables. All constants share the capabilities provided in this class. All constants can have a null value. They can have an operand list. Constants can be simple (integer and floating point values), complex (arrays and structures), or expression based (computations yielding a constant value composed of only certain operators and other constant values). Note that Constants are immutable (once created they never change) and are fully shared by structural equivalence. This means that two structurally equivalent constants will always have the same address. Constants are created on demand as needed and never deleted: thus clients don't have to worry about the lifetime of the objects. LLVM Constant Representation

Declared at: llvm/include/llvm/IR/Function.h:60

Inherits from: GlobalObject, ilist_node

Member Variables

private llvm::Function::BasicBlockListType BasicBlocks
The basic blocks
private llvm::Argument* Arguments = nullptr
The formal arguments
private size_t NumArgs
private std::unique_ptr<ValueSymbolTable> SymTab
Symbol table of args/instructions
private llvm::AttributeList AttributeSets
Parameter attributes

Inherited from GlobalObject:

protected ObjComdat = nullptr
protected static GlobalObjectSubClassDataBits = GlobalValueSubClassDataBits - GlobalObjectBits

Inherited from GlobalValue:

protected ValueType
protected Linkage
protected Visibility
protected UnnamedAddrVal
protected DllStorageClass
protected ThreadLocal
protected HasLLVMReservedName
protected IsDSOLocal
protected HasPartition
protected HasSanitizerMetadata
protected IntID = (unsigned int)0U
protected Parent = nullptr
protected static GlobalValueSubClassDataBits = 15

Inherited from Value:

protected SubclassOptionalData
protected NumUserOperands
protected IsUsedByMD
protected HasName
protected HasMetadata
protected HasHungOffUses
protected HasDescriptor
public static MaxAlignmentExponent = 32
public static MaximumAlignment = 1ULL << MaxAlignmentExponent

Method Overview

Inherited from GlobalObject:

Inherited from GlobalValue:

Inherited from Constant:

Inherited from User:

Inherited from Value:

Methods

void BuildLazyArguments() const

Declared at: llvm/include/llvm/IR/Function.h:116

void CheckLazyArguments() const

Declared at: llvm/include/llvm/IR/Function.h:111

static llvm::Function* Create(
    llvm::FunctionType* Ty,
    llvm::GlobalValue::LinkageTypes Linkage,
    unsigned int AddrSpace,
    const llvm::Twine& N = "",
    llvm::Module* M = nullptr)

Declared at: llvm/include/llvm/IR/Function.h:137

Parameters

llvm::FunctionType* Ty
llvm::GlobalValue::LinkageTypes Linkage
unsigned int AddrSpace
const llvm::Twine& N = ""
llvm::Module* M = nullptr

static llvm::Function* Create(
    llvm::FunctionType* Ty,
    llvm::GlobalValue::LinkageTypes Linkage,
    const llvm::Twine& N = "",
    llvm::Module* M = nullptr)

Declared at: llvm/include/llvm/IR/Function.h:144

Parameters

llvm::FunctionType* Ty
llvm::GlobalValue::LinkageTypes Linkage
const llvm::Twine& N = ""
llvm::Module* M = nullptr

static llvm::Function* Create(
    llvm::FunctionType* Ty,
    llvm::GlobalValue::LinkageTypes Linkage,
    const llvm::Twine& N,
    llvm::Module& M)

Description

Creates a new function and attaches it to a module. Places the function in the program address space as specified by the module's data layout.

Declared at: llvm/include/llvm/IR/Function.h:153

Parameters

llvm::FunctionType* Ty
llvm::GlobalValue::LinkageTypes Linkage
const llvm::Twine& N
llvm::Module& M

Function(llvm::FunctionType* Ty,
         llvm::GlobalValue::LinkageTypes Linkage,
         unsigned int AddrSpace,
         const llvm::Twine& N = "",
         llvm::Module* M = nullptr)

Description

Function ctor - If the (optional) Module argument is specified, the function is automatically inserted into the end of the function list for the module.

Declared at: llvm/include/llvm/IR/Function.h:124

Parameters

llvm::FunctionType* Ty
llvm::GlobalValue::LinkageTypes Linkage
unsigned int AddrSpace
const llvm::Twine& N = ""
llvm::Module* M = nullptr

Function(const llvm::Function&)

Declared at: llvm/include/llvm/IR/Function.h:128

Parameters

const llvm::Function&

void addAttributeAtIndex(unsigned int i,
                         llvm::Attribute Attr)

Description

adds the attribute to the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:321

Parameters

unsigned int i
llvm::Attribute Attr

void addDereferenceableOrNullParamAttr(
    unsigned int ArgNo,
    uint64_t Bytes)

Description

adds the dereferenceable_or_null attribute to the list of attributes for the given arg.

Declared at: llvm/include/llvm/IR/Function.h:430

Parameters

unsigned int ArgNo
uint64_t Bytes

void addDereferenceableParamAttr(
    unsigned int ArgNo,
    uint64_t Bytes)

Description

adds the dereferenceable attribute to the list of attributes for the given arg.

Declared at: llvm/include/llvm/IR/Function.h:426

Parameters

unsigned int ArgNo
uint64_t Bytes

void addFnAttr(llvm::Attribute Attr)

Description

Add function attributes to this function.

Declared at: llvm/include/llvm/IR/Function.h:330

Parameters

llvm::Attribute Attr

void addFnAttr(
    llvm::StringRef Kind,
    llvm::StringRef Val = llvm::StringRef())

Description

Add function attributes to this function.

Declared at: llvm/include/llvm/IR/Function.h:327

Parameters

llvm::StringRef Kind
llvm::StringRef Val = llvm::StringRef()

void addFnAttr(Attribute::AttrKind Kind)

Description

Add function attributes to this function.

Declared at: llvm/include/llvm/IR/Function.h:324

Parameters

Attribute::AttrKind Kind

void addFnAttrs(const llvm::AttrBuilder& Attrs)

Description

Add function attributes to this function.

Declared at: llvm/include/llvm/IR/Function.h:333

Parameters

const llvm::AttrBuilder& Attrs

void addParamAttr(unsigned int ArgNo,
                  llvm::Attribute Attr)

Description

adds the attribute to the list of attributes for the given arg.

Declared at: llvm/include/llvm/IR/Function.h:348

Parameters

unsigned int ArgNo
llvm::Attribute Attr

void addParamAttr(unsigned int ArgNo,
                  Attribute::AttrKind Kind)

Description

adds the attribute to the list of attributes for the given arg.

Declared at: llvm/include/llvm/IR/Function.h:345

Parameters

unsigned int ArgNo
Attribute::AttrKind Kind

void addParamAttrs(unsigned int ArgNo,
                   const llvm::AttrBuilder& Attrs)

Description

adds the attributes to the list of attributes for the given arg.

Declared at: llvm/include/llvm/IR/Function.h:351

Parameters

unsigned int ArgNo
const llvm::AttrBuilder& Attrs

void addRetAttr(llvm::Attribute Attr)

Description

Add return value attributes to this function.

Declared at: llvm/include/llvm/IR/Function.h:339

Parameters

llvm::Attribute Attr

void addRetAttr(Attribute::AttrKind Kind)

Description

Add return value attributes to this function.

Declared at: llvm/include/llvm/IR/Function.h:336

Parameters

Attribute::AttrKind Kind

void addRetAttrs(const llvm::AttrBuilder& Attrs)

Description

Add return value attributes to this function.

Declared at: llvm/include/llvm/IR/Function.h:342

Parameters

const llvm::AttrBuilder& Attrs

void allocHungoffUselist()

Declared at: llvm/include/llvm/IR/Function.h:895

llvm::Function::const_arg_iterator arg_begin()
    const

Declared at: llvm/include/llvm/IR/Function.h:745

llvm::Function::arg_iterator arg_begin()

Description

@ {

Declared at: llvm/include/llvm/IR/Function.h:741

bool arg_empty() const

Declared at: llvm/include/llvm/IR/Function.h:775

llvm::Function::arg_iterator arg_end()

Declared at: llvm/include/llvm/IR/Function.h:750

llvm::Function::const_arg_iterator arg_end() const

Declared at: llvm/include/llvm/IR/Function.h:754

size_t arg_size() const

Description

@ }

Declared at: llvm/include/llvm/IR/Function.h:774

iterator_range<llvm::Function::arg_iterator>
args()

Declared at: llvm/include/llvm/IR/Function.h:765

iterator_range<llvm::Function::const_arg_iterator>
args() const

Declared at: llvm/include/llvm/IR/Function.h:768

const llvm::BasicBlock& back() const

Declared at: llvm/include/llvm/IR/Function.h:735

llvm::BasicBlock& back()

Declared at: llvm/include/llvm/IR/Function.h:736

llvm::Function::const_iterator begin() const

Declared at: llvm/include/llvm/IR/Function.h:727

llvm::Function::iterator begin()

Declared at: llvm/include/llvm/IR/Function.h:726

bool callsFunctionThatReturnsTwice() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:872

bool cannotDuplicate() const

Description

Determine if the call cannot be duplicated.

Declared at: llvm/include/llvm/IR/Function.h:563

static bool classof(const llvm::Value* V)

Description

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

Declared at: llvm/include/llvm/IR/Function.h:834

Parameters

const llvm::Value* V

void clearArguments()

Declared at: llvm/include/llvm/IR/Function.h:118

void clearGC()

Declared at: llvm/include/llvm/IR/Function.h:311

void copyAttributesFrom(const llvm::Function* Src)

Description

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

Declared at: llvm/include/llvm/IR/Function.h:674

Parameters

const llvm::Function* Src

static llvm::Function* createWithDefaultAttr(
    llvm::FunctionType* Ty,
    llvm::GlobalValue::LinkageTypes Linkage,
    unsigned int AddrSpace,
    const llvm::Twine& N = "",
    llvm::Module* M = nullptr)

Description

Creates a function with some attributes recorded in llvm.module.flags applied. Use this when synthesizing new functions that need attributes that would have been set by command line options.

Declared at: llvm/include/llvm/IR/Function.h:161

Parameters

llvm::FunctionType* Ty
llvm::GlobalValue::LinkageTypes Linkage
unsigned int AddrSpace
const llvm::Twine& N = ""
llvm::Module* M = nullptr

void deleteBody()

Description

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

Declared at: llvm/include/llvm/IR/Function.h:679

bool doesNoCfCheck() const

Description

Determine if the function should not perform indirect branch tracking.

Declared at: llvm/include/llvm/IR/Function.h:552

bool doesNotAccessMemory() const

Description

Determine if the function does not access memory.

Declared at: llvm/include/llvm/IR/Function.h:495

bool doesNotFreeMemory() const

Description

Determine if the call might deallocate memory.

Declared at: llvm/include/llvm/IR/Function.h:590

bool doesNotRecurse() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:607

bool doesNotReturn() const

Description

Determine if the function cannot return.

Declared at: llvm/include/llvm/IR/Function.h:544

bool doesNotThrow() const

Description

Determine if the function cannot unwind.

Declared at: llvm/include/llvm/IR/Function.h:555

void dropAllReferences()

Description

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.

Declared at: llvm/include/llvm/IR/Function.h:850

bool empty() const

Declared at: llvm/include/llvm/IR/Function.h:732

llvm::Function::const_iterator end() const

Declared at: llvm/include/llvm/IR/Function.h:729

llvm::Function::iterator end()

Declared at: llvm/include/llvm/IR/Function.h:728

void eraseFromParent()

Description

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

Declared at: llvm/include/llvm/IR/Function.h:692

llvm::BasicBlock& front()

Declared at: llvm/include/llvm/IR/Function.h:734

const llvm::BasicBlock& front() const

Declared at: llvm/include/llvm/IR/Function.h:733

llvm::Argument* getArg(unsigned int i) const

Declared at: llvm/include/llvm/IR/Function.h:759

Parameters

unsigned int i

llvm::Attribute getAttributeAtIndex(
    unsigned int i,
    Attribute::AttrKind Kind) const

Description

gets the attribute from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:398

Parameters

unsigned int i
Attribute::AttrKind Kind

llvm::Attribute getAttributeAtIndex(
    unsigned int i,
    llvm::StringRef Kind) const

Description

gets the attribute from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:401

Parameters

unsigned int i
llvm::StringRef Kind

llvm::AttributeList getAttributes() const

Description

Return the attribute list for this Function.

Declared at: llvm/include/llvm/IR/Function.h:314

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

Description

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

Declared at: llvm/include/llvm/IR/Function.h:703

llvm::Function::BasicBlockListType&
getBasicBlockList()

Declared at: llvm/include/llvm/IR/Function.h:704

CallingConv::ID getCallingConv() const

Description

getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this function. The enum values for the known calling conventions are defined in CallingConv.h.

Declared at: llvm/include/llvm/IR/Function.h:238

llvm::LLVMContext& getContext() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:184

llvm::DenormalMode getDenormalMode(
    const llvm::fltSemantics& FPType) const

Description

Returns the denormal handling type for the default rounding mode of the function.

Declared at: llvm/include/llvm/IR/Function.h:670

Parameters

const llvm::fltSemantics& FPType

llvm::BasicBlock& getEntryBlock()

Declared at: llvm/include/llvm/IR/Function.h:711

const llvm::BasicBlock& getEntryBlock() const

Declared at: llvm/include/llvm/IR/Function.h:710

Optional<llvm::Function::ProfileCount>
getEntryCount(bool AllowSynthetic = false) const

Description

Get the entry count for this function. Entry count is the number of times the function was executed. When AllowSynthetic is false, only pgo_data will be returned.

Declared at: llvm/include/llvm/IR/Function.h:283

Parameters

bool AllowSynthetic = false

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

Description

Return the attribute for the given attribute kind.

Declared at: llvm/include/llvm/IR/Function.h:404

Parameters

Attribute::AttrKind Kind

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

Description

Return the attribute for the given attribute kind.

Declared at: llvm/include/llvm/IR/Function.h:407

Parameters

llvm::StringRef Kind

llvm::MaybeAlign getFnStackAlign() const

Description

Return the stack alignment for the function.

Declared at: llvm/include/llvm/IR/Function.h:417

const llvm::Function& getFunction() const

Declared at: llvm/include/llvm/IR/Function.h:135

llvm::FunctionType* getFunctionType() const

Description

Returns the FunctionType for me.

Declared at: llvm/include/llvm/IR/Function.h:175

const std::string& getGC() const

Declared at: llvm/include/llvm/IR/Function.h:309

DenseSet<GlobalValue::GUID> getImportGUIDs() const

Description

Returns the set of GUIDs that needs to be imported to the function for sample PGO, to enable the same inlines as the profiled optimized binary.

Declared at: llvm/include/llvm/IR/Function.h:296

unsigned int getInstructionCount() const

Description

Returns the number of non-debug IR instructions in this function. This is equivalent to the sum of the sizes of each basic block contained within this function.

Declared at: llvm/include/llvm/IR/Function.h:172

Intrinsic::ID getIntrinsicID() const

Description

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.

Declared at: llvm/include/llvm/IR/Function.h:205

llvm::MaybeAlign getParamAlign(
    unsigned int ArgNo) const

Declared at: llvm/include/llvm/IR/Function.h:441

Parameters

unsigned int ArgNo

uint64_t getParamAlignment(
    unsigned int ArgNo) const

Description

Extract the alignment for a call or parameter (0=unknown). FIXME: Remove this function once transition to Align is over. Use getParamAlign() instead.

Declared at: llvm/include/llvm/IR/Function.h:435

Parameters

unsigned int ArgNo

llvm::Attribute getParamAttribute(
    unsigned int ArgNo,
    Attribute::AttrKind Kind) const

Description

gets the specified attribute from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:410

Parameters

unsigned int ArgNo
Attribute::AttrKind Kind

llvm::Type* getParamByRefType(
    unsigned int ArgNo) const

Description

Extract the byref type for a parameter.

Declared at: llvm/include/llvm/IR/Function.h:465

Parameters

unsigned int ArgNo

llvm::Type* getParamByValType(
    unsigned int ArgNo) const

Description

Extract the byval type for a parameter.

Declared at: llvm/include/llvm/IR/Function.h:450

Parameters

unsigned int ArgNo

uint64_t getParamDereferenceableBytes(
    unsigned int ArgNo) const

Description

Extract the number of dereferenceable bytes for a parameter.

Declared at: llvm/include/llvm/IR/Function.h:476

Parameters

unsigned int ArgNo
Index of an argument, with 0 being the first function arg.

uint64_t getParamDereferenceableOrNullBytes(
    unsigned int ArgNo) const

Description

Extract the number of dereferenceable_or_null bytes for a parameter.

Declared at: llvm/include/llvm/IR/Function.h:483

Parameters

unsigned int ArgNo
AttributeList ArgNo, referring to an argument.

llvm::Type* getParamInAllocaType(
    unsigned int ArgNo) const

Description

Extract the inalloca type for a parameter.

Declared at: llvm/include/llvm/IR/Function.h:460

Parameters

unsigned int ArgNo

llvm::Type* getParamPreallocatedType(
    unsigned int ArgNo) const

Description

Extract the preallocated type for a parameter.

Declared at: llvm/include/llvm/IR/Function.h:470

Parameters

unsigned int ArgNo

llvm::MaybeAlign getParamStackAlign(
    unsigned int ArgNo) const

Declared at: llvm/include/llvm/IR/Function.h:445

Parameters

unsigned int ArgNo

llvm::Type* getParamStructRetType(
    unsigned int ArgNo) const

Description

Extract the sret type for a parameter.

Declared at: llvm/include/llvm/IR/Function.h:455

Parameters

unsigned int ArgNo

llvm::Constant* getPersonalityFn() const

Description

Get the personality function associated with this function.

Declared at: llvm/include/llvm/IR/Function.h:783

llvm::Constant* getPrefixData() const

Description

Get the prefix data associated with this function.

Declared at: llvm/include/llvm/IR/Function.h:792

llvm::Constant* getPrologueData() const

Description

Get the prologue data associated with this function.

Declared at: llvm/include/llvm/IR/Function.h:801

llvm::Type* getReturnType() const

Description

Returns the type of the ret val.

Declared at: llvm/include/llvm/IR/Function.h:180

Optional<llvm::StringRef> getSectionPrefix() const

Description

Get the section prefix for this function.

Declared at: llvm/include/llvm/IR/Function.h:302

static llvm::Function::BasicBlockListType
    llvm::Function::*
    getSublistAccess(llvm::BasicBlock*)

Declared at: llvm/include/llvm/IR/Function.h:706

Parameters

llvm::BasicBlock*

llvm::DISubprogram* getSubprogram() const

Description

Get the attached subprogram. Calls \a getMetadata() with \a LLVMContext::MD_dbg and casts the result to \a DISubprogram.

Declared at: llvm/include/llvm/IR/Function.h:883

llvm::UWTableKind getUWTableKind() const

Description

Get what kind of unwind table entry to generate for this function.

Declared at: llvm/include/llvm/IR/Function.h:626

inline llvm::ValueSymbolTable*
getValueSymbolTable()

Description

getSymbolTable() - Return the symbol table if any, otherwise nullptr.

Declared at: llvm/include/llvm/IR/Function.h:718

inline const llvm::ValueSymbolTable*
getValueSymbolTable() const

Declared at: llvm/include/llvm/IR/Function.h:719

bool hasAddressTaken(
    const llvm::User** = nullptr,
    bool IgnoreCallbackUses = false,
    bool IgnoreAssumeLikeCalls = true,
    bool IngoreLLVMUsed = false,
    bool IgnoreARCAttachedCall = false) const

Description

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, ignores callback uses, assume like pointer annotation calls, references in llvm.used and llvm.compiler.used variables, and operand bundle "clang.arc.attachedcall".

Declared at: llvm/include/llvm/IR/Function.h:858

Parameters

const llvm::User** = nullptr
bool IgnoreCallbackUses = false
bool IgnoreAssumeLikeCalls = true
bool IngoreLLVMUsed = false
bool IgnoreARCAttachedCall = false

bool hasFnAttribute(llvm::StringRef Kind) const

Description

Return true if the function has the attribute.

Declared at: llvm/include/llvm/IR/Function.h:389

Parameters

llvm::StringRef Kind

bool hasFnAttribute(
    Attribute::AttrKind Kind) const

Description

Return true if the function has the attribute.

Declared at: llvm/include/llvm/IR/Function.h:386

Parameters

Attribute::AttrKind Kind

bool hasGC() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:306

bool hasLazyArguments() const

Description

hasLazyArguments/CheckLazyArguments - The argument list of a function is built on demand, so that the list isn't allocated until the first client needs it. The hasLazyArguments predicate returns true if the arg list hasn't been set up yet.

Declared at: llvm/include/llvm/IR/Function.h:106

bool hasMinSize() const

Description

Optimize this function for minimum size (-Oz).

Declared at: llvm/include/llvm/IR/Function.h:661

bool hasNoSync() const

Description

Determine if the call can synchroize with other threads

Declared at: llvm/include/llvm/IR/Function.h:598

bool hasOptNone() const

Description

Do not optimize this function (-O0).

Declared at: llvm/include/llvm/IR/Function.h:658

bool hasOptSize() const

Description

Optimize this function for size (-Os) or minimum size (-Oz).

Declared at: llvm/include/llvm/IR/Function.h:664

bool hasParamAttribute(
    unsigned int ArgNo,
    Attribute::AttrKind Kind) const

Description

check if an attributes is in the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:395

Parameters

unsigned int ArgNo
Attribute::AttrKind Kind

bool hasPersonalityFn() const

Description

Check whether this function has a personality function.

Declared at: llvm/include/llvm/IR/Function.h:778

bool hasPrefixData() const

Description

Check whether this function has prefix data.

Declared at: llvm/include/llvm/IR/Function.h:787

bool hasProfileData(
    bool IncludeSynthetic = false) const

Description

Return true if the function is annotated with profile data. Presence of entry counts from a profile run implies the function has profile annotations. If IncludeSynthetic is false, only return true when the profile data is real.

Declared at: llvm/include/llvm/IR/Function.h:290

Parameters

bool IncludeSynthetic = false

bool hasPrologueData() const

Description

Check whether this function has prologue data.

Declared at: llvm/include/llvm/IR/Function.h:796

bool hasRetAttribute(
    Attribute::AttrKind Kind) const

Description

check if an attribute is in the list of attributes for the return value.

Declared at: llvm/include/llvm/IR/Function.h:392

Parameters

Attribute::AttrKind Kind

bool hasStackProtectorFnAttr() const

Description

Returns true if the function has ssp, sspstrong, or sspreq fn attrs.

Declared at: llvm/include/llvm/IR/Function.h:422

bool hasStructRetAttr() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:645

bool hasUWTable() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:632

bool isConstrainedFPIntrinsic() const

Description

Returns true if the function is one of the "Constrained Floating-Point Intrinsics". Returns false if not, and returns false when getIntrinsicID() returns Intrinsic::not_intrinsic.

Declared at: llvm/include/llvm/IR/Function.h:224

bool isConvergent() const

Description

Determine if the call is convergent.

Declared at: llvm/include/llvm/IR/Function.h:571

bool isDebugInfoForProfiling() const

Description

Returns true if we should emit debug info for profiling.

Declared at: llvm/include/llvm/IR/Function.h:886

bool isDefTriviallyDead() const

Description

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.

Declared at: llvm/include/llvm/IR/Function.h:868

bool isIntrinsic() const

Description

isIntrinsic - Returns true if the function's name starts with "llvm.". It's possible for this function to return true while getIntrinsicID() returns Intrinsic::not_intrinsic!

Declared at: llvm/include/llvm/IR/Function.h:210

bool isMaterializable() const

Declared at: llvm/include/llvm/IR/Function.h:190

bool isPresplitCoroutine() const

Description

Determine if the function is presplit coroutine.

Declared at: llvm/include/llvm/IR/Function.h:488

bool isSpeculatable() const

Description

Determine if the call has sideeffects.

Declared at: llvm/include/llvm/IR/Function.h:582

bool isTargetIntrinsic() const

Description

isTargetIntrinsic - Returns true if this function is an intrinsic and the intrinsic is specific to a certain target. If this is not an intrinsic or a generic intrinsic, false is returned.

Declared at: llvm/include/llvm/IR/Function.h:219

static bool isTargetIntrinsic(Intrinsic::ID IID)

Description

isTargetIntrinsic - Returns true if IID is an intrinsic specific to a certain target. If it is a generic intrinsic false is returned.

Declared at: llvm/include/llvm/IR/Function.h:214

Parameters

Intrinsic::ID IID

bool isVarArg() const

Description

isVarArg - Return true if this function takes a variable number of arguments.

Declared at: llvm/include/llvm/IR/Function.h:188

static Intrinsic::ID lookupIntrinsicID(
    llvm::StringRef Name)

Declared at: llvm/include/llvm/IR/Function.h:226

Parameters

llvm::StringRef Name

bool mustProgress() const

Description

Determine if the function is required to make forward progress.

Declared at: llvm/include/llvm/IR/Function.h:615

bool needsUnwindTableEntry() const

Description

True if this function needs an unwind table.

Declared at: llvm/include/llvm/IR/Function.h:639

bool nullPointerIsDefined() const

Description

Check if null pointer dereferencing is considered undefined behavior for the function. Return value: false => null pointer dereference is undefined. Return value: true => null pointer dereference is not undefined.

Declared at: llvm/include/llvm/IR/Function.h:892

bool onlyAccessesArgMemory() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:520

bool onlyAccessesInaccessibleMemOrArgMem() const

Description

Determine if the function may only access memory that is either inaccessible from the IR or pointed to by its arguments.

Declared at: llvm/include/llvm/IR/Function.h:536

bool onlyAccessesInaccessibleMemory() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:527

bool onlyReadsMemory() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:503

bool onlyWritesMemory() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:511

void print(
    llvm::raw_ostream& OS,
    llvm::AssemblyAnnotationWriter* AAW = nullptr,
    bool ShouldPreserveUseListOrder = false,
    bool IsForDebug = false) const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:806

Parameters

llvm::raw_ostream& OS
llvm::AssemblyAnnotationWriter* AAW = nullptr
bool ShouldPreserveUseListOrder = false
bool IsForDebug = false

void recalculateIntrinsicID()

Description

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.

Declared at: llvm/include/llvm/IR/Function.h:233

void removeAttributeAtIndex(unsigned int i,
                            llvm::StringRef Kind)

Description

removes the attribute from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:357

Parameters

unsigned int i
llvm::StringRef Kind

void removeAttributeAtIndex(
    unsigned int i,
    Attribute::AttrKind Kind)

Description

removes the attribute from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:354

Parameters

unsigned int i
Attribute::AttrKind Kind

void removeFnAttr(llvm::StringRef Kind)

Description

Remove function attribute from this function.

Declared at: llvm/include/llvm/IR/Function.h:363

Parameters

llvm::StringRef Kind

void removeFnAttr(Attribute::AttrKind Kind)

Description

Remove function attributes from this function.

Declared at: llvm/include/llvm/IR/Function.h:360

Parameters

Attribute::AttrKind Kind

void removeFnAttrs(
    const llvm::AttributeMask& Attrs)

Declared at: llvm/include/llvm/IR/Function.h:365

Parameters

const llvm::AttributeMask& Attrs

void removeFromParent()

Description

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

Declared at: llvm/include/llvm/IR/Function.h:687

void removeParamAttr(unsigned int ArgNo,
                     Attribute::AttrKind Kind)

Description

removes the attribute from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:377

Parameters

unsigned int ArgNo
Attribute::AttrKind Kind

void removeParamAttr(unsigned int ArgNo,
                     llvm::StringRef Kind)

Description

removes the attribute from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:380

Parameters

unsigned int ArgNo
llvm::StringRef Kind

void removeParamAttrs(
    unsigned int ArgNo,
    const llvm::AttributeMask& Attrs)

Description

removes the attribute from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:383

Parameters

unsigned int ArgNo
const llvm::AttributeMask& Attrs

void removeParamUndefImplyingAttrs(
    unsigned int ArgNo)

Description

removes noundef and other attributes that imply undefined behavior if a `undef` or `poison` value is passed from the list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:414

Parameters

unsigned int ArgNo

void removeRetAttr(Attribute::AttrKind Kind)

Description

removes the attribute from the return value list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:368

Parameters

Attribute::AttrKind Kind

void removeRetAttr(llvm::StringRef Kind)

Description

removes the attribute from the return value list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:371

Parameters

llvm::StringRef Kind

void removeRetAttrs(
    const llvm::AttributeMask& Attrs)

Description

removes the attributes from the return value list of attributes.

Declared at: llvm/include/llvm/IR/Function.h:374

Parameters

const llvm::AttributeMask& Attrs

bool returnDoesNotAlias() const

Description

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

Declared at: llvm/include/llvm/IR/Function.h:652

void setAttributes(llvm::AttributeList Attrs)

Description

Set the attribute list for this Function.

Declared at: llvm/include/llvm/IR/Function.h:317

Parameters

llvm::AttributeList Attrs

void setCallingConv(CallingConv::ID CC)

Declared at: llvm/include/llvm/IR/Function.h:242

Parameters

CallingConv::ID CC

void setCannotDuplicate()

Declared at: llvm/include/llvm/IR/Function.h:566

void setConvergent()

Declared at: llvm/include/llvm/IR/Function.h:574

void setDoesNotAccessMemory()

Declared at: llvm/include/llvm/IR/Function.h:498

void setDoesNotFreeMemory()

Declared at: llvm/include/llvm/IR/Function.h:593

void setDoesNotRecurse()

Declared at: llvm/include/llvm/IR/Function.h:610

void setDoesNotReturn()

Declared at: llvm/include/llvm/IR/Function.h:547

void setDoesNotThrow()

Declared at: llvm/include/llvm/IR/Function.h:558

void setEntryCount(
    uint64_t Count,
    llvm::Function::ProfileCountType Type =
        PCT_Real,
    const DenseSet<GlobalValue::GUID>* Imports =
        nullptr)

Description

A convenience wrapper for setting entry count

Declared at: llvm/include/llvm/IR/Function.h:276

Parameters

uint64_t Count
llvm::Function::ProfileCountType Type = PCT_Real
const DenseSet<GlobalValue::GUID>* Imports = nullptr

void setEntryCount(
    llvm::Function::ProfileCount Count,
    const DenseSet<GlobalValue::GUID>* Imports =
        nullptr)

Description

Set the entry count for this function. Entry count is the number of times this function was executed based on pgo data. \p Imports points to a set of GUIDs that needs to be imported by the function for sample PGO, to enable the same inlines as the profiled optimized binary.

Declared at: llvm/include/llvm/IR/Function.h:272

Parameters

llvm::Function::ProfileCount Count
const DenseSet<GlobalValue::GUID>* Imports = nullptr

void setGC(std::string Str)

Declared at: llvm/include/llvm/IR/Function.h:310

Parameters

std::string Str

template <int Idx>
void setHungoffOperand(llvm::Constant* C)

Declared at: llvm/include/llvm/IR/Function.h:896

Templates

int Idx

Parameters

llvm::Constant* C

void setIsMaterializable(bool V)

Declared at: llvm/include/llvm/IR/Function.h:193

Parameters

bool V

void setMustProgress()

Declared at: llvm/include/llvm/IR/Function.h:619

void setNoSync()

Declared at: llvm/include/llvm/IR/Function.h:601

void setNotConvergent()

Declared at: llvm/include/llvm/IR/Function.h:577

void setOnlyAccessesArgMemory()

Declared at: llvm/include/llvm/IR/Function.h:523

void setOnlyAccessesInaccessibleMemOrArgMem()

Declared at: llvm/include/llvm/IR/Function.h:539

void setOnlyAccessesInaccessibleMemory()

Declared at: llvm/include/llvm/IR/Function.h:530

void setOnlyReadsMemory()

Declared at: llvm/include/llvm/IR/Function.h:506

void setOnlyWritesMemory()

Declared at: llvm/include/llvm/IR/Function.h:514

void setPersonalityFn(llvm::Constant* Fn)

Declared at: llvm/include/llvm/IR/Function.h:784

Parameters

llvm::Constant* Fn

void setPrefixData(llvm::Constant* PrefixData)

Declared at: llvm/include/llvm/IR/Function.h:793

Parameters

llvm::Constant* PrefixData

void setPresplitCoroutine()

Declared at: llvm/include/llvm/IR/Function.h:491

void setPrologueData(llvm::Constant* PrologueData)

Declared at: llvm/include/llvm/IR/Function.h:802

Parameters

llvm::Constant* PrologueData

void setReturnDoesNotAlias()

Declared at: llvm/include/llvm/IR/Function.h:655

void setSectionPrefix(llvm::StringRef Prefix)

Description

Set the section prefix for this function.

Declared at: llvm/include/llvm/IR/Function.h:299

Parameters

llvm::StringRef Prefix

void setSpeculatable()

Declared at: llvm/include/llvm/IR/Function.h:585

void setSplittedCoroutine()

Declared at: llvm/include/llvm/IR/Function.h:492

void setSubprogram(llvm::DISubprogram* SP)

Description

Set the attached subprogram. Calls \a setMetadata() with \a LLVMContext::MD_dbg.

Declared at: llvm/include/llvm/IR/Function.h:877

Parameters

llvm::DISubprogram* SP

void setUWTableKind(llvm::UWTableKind K)

Declared at: llvm/include/llvm/IR/Function.h:635

Parameters

llvm::UWTableKind K

void setValueSubclassData(unsigned short D)

Description

Shadow Value::setValueSubclassData with a private forwarding method so that subclasses cannot accidentally use it.

Declared at: llvm/include/llvm/IR/Function.h:900

Parameters

unsigned short D

void setValueSubclassDataBit(unsigned int Bit,
                             bool On)

Declared at: llvm/include/llvm/IR/Function.h:903

Parameters

unsigned int Bit
bool On

void setWillReturn()

Declared at: llvm/include/llvm/IR/Function.h:623

size_t size() const

Declared at: llvm/include/llvm/IR/Function.h:731

void stealArgumentListFrom(llvm::Function& Src)

Description

Steal arguments from another function. Drop this function's arguments and splice in the ones from \c Src. Requires that this has no function body.

Declared at: llvm/include/llvm/IR/Function.h:698

Parameters

llvm::Function& Src

void viewCFG(
    bool ViewCFGOnly,
    const llvm::BlockFrequencyInfo* BFI,
    const llvm::BranchProbabilityInfo* BPI) const

Description

Extended form to print edge weights.

Declared at: llvm/include/llvm/IR/Function.h:819

Parameters

bool ViewCFGOnly
const llvm::BlockFrequencyInfo* BFI
const llvm::BranchProbabilityInfo* BPI

void viewCFG() const

Description

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.

Declared at: llvm/include/llvm/IR/Function.h:816

void viewCFGOnly(
    const llvm::BlockFrequencyInfo* BFI,
    const llvm::BranchProbabilityInfo* BPI) const

Description

Extended form to print edge weights.

Declared at: llvm/include/llvm/IR/Function.h:830

Parameters

const llvm::BlockFrequencyInfo* BFI
const llvm::BranchProbabilityInfo* BPI

void viewCFGOnly() const

Description

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.

Declared at: llvm/include/llvm/IR/Function.h:827

bool willReturn() const

Description

Determine if the function will return.

Declared at: llvm/include/llvm/IR/Function.h:622

~Function()

Declared at: llvm/include/llvm/IR/Function.h:130