LLVM  8.0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::Function Class Reference

#include "llvm/IR/Function.h"

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

Classes

class  ProfileCount
 Class to represent profile counts. More...
 

Public Types

enum  ProfileCountType { PCT_Invalid, PCT_Real, PCT_Synthetic }
 
using BasicBlockListType = SymbolTableList< BasicBlock >
 
using iterator = BasicBlockListType::iterator
 
using const_iterator = BasicBlockListType::const_iterator
 
using arg_iterator = Argument *
 
using const_arg_iterator = const Argument *
 
- Public Types inherited from llvm::GlobalValue
enum  LinkageTypes {
  ExternalLinkage = 0, AvailableExternallyLinkage, LinkOnceAnyLinkage, LinkOnceODRLinkage,
  WeakAnyLinkage, WeakODRLinkage, AppendingLinkage, InternalLinkage,
  PrivateLinkage, ExternalWeakLinkage, CommonLinkage
}
 An enumeration for the kinds of linkage for global values. More...
 
enum  VisibilityTypes { DefaultVisibility = 0, HiddenVisibility, ProtectedVisibility }
 An enumeration for the kinds of visibility of global values. More...
 
enum  DLLStorageClassTypes { DefaultStorageClass = 0, DLLImportStorageClass = 1, DLLExportStorageClass = 2 }
 Storage classes of global values for PE targets. More...
 
enum  ThreadLocalMode {
  NotThreadLocal = 0, GeneralDynamicTLSModel, LocalDynamicTLSModel, InitialExecTLSModel,
  LocalExecTLSModel
}
 
enum  UnnamedAddr { UnnamedAddr::None, UnnamedAddr::Local, UnnamedAddr::Global }
 
using GUID = uint64_t
 Declare a type to represent a global unique identifier for a global value. More...
 
- Public Types inherited from llvm::User
using op_iterator = Use *
 
using const_op_iterator = const Use *
 
using op_range = iterator_range< op_iterator >
 
using const_op_range = iterator_range< const_op_iterator >
 
- Public Types inherited from llvm::Value
enum  ValueTy
 Concrete subclass of this. More...
 
using use_iterator = use_iterator_impl< Use >
 
using const_use_iterator = use_iterator_impl< const Use >
 
using user_iterator = user_iterator_impl< User >
 
using const_user_iterator = user_iterator_impl< const User >
 

Public Member Functions

bool hasLazyArguments () const
 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. More...
 
 Function (const Function &)=delete
 
void operator= (const Function &)=delete
 
 ~Function ()
 
const FunctiongetFunction () const
 
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 
unsigned getInstructionCount () const
 Returns the number of non-debug IR instructions in this function. More...
 
FunctionTypegetFunctionType () const
 Returns the FunctionType for me. More...
 
TypegetReturnType () const
 Returns the type of the ret val. More...
 
LLVMContextgetContext () const
 getContext - Return a reference to the LLVMContext associated with this function. More...
 
bool isVarArg () const
 isVarArg - Return true if this function takes a variable number of arguments. More...
 
bool isMaterializable () const
 
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. More...
 
bool isIntrinsic () const
 isIntrinsic - Returns true if the function's name starts with "llvm.". More...
 
void recalculateIntrinsicID ()
 Recalculate the ID for this function if it is an Intrinsic defined in llvm/Intrinsics.h. More...
 
CallingConv::ID getCallingConv () const
 getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this function. More...
 
void setCallingConv (CallingConv::ID CC)
 
AttributeList getAttributes () const
 Return the attribute list for this Function. More...
 
void setAttributes (AttributeList Attrs)
 Set the attribute list for this Function. More...
 
void addFnAttr (Attribute::AttrKind Kind)
 Add function attributes to this function. More...
 
void addFnAttr (StringRef Kind, StringRef Val=StringRef())
 Add function attributes to this function. More...
 
void addFnAttr (Attribute Attr)
 Add function attributes to this function. More...
 
void removeFnAttr (Attribute::AttrKind Kind)
 Remove function attributes from this function. More...
 
void removeFnAttr (StringRef Kind)
 Remove function attribute from this function. More...
 
void setEntryCount (ProfileCount Count, const DenseSet< GlobalValue::GUID > *Imports=nullptr)
 Set the entry count for this function. More...
 
void setEntryCount (uint64_t Count, ProfileCountType Type=PCT_Real, const DenseSet< GlobalValue::GUID > *Imports=nullptr)
 A convenience wrapper for setting entry count. More...
 
ProfileCount getEntryCount () const
 Get the entry count for this function. More...
 
bool hasProfileData () const
 Return true if the function is annotated with profile data. More...
 
DenseSet< GlobalValue::GUIDgetImportGUIDs () const
 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. More...
 
void setSectionPrefix (StringRef Prefix)
 Set the section prefix for this function. More...
 
Optional< StringRefgetSectionPrefix () const
 Get the section prefix for this function. More...
 
bool hasFnAttribute (Attribute::AttrKind Kind) const
 Return true if the function has the attribute. More...
 
bool hasFnAttribute (StringRef Kind) const
 Return true if the function has the attribute. More...
 
Attribute getFnAttribute (Attribute::AttrKind Kind) const
 Return the attribute for the given attribute kind. More...
 
Attribute getFnAttribute (StringRef Kind) const
 Return the attribute for the given attribute kind. More...
 
unsigned getFnStackAlignment () const
 Return the stack alignment for the function. More...
 
bool hasGC () const
 hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generation. More...
 
const std::string & getGC () const
 
void setGC (std::string Str)
 
void clearGC ()
 
void addAttribute (unsigned i, Attribute::AttrKind Kind)
 adds the attribute to the list of attributes. More...
 
void addAttribute (unsigned i, Attribute Attr)
 adds the attribute to the list of attributes. More...
 
void addAttributes (unsigned i, const AttrBuilder &Attrs)
 adds the attributes to the list of attributes. More...
 
void addParamAttr (unsigned ArgNo, Attribute::AttrKind Kind)
 adds the attribute to the list of attributes for the given arg. More...
 
void addParamAttr (unsigned ArgNo, Attribute Attr)
 adds the attribute to the list of attributes for the given arg. More...
 
void addParamAttrs (unsigned ArgNo, const AttrBuilder &Attrs)
 adds the attributes to the list of attributes for the given arg. More...
 
void removeAttribute (unsigned i, Attribute::AttrKind Kind)
 removes the attribute from the list of attributes. More...
 
void removeAttribute (unsigned i, StringRef Kind)
 removes the attribute from the list of attributes. More...
 
void removeAttributes (unsigned i, const AttrBuilder &Attrs)
 removes the attributes from the list of attributes. More...
 
void removeParamAttr (unsigned ArgNo, Attribute::AttrKind Kind)
 removes the attribute from the list of attributes. More...
 
void removeParamAttr (unsigned ArgNo, StringRef Kind)
 removes the attribute from the list of attributes. More...
 
void removeParamAttrs (unsigned ArgNo, const AttrBuilder &Attrs)
 removes the attribute from the list of attributes. More...
 
bool hasAttribute (unsigned i, Attribute::AttrKind Kind) const
 check if an attributes is in the list of attributes. More...
 
bool hasParamAttribute (unsigned ArgNo, Attribute::AttrKind Kind) const
 check if an attributes is in the list of attributes. More...
 
Attribute getAttribute (unsigned i, Attribute::AttrKind Kind) const
 gets the attribute from the list of attributes. More...
 
Attribute getAttribute (unsigned i, StringRef Kind) const
 gets the attribute from the list of attributes. More...
 
void addDereferenceableAttr (unsigned i, uint64_t Bytes)
 adds the dereferenceable attribute to the list of attributes. More...
 
void addDereferenceableParamAttr (unsigned ArgNo, uint64_t Bytes)
 adds the dereferenceable attribute to the list of attributes for the given arg. More...
 
void addDereferenceableOrNullAttr (unsigned i, uint64_t Bytes)
 adds the dereferenceable_or_null attribute to the list of attributes. More...
 
void addDereferenceableOrNullParamAttr (unsigned ArgNo, uint64_t Bytes)
 adds the dereferenceable_or_null attribute to the list of attributes for the given arg. More...
 
unsigned getParamAlignment (unsigned ArgNo) const
 Extract the alignment for a call or parameter (0=unknown). More...
 
uint64_t getDereferenceableBytes (unsigned i) const
 Extract the number of dereferenceable bytes for a call or parameter (0=unknown). More...
 
uint64_t getParamDereferenceableBytes (unsigned ArgNo) const
 Extract the number of dereferenceable bytes for a parameter. More...
 
uint64_t getDereferenceableOrNullBytes (unsigned i) const
 Extract the number of dereferenceable_or_null bytes for a call or parameter (0=unknown). More...
 
uint64_t getParamDereferenceableOrNullBytes (unsigned ArgNo) const
 Extract the number of dereferenceable_or_null bytes for a parameter. More...
 
bool doesNotAccessMemory () const
 Determine if the function does not access memory. More...
 
void setDoesNotAccessMemory ()
 
bool onlyReadsMemory () const
 Determine if the function does not access or only reads memory. More...
 
void setOnlyReadsMemory ()
 
bool doesNotReadMemory () const
 Determine if the function does not access or only writes memory. More...
 
void setDoesNotReadMemory ()
 
bool onlyAccessesArgMemory () const
 Determine if the call can access memmory only using pointers based on its arguments. More...
 
void setOnlyAccessesArgMemory ()
 
bool onlyAccessesInaccessibleMemory () const
 Determine if the function may only access memory that is inaccessible from the IR. More...
 
void setOnlyAccessesInaccessibleMemory ()
 
bool onlyAccessesInaccessibleMemOrArgMem () const
 Determine if the function may only access memory that is either inaccessible from the IR or pointed to by its arguments. More...
 
void setOnlyAccessesInaccessibleMemOrArgMem ()
 
bool doesNotReturn () const
 Determine if the function cannot return. More...
 
void setDoesNotReturn ()
 
bool doesNoCfCheck () const
 Determine if the function should not perform indirect branch tracking. More...
 
bool doesNotThrow () const
 Determine if the function cannot unwind. More...
 
void setDoesNotThrow ()
 
bool cannotDuplicate () const
 Determine if the call cannot be duplicated. More...
 
void setCannotDuplicate ()
 
bool isConvergent () const
 Determine if the call is convergent. More...
 
void setConvergent ()
 
void setNotConvergent ()
 
bool isSpeculatable () const
 Determine if the call has sideeffects. More...
 
void setSpeculatable ()
 
bool doesNotRecurse () const
 Determine if the function is known not to recurse, directly or indirectly. More...
 
void setDoesNotRecurse ()
 
bool hasUWTable () const
 True if the ABI mandates (or the user requested) that this function be in a unwind table. More...
 
void setHasUWTable ()
 
bool needsUnwindTableEntry () const
 True if this function needs an unwind table. More...
 
bool hasStructRetAttr () const
 Determine if the function returns a structure through first or second pointer argument. More...
 
bool returnDoesNotAlias () const
 Determine if the parameter or return value is marked with NoAlias attribute. More...
 
void setReturnDoesNotAlias ()
 
bool optForMinSize () const
 Optimize this function for minimum size (-Oz). More...
 
bool optForSize () const
 Optimize this function for size (-Os) or minimum size (-Oz). More...
 
void copyAttributesFrom (const Function *Src)
 copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the Function Src to this one. More...
 
void deleteBody ()
 deleteBody - This method deletes the body of the function, and converts the linkage to external. More...
 
void removeFromParent ()
 removeFromParent - This method unlinks 'this' from the containing module, but does not delete it. More...
 
void eraseFromParent ()
 eraseFromParent - This method unlinks 'this' from the containing module and deletes it. More...
 
void stealArgumentListFrom (Function &Src)
 Steal arguments from another function. More...
 
const BasicBlockListTypegetBasicBlockList () const
 Get the underlying elements of the Function... More...
 
BasicBlockListTypegetBasicBlockList ()
 
const BasicBlockgetEntryBlock () const
 
BasicBlockgetEntryBlock ()
 
ValueSymbolTablegetValueSymbolTable ()
 getSymbolTable() - Return the symbol table if any, otherwise nullptr. More...
 
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. More...
 
ConstantgetPersonalityFn () const
 Get the personality function associated with this function. More...
 
void setPersonalityFn (Constant *Fn)
 
bool hasPrefixData () const
 Check whether this function has prefix data. More...
 
ConstantgetPrefixData () const
 Get the prefix data associated with this function. More...
 
void setPrefixData (Constant *PrefixData)
 
bool hasPrologueData () const
 Check whether this function has prologue data. More...
 
ConstantgetPrologueData () const
 Get the prologue data associated with this function. More...
 
void setPrologueData (Constant *PrologueData)
 
void print (raw_ostream &OS, AssemblyAnnotationWriter *AAW=nullptr, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
 Print the function to an output stream with an optional AssemblyAnnotationWriter. More...
 
void viewCFG () const
 viewCFG - This function is meant for use from the debugger. More...
 
void viewCFGOnly () const
 viewCFGOnly - This function is meant for use from the debugger. More...
 
void dropAllReferences ()
 dropAllReferences() - This method causes all the subinstructions to "let go" of all references that they are maintaining. More...
 
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. More...
 
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). More...
 
bool callsFunctionThatReturnsTwice () const
 callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function that gcc recognizes as "returning twice". More...
 
void setSubprogram (DISubprogram *SP)
 Set the attached subprogram. More...
 
DISubprogramgetSubprogram () const
 Get the attached subprogram. More...
 
bool isDebugInfoForProfiling () const
 Returns true if we should emit debug info for profiling. More...
 
bool nullPointerIsDefined () const
 Check if null pointer dereferencing is considered undefined behavior for the function. More...
 
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_iteratorargs () const
 
- Public Member Functions inherited from llvm::GlobalObject
 GlobalObject (const GlobalObject &)=delete
 
unsigned getAlignment () const
 
void setAlignment (unsigned Align)
 
unsigned getGlobalObjectSubClassData () const
 
void setGlobalObjectSubClassData (unsigned Val)
 
bool hasSection () const
 Check if this global has a custom object file section. More...
 
StringRef getSection () const
 Get the custom section of this global if it has one. More...
 
void setSection (StringRef S)
 Change the section for this global. More...
 
bool hasComdat () const
 
const ComdatgetComdat () const
 
ComdatgetComdat ()
 
void setComdat (Comdat *C)
 
bool hasMetadata () const
 Check if this has any metadata. More...
 
bool hasMetadata (unsigned KindID) const
 Check if this has any metadata of the given kind. More...
 
bool hasMetadata (StringRef Kind) const
 
void getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode *>> &MDs) const
 Appends all attachments for the global to MDs, sorting by attachment ID. More...
 
bool eraseMetadata (unsigned KindID)
 Erase all metadata attachments with the given kind. More...
 
void copyMetadata (const GlobalObject *Src, unsigned Offset)
 Copy metadata from Src, adjusting offsets by Offset. More...
 
void addTypeMetadata (unsigned Offset, Metadata *TypeID)
 
void clearMetadata ()
 
MDNodegetMetadata (unsigned KindID) const
 Get the current metadata attachments for the given kind, if any. More...
 
MDNodegetMetadata (StringRef Kind) const
 
void getMetadata (unsigned KindID, SmallVectorImpl< MDNode *> &MDs) const
 Appends all attachments with the given ID to MDs in insertion order. More...
 
void getMetadata (StringRef Kind, SmallVectorImpl< MDNode *> &MDs) const
 
void setMetadata (unsigned KindID, MDNode *MD)
 Set a particular kind of metadata attachment. More...
 
void setMetadata (StringRef Kind, MDNode *MD)
 
void addMetadata (unsigned KindID, MDNode &MD)
 Add a metadata attachment. More...
 
void addMetadata (StringRef Kind, MDNode &MD)
 
- Public Member Functions inherited from llvm::GlobalValue
 GlobalValue (const GlobalValue &)=delete
 
unsigned getAlignment () const
 
unsigned getAddressSpace () const
 
bool hasGlobalUnnamedAddr () const
 
bool hasAtLeastLocalUnnamedAddr () const
 Returns true if this value's address is not significant in this module. More...
 
UnnamedAddr getUnnamedAddr () const
 
void setUnnamedAddr (UnnamedAddr Val)
 
bool hasComdat () const
 
const ComdatgetComdat () const
 
ComdatgetComdat ()
 
VisibilityTypes getVisibility () const
 
bool hasDefaultVisibility () const
 
bool hasHiddenVisibility () const
 
bool hasProtectedVisibility () const
 
void setVisibility (VisibilityTypes V)
 
bool isThreadLocal () const
 If the value is "Thread Local", its value isn't shared by the threads. More...
 
void setThreadLocal (bool Val)
 
void setThreadLocalMode (ThreadLocalMode Val)
 
ThreadLocalMode getThreadLocalMode () const
 
DLLStorageClassTypes getDLLStorageClass () const
 
bool hasDLLImportStorageClass () const
 
bool hasDLLExportStorageClass () const
 
void setDLLStorageClass (DLLStorageClassTypes C)
 
bool hasSection () const
 
StringRef getSection () const
 
PointerTypegetType () const
 Global values are always pointers. More...
 
TypegetValueType () const
 
void setDSOLocal (bool Local)
 
bool isDSOLocal () const
 
bool isDefinitionExact () const
 Return true if the currently visible definition of this global (if any) is exactly the definition we will see at runtime. More...
 
bool hasExactDefinition () const
 Return true if this global has an exact defintion. More...
 
bool isInterposable () const
 Return true if this global's definition can be substituted with an arbitrary definition at link time. More...
 
bool hasExternalLinkage () const
 
bool hasAvailableExternallyLinkage () const
 
bool hasLinkOnceLinkage () const
 
bool hasLinkOnceODRLinkage () const
 
bool hasWeakLinkage () const
 
bool hasWeakAnyLinkage () const
 
bool hasWeakODRLinkage () const
 
bool hasAppendingLinkage () const
 
bool hasInternalLinkage () const
 
bool hasPrivateLinkage () const
 
bool hasLocalLinkage () const
 
bool hasExternalWeakLinkage () const
 
bool hasCommonLinkage () const
 
bool hasValidDeclarationLinkage () const
 
void setLinkage (LinkageTypes LT)
 
LinkageTypes getLinkage () const
 
bool isDiscardableIfUnused () const
 
bool isWeakForLinker () const
 
std::string getGlobalIdentifier () const
 Return the modified name for this global value suitable to be used as the key for a global lookup (e.g. More...
 
GUID getGUID () const
 Return a 64-bit global unique ID constructed from global value name (i.e. More...
 
bool isDeclaration () const
 Return true if the primary definition of this global value is outside of the current translation unit. More...
 
bool isDeclarationForLinker () const
 
bool isStrongDefinitionForLinker () const
 Returns true if this global's definition will be the one chosen by the linker. More...
 
bool canIncreaseAlignment () const
 
const GlobalObjectgetBaseObject () const
 
GlobalObjectgetBaseObject ()
 
bool isAbsoluteSymbolRef () const
 Returns whether this is a reference to an absolute symbol. More...
 
Optional< ConstantRangegetAbsoluteSymbolRange () const
 If this is an absolute symbol reference, returns the range of the symbol, otherwise returns None. More...
 
void removeFromParent ()
 This method unlinks 'this' from the containing module, but does not delete it. More...
 
void eraseFromParent ()
 This method unlinks 'this' from the containing module and deletes it. More...
 
ModulegetParent ()
 Get the module that this global value is contained inside of... More...
 
const ModulegetParent () const
 
bool canBeOmittedFromSymbolTable () const
 True if GV can be left out of the object symbol table. More...
 
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. More...
 
Error materialize ()
 Make sure this GlobalValue is fully read. More...
 
- Public Member Functions inherited from llvm::Constant
void operator= (const Constant &)=delete
 
 Constant (const Constant &)=delete
 
bool isNullValue () const
 Return true if this is the value that would be returned by getNullValue. More...
 
bool isOneValue () const
 Returns true if the value is one. More...
 
bool isAllOnesValue () const
 Return true if this is the value that would be returned by getAllOnesValue. More...
 
bool isNegativeZeroValue () const
 Return true if the value is what would be returned by getZeroValueForNegation. More...
 
bool isZeroValue () const
 Return true if the value is negative zero or null value. More...
 
bool isNotMinSignedValue () const
 Return true if the value is not the smallest signed value. More...
 
bool isMinSignedValue () const
 Return true if the value is the smallest signed value. More...
 
bool isFiniteNonZeroFP () const
 Return true if this is a finite and non-zero floating-point scalar constant or a vector constant with all finite and non-zero elements. More...
 
bool isNormalFP () const
 Return true if this is a normal (as opposed to denormal) floating-point scalar constant or a vector constant with all normal elements. More...
 
bool hasExactInverseFP () const
 Return true if this scalar has an exact multiplicative inverse or this vector has an exact multiplicative inverse for each element in the vector. More...
 
bool isNaN () const
 Return true if this is a floating-point NaN constant or a vector floating-point constant with all NaN elements. More...
 
bool containsUndefElement () const
 Return true if this is a vector constant that includes any undefined elements. More...
 
bool canTrap () const
 Return true if evaluation of this constant could trap. More...
 
bool isThreadDependent () const
 Return true if the value can vary between threads. More...
 
bool isDLLImportDependent () const
 Return true if the value is dependent on a dllimport variable. More...
 
bool isConstantUsed () const
 Return true if the constant has users other than constant expressions and other dangling things. More...
 
bool needsRelocation () const
 This method classifies the entry according to whether or not it may generate a relocation entry. More...
 
ConstantgetAggregateElement (unsigned Elt) const
 For aggregates (struct/array/vector) return the constant that corresponds to the specified element if possible, or null if not. More...
 
ConstantgetAggregateElement (Constant *Elt) const
 
ConstantgetSplatValue () const
 If this is a splat vector constant, meaning that all of the elements have the same value, return that value. More...
 
const APIntgetUniqueInteger () const
 If C is a constant integer then return its value, otherwise C must be a vector of constant integers, all equal, and the common value is returned. More...
 
void destroyConstant ()
 Called if some element of this constant is no longer valid. More...
 
void handleOperandChange (Value *, Value *)
 This method is a special form of User::replaceUsesOfWith (which does not work on constants) that does work on constants. More...
 
void removeDeadConstantUsers () const
 If there are any dead constant users dangling off of this constant, remove them. More...
 
const ConstantstripPointerCasts () const
 
ConstantstripPointerCasts ()
 
- Public Member Functions inherited from llvm::User
 User (const User &)=delete
 
void operator delete (void *Usr)
 Free memory allocated for User and Use objects. More...
 
void operator delete (void *Usr, unsigned)
 Placement delete - required by std, called if the ctor throws. More...
 
void operator delete (void *Usr, unsigned, bool)
 Placement delete - required by std, called if the ctor throws. More...
 
const UsegetOperandList () const
 
UsegetOperandList ()
 
ValuegetOperand (unsigned i) const
 
void setOperand (unsigned i, Value *Val)
 
const UsegetOperandUse (unsigned i) const
 
UsegetOperandUse (unsigned i)
 
unsigned getNumOperands () const
 
ArrayRef< const uint8_t > getDescriptor () const
 Returns the descriptor co-allocated with this User instance. More...
 
MutableArrayRef< uint8_t > getDescriptor ()
 Returns the descriptor co-allocated with this User instance. More...
 
void setGlobalVariableNumOperands (unsigned NumOps)
 Set the number of operands on a GlobalVariable. More...
 
void setNumHungOffUseOperands (unsigned NumOps)
 Subclasses with hung off uses need to manage the operand count themselves. More...
 
op_iterator op_begin ()
 
const_op_iterator op_begin () const
 
op_iterator op_end ()
 
const_op_iterator op_end () const
 
op_range operands ()
 
const_op_range operands () const
 
value_op_iterator value_op_begin ()
 
value_op_iterator value_op_end ()
 
iterator_range< value_op_iteratoroperand_values ()
 
const_value_op_iterator value_op_begin () const
 
const_value_op_iterator value_op_end () const
 
iterator_range< const_value_op_iteratoroperand_values () const
 
void dropAllReferences ()
 Drop all references to operands. More...
 
void replaceUsesOfWith (Value *From, Value *To)
 Replace uses of one Value with another. More...
 
- Public Member Functions inherited from llvm::Value
 Value (const Value &)=delete
 
Valueoperator= (const Value &)=delete
 
void deleteValue ()
 Delete a pointer to a generic Value. More...
 
void dump () const
 Support for debugging, callable in GDB: V->dump() More...
 
TypegetType () const
 All values are typed, get the type of this value. More...
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 Return a constant reference to the value's name. More...
 
void setName (const Twine &Name)
 Change the name of the value. More...
 
void takeName (Value *V)
 Transfer the name from V to this value. More...
 
void replaceAllUsesWith (Value *V)
 Change all uses of this to point to a new Value. More...
 
void replaceNonMetadataUsesWith (Value *V)
 Change non-metadata uses of this to point to a new Value. More...
 
void replaceUsesOutsideBlock (Value *V, BasicBlock *BB)
 replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V" instead of "this" when the use is outside the block. More...
 
void assertModuleIsMaterializedImpl () const
 
void assertModuleIsMaterialized () const
 
bool use_empty () const
 
bool materialized_use_empty () const
 
use_iterator materialized_use_begin ()
 
const_use_iterator materialized_use_begin () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
iterator_range< use_iteratormaterialized_uses ()
 
iterator_range< const_use_iteratormaterialized_uses () const
 
iterator_range< use_iteratoruses ()
 
iterator_range< const_use_iteratoruses () const
 
bool user_empty () const
 
user_iterator materialized_user_begin ()
 
const_user_iterator materialized_user_begin () const
 
user_iterator user_begin ()
 
const_user_iterator user_begin () const
 
user_iterator user_end ()
 
const_user_iterator user_end () const
 
Useruser_back ()
 
const Useruser_back () const
 
iterator_range< user_iteratormaterialized_users ()
 
iterator_range< const_user_iteratormaterialized_users () const
 
iterator_range< user_iteratorusers ()
 
iterator_range< const_user_iteratorusers () const
 
bool hasOneUse () const
 Return true if there is exactly one user of this value. More...
 
bool hasNUses (unsigned N) const
 Return true if this Value has exactly N users. More...
 
bool hasNUsesOrMore (unsigned N) const
 Return true if this value has N users or more. More...
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 Check if this value is used in the specified basic block. More...
 
unsigned getNumUses () const
 This method computes the number of uses of this Value. More...
 
void addUse (Use &U)
 This method should only be used by the Use class. More...
 
unsigned getValueID () const
 Return an ID for the concrete type of this object. More...
 
unsigned getRawSubclassOptionalData () const
 Return the raw optional flags value contained in this value. More...
 
void clearSubclassOptionalData ()
 Clear the optional flags contained in this value. More...
 
bool hasSameSubclassOptionalData (const Value *V) const
 Check the optional flags for equality. More...
 
bool hasValueHandle () const
 Return true if there is a value handle associated with this value. More...
 
bool isUsedByMetadata () const
 Return true if there is metadata referencing this value. More...
 
bool isSwiftError () const
 Return true if this value is a swifterror value. More...
 
const ValuestripPointerCasts () const
 Strip off pointer casts, all-zero GEPs, and aliases. More...
 
ValuestripPointerCasts ()
 
const ValuestripPointerCastsAndInvariantGroups () const
 Strip off pointer casts, all-zero GEPs, aliases and invariant group info. More...
 
ValuestripPointerCastsAndInvariantGroups ()
 
const ValuestripPointerCastsNoFollowAliases () const
 Strip off pointer casts and all-zero GEPs. More...
 
ValuestripPointerCastsNoFollowAliases ()
 
const ValuestripInBoundsConstantOffsets () const
 Strip off pointer casts and all-constant inbounds GEPs. More...
 
ValuestripInBoundsConstantOffsets ()
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 Accumulate offsets from stripInBoundsConstantOffsets(). More...
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 
const ValuestripInBoundsOffsets () const
 Strip off pointer casts and inbounds GEPs. More...
 
ValuestripInBoundsOffsets ()
 
uint64_t getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull) const
 Returns the number of bytes known to be dereferenceable for the pointer value. More...
 
unsigned getPointerAlignment (const DataLayout &DL) const
 Returns an alignment of the pointer value. More...
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 Translate PHI node to its predecessor from the given basic block. More...
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 
void mutateType (Type *Ty)
 Mutate the type of this Value to be of the specified type. More...
 
template<class Compare >
void sortUseList (Compare Cmp)
 Sort the use-list. More...
 
void reverseUseList ()
 Reverse the use-list. More...
 
void print (raw_ostream &O, bool IsForDebug=false) const
 Implement operator<< on Value. More...
 
void print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug=false) const
 
void printAsOperand (raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
 Print the name of this Value out to the specified raw_ostream. More...
 
void printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const
 
- Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< Function, Options... >::type >
self_iterator getIterator ()
 
const_self_iterator getIterator () const
 
reverse_self_iterator getReverseIterator ()
 
const_reverse_self_iterator getReverseIterator () const
 
bool isSentinel () const
 Check whether this is the sentinel node. More...
 

Static Public Member Functions

static FunctionCreate (FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
 
static FunctionCreate (FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)
 
static FunctionCreate (FunctionType *Ty, LinkageTypes Linkage, const Twine &N, Module &M)
 Creates a new function and attaches it to a module. More...
 
static Intrinsic::ID lookupIntrinsicID (StringRef Name)
 This does the actual lookup of an intrinsic ID which matches the given function name. More...
 
static BasicBlockListType Function::* getSublistAccess (BasicBlock *)
 
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
- Static Public Member Functions inherited from llvm::GlobalObject
static bool classof (const Value *V)
 
- Static Public Member Functions inherited from llvm::GlobalValue
static UnnamedAddr getMinUnnamedAddr (UnnamedAddr A, UnnamedAddr B)
 
static LinkageTypes getLinkOnceLinkage (bool ODR)
 
static LinkageTypes getWeakLinkage (bool ODR)
 
static bool isExternalLinkage (LinkageTypes Linkage)
 
static bool isAvailableExternallyLinkage (LinkageTypes Linkage)
 
static bool isLinkOnceODRLinkage (LinkageTypes Linkage)
 
static bool isLinkOnceLinkage (LinkageTypes Linkage)
 
static bool isWeakAnyLinkage (LinkageTypes Linkage)
 
static bool isWeakODRLinkage (LinkageTypes Linkage)
 
static bool isWeakLinkage (LinkageTypes Linkage)
 
static bool isAppendingLinkage (LinkageTypes Linkage)
 
static bool isInternalLinkage (LinkageTypes Linkage)
 
static bool isPrivateLinkage (LinkageTypes Linkage)
 
static bool isLocalLinkage (LinkageTypes Linkage)
 
static bool isExternalWeakLinkage (LinkageTypes Linkage)
 
static bool isCommonLinkage (LinkageTypes Linkage)
 
static bool isValidDeclarationLinkage (LinkageTypes Linkage)
 
static bool isInterposableLinkage (LinkageTypes Linkage)
 Whether the definition of this global may be replaced by something non-equivalent at link time. More...
 
static bool isDiscardableIfUnused (LinkageTypes Linkage)
 Whether the definition of this global may be discarded if it is not used in its compilation unit. More...
 
static bool isWeakForLinker (LinkageTypes Linkage)
 Whether the definition of this global may be replaced at link time. More...
 
static StringRef dropLLVMManglingEscape (StringRef Name)
 If the given string begins with the GlobalValue name mangling escape character '\1', drop it. More...
 
static std::string getGlobalIdentifier (StringRef Name, GlobalValue::LinkageTypes Linkage, StringRef FileName)
 Return the modified name for a global value suitable to be used as the key for a global lookup (e.g. More...
 
static GUID getGUID (StringRef GlobalName)
 Return a 64-bit global unique ID constructed from global value name (i.e. More...
 
static bool classof (const Value *V)
 
- Static Public Member Functions inherited from llvm::Constant
static bool classof (const Value *V)
 
static ConstantgetNullValue (Type *Ty)
 Constructor to create a '0' constant of arbitrary type. More...
 
static ConstantgetAllOnesValue (Type *Ty)
 
static ConstantgetIntegerValue (Type *Ty, const APInt &V)
 Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value. More...
 
- Static Public Member Functions inherited from llvm::User
static bool classof (const Value *V)
 

Friends

class SymbolTableListTraits< Function >
 

Additional Inherited Members

- Static Public Attributes inherited from llvm::Value
static const unsigned MaxAlignmentExponent = 29
 The maximum alignment for instructions. More...
 
static const unsigned MaximumAlignment = 1u << MaxAlignmentExponent
 
- Protected Types inherited from llvm::GlobalObject
enum  { LastAlignmentBit = 4, HasMetadataHashEntryBit, HasSectionHashEntryBit, GlobalObjectBits }
 
- Protected Types inherited from llvm::Value
enum  : unsigned { NumUserOperandsBits = 28 }
 The number of operands in the subclass. More...
 
- Protected Types inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< Function, Options... >::type >
using self_iterator = ilist_iterator< ilist_detail::compute_node_options< Function, Options... >::type, false, false >
 
using const_self_iterator = ilist_iterator< ilist_detail::compute_node_options< Function, Options... >::type, false, true >
 
using reverse_self_iterator = ilist_iterator< ilist_detail::compute_node_options< Function, Options... >::type, true, false >
 
using const_reverse_self_iterator = ilist_iterator< ilist_detail::compute_node_options< Function, Options... >::type, true, true >
 
- Protected Member Functions inherited from llvm::GlobalObject
 GlobalObject (Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace=0)
 
void copyAttributesFrom (const GlobalObject *Src)
 
- Protected Member Functions inherited from llvm::GlobalValue
 GlobalValue (Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps, LinkageTypes Linkage, const Twine &Name, unsigned AddressSpace)
 
unsigned getGlobalValueSubClassData () const
 
void setGlobalValueSubClassData (unsigned V)
 
void setParent (Module *parent)
 
 ~GlobalValue ()
 
void copyAttributesFrom (const GlobalValue *Src)
 Copy all additional attributes (those not needed to create a GlobalValue) from the GlobalValue Src to this one. More...
 
- Protected Member Functions inherited from llvm::Constant
 Constant (Type *ty, ValueTy vty, Use *Ops, unsigned NumOps)
 
- Protected Member Functions inherited from llvm::User
void * operator new (size_t Size)
 Allocate a User with an operand pointer co-allocated. More...
 
void * operator new (size_t Size, unsigned Us)
 Allocate a User with the operands co-allocated. More...
 
void * operator new (size_t Size, unsigned Us, unsigned DescBytes)
 Allocate a User with the operands co-allocated. More...
 
 User (Type *ty, unsigned vty, Use *, unsigned NumOps)
 
void allocHungoffUses (unsigned N, bool IsPhi=false)
 Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User. More...
 
void growHungoffUses (unsigned N, bool IsPhi=false)
 Grow the number of hung off uses. More...
 
 ~User ()=default
 
template<int Idx>
UseOp ()
 
template<int Idx>
const UseOp () const
 
- Protected Member Functions inherited from llvm::Value
 Value (Type *Ty, unsigned scid)
 
 ~Value ()
 Value's destructor should be virtual by design, but that would require that Value and all of its subclasses have a vtable that effectively duplicates the information in the value ID. More...
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 
- Protected Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< Function, Options... >::type >
 ilist_node_impl ()=default
 
- Static Protected Member Functions inherited from llvm::User
template<int Idx, typename U >
static UseOpFrom (const U *that)
 
- Protected Attributes inherited from llvm::GlobalObject
ComdatObjComdat
 
- Protected Attributes inherited from llvm::GlobalValue
TypeValueType
 
unsigned Linkage: 4
 
unsigned Visibility: 2
 
unsigned UnnamedAddrVal: 2
 
unsigned DllStorageClass: 2
 
unsigned ThreadLocal: 3
 
unsigned HasLLVMReservedName: 1
 True if the function's name starts with "llvm.". More...
 
unsigned IsDSOLocal: 1
 If true then there is a definition within the same linkage unit and that definition cannot be runtime preempted. More...
 
Intrinsic::ID IntID
 The intrinsic ID for this subclass (which must be a Function). More...
 
ModuleParent
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 Hold subclass data that can be dropped. More...
 
unsigned NumUserOperands: NumUserOperandsBits
 
unsigned IsUsedByMD: 1
 
unsigned HasName: 1
 
unsigned HasHungOffUses: 1
 
unsigned HasDescriptor: 1
 
- Static Protected Attributes inherited from llvm::GlobalObject
static const unsigned GlobalObjectSubClassDataBits
 
- Static Protected Attributes inherited from llvm::GlobalValue
static const unsigned GlobalValueSubClassDataBits = 17
 

Detailed Description

Definition at line 60 of file Function.h.

Member Typedef Documentation

◆ arg_iterator

Definition at line 68 of file Function.h.

◆ BasicBlockListType

Definition at line 62 of file Function.h.

◆ const_arg_iterator

Definition at line 69 of file Function.h.

◆ const_iterator

Definition at line 66 of file Function.h.

◆ iterator

Definition at line 65 of file Function.h.

Member Enumeration Documentation

◆ ProfileCountType

Enumerator
PCT_Invalid 
PCT_Real 
PCT_Synthetic 

Definition at line 256 of file Function.h.

Constructor & Destructor Documentation

◆ Function()

llvm::Function::Function ( const Function )
delete

◆ ~Function()

Function::~Function ( )

Member Function Documentation

◆ addAttribute() [1/2]

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

◆ addAttribute() [2/2]

void Function::addAttribute ( unsigned  i,
Attribute  Attr 
)

adds the attribute to the list of attributes.

Definition at line 374 of file Function.cpp.

References llvm::AttributeList::addAttribute(), llvm::Intrinsic::getAttributes(), and llvm::Value::getContext().

◆ addAttributes()

void Function::addAttributes ( unsigned  i,
const AttrBuilder Attrs 
)

adds the attributes to the list of attributes.

Definition at line 380 of file Function.cpp.

References llvm::AttributeList::addAttributes(), llvm::Intrinsic::getAttributes(), and llvm::Value::getContext().

Referenced by llvm::createX86RetpolineThunksPass(), removeUseSoftFloat(), and setFastFlags().

◆ addDereferenceableAttr()

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

adds the dereferenceable attribute to the list of attributes.

Definition at line 440 of file Function.cpp.

References llvm::AttributeList::addDereferenceableAttr(), llvm::Intrinsic::getAttributes(), and llvm::Value::getContext().

◆ addDereferenceableOrNullAttr()

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

adds the dereferenceable_or_null attribute to the list of attributes.

Definition at line 452 of file Function.cpp.

References llvm::AttributeList::addDereferenceableOrNullAttr(), llvm::Intrinsic::getAttributes(), and llvm::Value::getContext().

◆ addDereferenceableOrNullParamAttr()

void Function::addDereferenceableOrNullParamAttr ( unsigned  ArgNo,
uint64_t  Bytes 
)

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

Definition at line 458 of file Function.cpp.

References llvm::AttributeList::addDereferenceableOrNullParamAttr(), llvm::Intrinsic::getAttributes(), and llvm::Value::getContext().

◆ addDereferenceableParamAttr()

void Function::addDereferenceableParamAttr ( unsigned  ArgNo,
uint64_t  Bytes 
)

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

Definition at line 446 of file Function.cpp.

References llvm::AttributeList::addDereferenceableParamAttr(), llvm::Intrinsic::getAttributes(), and llvm::Value::getContext().

◆ addFnAttr() [1/3]

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

◆ addFnAttr() [2/3]

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

Add function attributes to this function.

Definition at line 235 of file Function.h.

References llvm::AttributeList::FunctionIndex, and llvm::Attribute::get().

◆ addFnAttr() [3/3]

void llvm::Function::addFnAttr ( Attribute  Attr)
inline

Add function attributes to this function.

Definition at line 241 of file Function.h.

References llvm::AttributeList::FunctionIndex.

◆ addParamAttr() [1/2]

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

◆ addParamAttr() [2/2]

void Function::addParamAttr ( unsigned  ArgNo,
Attribute  Attr 
)

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

Definition at line 392 of file Function.cpp.

References llvm::AttributeList::addParamAttribute(), llvm::Intrinsic::getAttributes(), and llvm::Value::getContext().

◆ addParamAttrs()

void Function::addParamAttrs ( unsigned  ArgNo,
const AttrBuilder Attrs 
)

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

Definition at line 398 of file Function.cpp.

References llvm::AttributeList::addParamAttributes(), llvm::Intrinsic::getAttributes(), and llvm::Value::getContext().

◆ arg_begin() [1/2]

arg_iterator llvm::Function::arg_begin ( )
inline

◆ arg_begin() [2/2]

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

Definition at line 675 of file Function.h.

References Arguments.

◆ arg_empty()

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

◆ arg_end() [1/2]

arg_iterator llvm::Function::arg_end ( )
inline

◆ arg_end() [2/2]

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

Definition at line 684 of file Function.h.

◆ arg_size()

size_t llvm::Function::arg_size ( ) const
inline

◆ args() [1/2]

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

Definition at line 689 of file Function.h.

References llvm::make_range().

Referenced by AddAliasScopeMetadata(), AddAlignmentAssumptions(), llvm::AMDGPUTargetLowering::analyzeFormalArgumentsCompute(), llvm::coro::buildCoroutineFrame(), CC_MipsO32_FP64(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunction(), llvm::CloneFunctionInto(), createClone(), llvm::createDeadArgHackingPass(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), llvm::CFLSteensAAResult::FunctionInfo::FunctionInfo(), FunctionNumber(), getCompareCC(), llvm::AMDGPUSubtarget::getExplicitKernArgSize(), llvm::GPUDivergenceAnalysis::GPUDivergenceAnalysis(), handleEndBlock(), hasAnyNonFlatUseOfReg(), llvm::HexagonEvaluator::HexagonEvaluator(), llvm::ValueEnumerator::incorporateFunction(), INITIALIZE_PASS(), initSlots2Values(), insertIfNamed(), llvm::SITargetLowering::isEligibleForTailCallOptimization(), isReassociableOp(), isThunkProfitable(), llvm::X86CallLowering::lowerFormalArguments(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), llvm::orc::makeStub(), MarkBlocksLiveIn(), markTails(), maybePrintComdat(), okayForPHIOfOps(), populateExternalRelations(), llvm::LegacyDivergenceAnalysis::print(), promoteArguments(), PushArgMD(), llvm::AAEvaluator::run(), runSCCP(), StackMallocSizeClass(), stripNonValidAttributesFromPrototype(), tryToElideArgumentCopy(), TypeSizeToSizeIndex(), wrapConstantAsMetadata(), and X86ChooseCmpImmediateOpcode().

◆ args() [2/2]

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

Definition at line 692 of file Function.h.

References llvm::make_range().

◆ back() [1/2]

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

Definition at line 665 of file Function.h.

Referenced by hasProfileData().

◆ back() [2/2]

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

Definition at line 666 of file Function.h.

◆ begin() [1/2]

iterator llvm::Function::begin ( )
inline

◆ begin() [2/2]

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

Definition at line 657 of file Function.h.

◆ callsFunctionThatReturnsTwice()

bool Function::callsFunctionThatReturnsTwice ( ) const

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

Definition at line 1290 of file Function.cpp.

References I, llvm::instructions(), and llvm::Attribute::ReturnsTwice.

Referenced by createCallInst(), markTails(), and llvm::SelectionDAGISel::runOnMachineFunction().

◆ cannotDuplicate()

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

Determine if the call cannot be duplicated.

Definition at line 528 of file Function.h.

References llvm::Attribute::NoDuplicate.

◆ classof()

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

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

Definition at line 750 of file Function.h.

References llvm::tgtok::Bit, C, D, F(), getSubprogram(), llvm::Value::getValueID(), llvm::NullPointerIsDefined(), and llvm::Value::setValueSubclassData().

◆ clearGC()

void Function::clearGC ( )

Definition at line 475 of file Function.cpp.

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

Referenced by LLVMSetGC().

◆ copyAttributesFrom()

void Function::copyAttributesFrom ( const Function Src)

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.

Definition at line 484 of file Function.cpp.

References llvm::GlobalObject::copyAttributesFrom(), getAttributes(), getCallingConv(), getGC(), getPersonalityFn(), getPrefixData(), getPrologueData(), hasGC(), hasPersonalityFn(), hasPrefixData(), and hasPrologueData().

Referenced by canCreateAliasFor(), llvm::orc::cloneFunctionDecl(), llvm::CloneFunctionInto(), llvm::CloneModule(), llvm::createDeadArgHackingPass(), doPromotion(), getRetComponentType(), INITIALIZE_PASS(), and isThunkProfitable().

◆ Create() [1/3]

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

◆ Create() [2/3]

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

Definition at line 143 of file Function.h.

References DECLARE_TRANSPARENT_OPERAND_ACCESSORS, and N.

◆ Create() [3/3]

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

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.

Definition at line 205 of file Function.cpp.

References llvm::Module::getDataLayout(), llvm::DataLayout::getProgramAddressSpace(), and N.

◆ DECLARE_TRANSPARENT_OPERAND_ACCESSORS()

llvm::Function::DECLARE_TRANSPARENT_OPERAND_ACCESSORS ( Value  )

◆ deleteBody()

void llvm::Function::deleteBody ( )
inline

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

Definition at line 609 of file Function.h.

Referenced by llvm::createBlockExtractorPass(), and llvm::orc::moveFunctionBody().

◆ doesNoCfCheck()

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

Determine if the function should not perform indirect branch tracking.

Definition at line 517 of file Function.h.

References llvm::Attribute::NoCfCheck.

Referenced by llvm::createX86IndirectBranchTrackingPass().

◆ doesNotAccessMemory()

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

Determine if the function does not access memory.

Definition at line 460 of file Function.h.

References llvm::Attribute::ReadNone.

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

◆ doesNotReadMemory()

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

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

Definition at line 476 of file Function.h.

References llvm::Attribute::WriteOnly.

Referenced by llvm::BasicAAResult::getModRefBehavior().

◆ doesNotRecurse()

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

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

Definition at line 556 of file Function.h.

References llvm::Attribute::NoRecurse.

Referenced by addNoRecurseAttrs(), addNoRecurseAttrsTopDown(), deduceFunctionAttributeInRPO(), hasAnyNonFlatUseOfReg(), processInternalGlobal(), and setDoesNotRecurse().

◆ doesNotReturn()

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

Determine if the function cannot return.

Definition at line 509 of file Function.h.

References llvm::Attribute::NoReturn.

Referenced by runImpl().

◆ doesNotThrow()

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

◆ dropAllReferences()

void Function::dropAllReferences ( )

dropAllReferences() - This method causes all the subinstructions to "let go" of all references that they are maintaining.

This allows one to 'delete' a whole module at a time, even though there may be circular references... first all references are dropped, and all use counts go to zero. Then everything is deleted for real. Note that no operations are valid on an object that has "dropped all references", except operator delete.

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

Definition at line 346 of file Function.cpp.

References llvm::User::dropAllReferences(), llvm::BasicBlock::dropAllReferences(), llvm::Value::getSubclassDataFromValue(), and llvm::Value::setValueSubclassData().

Referenced by llvm::Module::dropAllReferences(), and llvm::InlinerPass::run().

◆ empty()

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

◆ end() [1/2]

iterator llvm::Function::end ( )
inline

◆ end() [2/2]

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

Definition at line 659 of file Function.h.

◆ eraseFromParent()

void Function::eraseFromParent ( )

◆ front() [1/2]

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

◆ front() [2/2]

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

Definition at line 664 of file Function.h.

◆ getAttribute() [1/2]

Attribute llvm::Function::getAttribute ( unsigned  i,
Attribute::AttrKind  Kind 
) const
inline

gets the attribute from the list of attributes.

Definition at line 403 of file Function.h.

References llvm::AttributeList::getAttribute().

◆ getAttribute() [2/2]

Attribute llvm::Function::getAttribute ( unsigned  i,
StringRef  Kind 
) const
inline

gets the attribute from the list of attributes.

Definition at line 408 of file Function.h.

References llvm::AttributeList::getAttribute().

◆ getAttributes()

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

Return the attribute list for this Function.

Definition at line 224 of file Function.h.

Referenced by llvm::Argument::addAttrs(), llvm::analyzeArguments(), llvm::attributesPermitTailCall(), llvm::TargetLowering::BuildSDIVPow2(), CC_MipsO32_FP64(), llvm::CloneFunctionInto(), llvm::FunctionComparator::compareSignature(), copyAttributesFrom(), llvm::createMergeFunctionsPass(), CreatePrologue(), doPromotion(), llvm::XCoreFrameLowering::emitPrologue(), findInitTrampoline(), llvm::CodeExtractor::findInputsOutputs(), findUnwindDestinations(), llvm::AArch64RegisterInfo::getCalleeSavedRegs(), llvm::SystemZRegisterInfo::getCalleeSavedRegs(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), llvm::AArch64RegisterInfo::getCallPreservedMask(), llvm::SystemZRegisterInfo::getCallPreservedMask(), llvm::X86RegisterInfo::getCallPreservedMask(), llvm::ARMBaseRegisterInfo::getCallPreservedMask(), getOpenCLAlignment(), getPow(), getRetComponentType(), getSqrtCall(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::Argument::hasByValOrInAllocaAttr(), hasChangeableCC(), INITIALIZE_PASS(), insertSinCosCall(), isArgPassedInSGPR(), llvm::AMDGPU::isArgPassedInSGPR(), isReportingError(), llvm::PPCInstrInfo::isSignOrZeroExtended(), isThunkProfitable(), LowerADJUST_TRAMPOLINE(), llvm::orc::makeStub(), maybePrintComdat(), llvm::Argument::onlyReadsMemory(), optimizeDoubleFP(), OptimizeFunctions(), llvm::StatepointBase< Function, Instruction, Value, CallSite >::paramHasAttr(), performXorCombine(), produceCompactUnwindFrame(), PushArgMD(), RemoveNestAttribute(), llvm::FunctionLoweringInfo::set(), simplifyDivRem(), useFuncSeen(), and llvm::InstCombiner::visitFDiv().

◆ getBasicBlockList() [1/2]

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

◆ getBasicBlockList() [2/2]

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

Definition at line 634 of file Function.h.

◆ getCallingConv()

CallingConv::ID llvm::Function::getCallingConv ( ) const
inline

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.

Definition at line 213 of file Function.h.

References llvm::CallingConv::MaxID.

Referenced by llvm::AMDGPUMachineFunction::AMDGPUMachineFunction(), llvm::AMDGPUTargetLowering::analyzeFormalArgumentsCompute(), areCallingConvEligibleForTCO_64SVR4(), AssignProtectedObjSet(), llvm::SIInstrInfo::calculateLDSSpillAddress(), callHasRegMask(), CC_MipsO32_FP64(), llvm::AArch64TargetLowering::CCAssignFnForReturn(), llvm::X86Subtarget::classifyGlobalFunctionReference(), combineADDToADDZE(), llvm::FunctionComparator::compareSignature(), computeCalleeSaveRegisterPairs(), copyAttributesFrom(), copyFeaturesToFunction(), CreatePrologue(), llvm::createSIWholeQuadModePass(), llvm::AArch64FrameLowering::determineCalleeSaves(), emitClzero(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), llvm::AVRFrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitEpilogue(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::PPCFrameLowering::emitEpilogue(), llvm::AMDGPU::HSAMD::MetadataStreamerV3::emitKernel(), llvm::AVRFrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), llvm::AArch64FrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::GCNSubtarget::enableIEEEBit(), llvm::X86FrameLowering::enableShrinkWrapping(), findUnwindDestinations(), llvm::MSP430RegisterInfo::getCalleeSavedRegs(), llvm::AVRRegisterInfo::getCalleeSavedRegs(), llvm::AArch64RegisterInfo::getCalleeSavedRegs(), llvm::SIRegisterInfo::getCalleeSavedRegs(), llvm::SystemZRegisterInfo::getCalleeSavedRegs(), llvm::PPCRegisterInfo::getCalleeSavedRegs(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), llvm::AArch64RegisterInfo::getCalleeSavedRegsViaCopy(), llvm::PPCRegisterInfo::getCalleeSavedRegsViaCopy(), llvm::X86RegisterInfo::getCalleeSavedRegsViaCopy(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegsViaCopy(), getCompareCC(), getElementByteSizeValue(), llvm::AMDGPUSubtarget::getExplicitKernArgSize(), llvm::AMDGPUSubtarget::getFlatWorkGroupSizes(), getFPReg(), llvm::X86RegisterInfo::getGPRsForTailCall(), llvm::X86TargetLowering::getMaxSupportedInterleaveFactor(), llvm::Mangler::getNameWithPrefix(), llvm::X86RegisterInfo::getReservedRegs(), getRsrcReg(), GetScratchRegister(), llvm::TargetFrameLowering::getStackAlignmentSkew(), getSubprogram(), llvm::MipsCallLowering::MipsHandler::handle(), llvm::CallLowering::handleAssignments(), hasChangeableCC(), llvm::ARMTargetLowering::hasStandaloneRem(), INITIALIZE_PASS(), llvm::InlineFunction(), isArgPassedInSGPR(), llvm::AMDGPU::isArgPassedInSGPR(), isCallPromotable(), llvm::HexagonTargetLowering::IsEligibleForTailCallOptimization(), llvm::SITargetLowering::isEligibleForTailCallOptimization(), llvm::isKernelFunction(), llvm::GCNSubtarget::isMesaGfxShader(), llvm::AMDGPUSubtarget::isMesaKernel(), llvm::SITargetLowering::isSDNodeSourceOfDivergence(), isSupportedType(), isThunkProfitable(), llvm::SIInstrInfo::legalizeOperands(), LowerADJUST_TRAMPOLINE(), llvm::AArch64CallLowering::lowerCall(), llvm::MipsCallLowering::lowerCall(), llvm::SITargetLowering::LowerCall(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerReturn(), llvm::MipsCallLowering::lowerReturn(), LowerVACOPY(), MatchingStackOffset(), llvm::SITargetLowering::mayBeEmittedAsTailCall(), maybePrintComdat(), mayTailCallThisCC(), llvm::AMDGPUAAResult::pointsToConstantMemory(), llvm::Intrinsic::remangleIntrinsicFunction(), llvm::AArch64FrameLowering::resolveFrameIndexReference(), llvm::FunctionLoweringInfo::set(), llvm::AArch64TargetLowering::supportSplitCSR(), llvm::PPCTargetLowering::supportSplitCSR(), tryToElideArgumentCopy(), llvm::R600InstrInfo::usesTextureCache(), llvm::R600InstrInfo::usesVertexCache(), and X86ChooseCmpImmediateOpcode().

◆ getContext()

LLVMContext & Function::getContext ( ) const

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

Definition at line 193 of file Function.cpp.

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

Referenced by AddAliasScopeMetadata(), llvm::Argument::addAttrs(), addBoundsChecking(), addExclusiveRegPair(), llvm::ARMFrameLowering::adjustForSegmentedStacks(), llvm::OptimizationRemarkEmitter::allowExtraAnalysis(), llvm::MachineIRBuilder::buildConstant(), llvm::coro::buildCoroutineFrame(), llvm::MachineIRBuilder::buildFConstant(), buildFrameType(), llvm::coro::Shape::buildFrom(), llvm::CloneFunctionInto(), combineInstructionsOverFunction(), llvm::ComputeLegalValueVTs(), ConvertImplicitDefToConstZero(), llvm::createDwarfEHPass(), createFPFnStub(), createMaskInstrs(), createMemMoveLoop(), createMemSetLoop(), llvm::createMergeFunctionsPass(), llvm::createPGOFuncNameMetadata(), CreatePrologue(), createResumeEntryBlock(), llvm::createShadowStackGCLoweringPass(), doPromotion(), duplicateCPV(), eliminateRecursiveTailCall(), llvm::OptimizationRemarkEmitter::emit(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), llvm::PMDataManager::emitInstrCountChangedRemark(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), llvm::ARMBaseRegisterInfo::emitLoadConstPool(), emitPostSt(), llvm::AArch64RegisterInfo::emitReservedArgRegCallError(), emitThumb1LoadConstPool(), emitThumb2LoadConstPool(), eraseDeadBBsAndChildren(), llvm::AlignmentFromAssumptionsPass::extractAlignmentInfo(), llvm::FastISel::fastEmit_ri_(), llvm::CodeExtractor::findInputsOutputs(), findUser(), fixupLineNumbers(), llvm::AMDGPULibCalls::fold(), llvm::X86InstrInfo::foldMemoryOperandImpl(), llvm::BlockAddress::get(), llvm::ScalarEvolution::getContext(), llvm::AMDGPU::getIntegerAttribute(), llvm::AMDGPU::getIntegerPairAttribute(), getRetComponentType(), getSignature(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), getSuccPad(), getUnderlyingObjects(), llvm::FunctionLoweringInfo::getValueFromVirtualReg(), getVariantKind(), llvm::MipsCallLowering::MipsHandler::handle(), llvm::CallLowering::handleAssignments(), HandleInlinedEHPad(), hasAnyNonFlatUseOfReg(), llvm::SelectionDAG::init(), INITIALIZE_PASS(), llvm::MachineOptimizationRemark::isEnabled(), llvm::MachineOptimizationRemarkMissed::isEnabled(), llvm::MachineOptimizationRemarkAnalysis::isEnabled(), llvm::OptimizationRemark::isEnabled(), llvm::OptimizationRemarkMissed::isEnabled(), llvm::OptimizationRemarkAnalysis::isEnabled(), llvm::isFreeCall(), IsSafeAndProfitableToMove(), isThunkProfitable(), llvm::ARMLegalizerInfo::legalizeCustom(), llvm::LegalizerHelper::libcall(), LLVMAddTargetDependentFunctionAttr(), llvm::XCoreInstrInfo::loadImmediate(), llvm::BlockAddress::lookup(), llvm::LegalizerHelper::lower(), llvm::MipsCallLowering::lowerCall(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), LowerFPToInt(), lowerLoadRelative(), llvm::MipsCallLowering::lowerReturn(), makeStatepointExplicitImpl(), MarkBlocksLiveIn(), llvm::LegalizerHelper::narrowScalar(), llvm::OptimizationRemarkEmitter::OptimizationRemarkEmitter(), performMaskedAtomicOp(), prepareForSplit(), llvm::MIPrinter::print(), llvm::MachineInstr::print(), llvm::promoteCall(), RemoveNestAttribute(), llvm::ARMTargetLowering::ReplaceNodeResults(), reportIllegalCopy(), llvm::OptimizationRemarkEmitterAnalysis::run(), llvm::legacy::FunctionPassManagerImpl::run(), llvm::ExecutionEngine::runFunctionAsMain(), llvm::ConstantHoistingPass::runImpl(), llvm::LPPassManager::runOnFunction(), llvm::OptimizationRemarkEmitterWrapperPass::runOnFunction(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::MachineOptimizationRemarkEmitterPass::runOnMachineFunction(), selectJumpTableArmEncoding(), llvm::FunctionLoweringInfo::set(), setCoroInfo(), llvm::AArch64TTIImpl::shouldConsiderAddressTypePromotion(), shouldInstrumentBlock(), llvm::BasicBlockPass::skipBasicBlock(), llvm::FunctionPass::skipFunction(), llvm::LoopPass::skipLoop(), llvm::RegionPass::skipRegion(), SortCallTargets(), stripNonValidAttributesFromPrototype(), stripNonValidDataFromBody(), unifyReturnBlockSet(), llvm::UpgradeIntrinsicFunction(), UpgradeIntrinsicFunction1(), UpgradePTESTIntrinsic(), WarnSize(), and llvm::LegalizerHelper::widenScalar().

◆ getDereferenceableBytes()

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

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

Parameters
iAttributeList index, referring to a return value or argument.

Definition at line 435 of file Function.h.

References llvm::AttributeList::getDereferenceableBytes().

◆ getDereferenceableOrNullBytes()

uint64_t llvm::Function::getDereferenceableOrNullBytes ( unsigned  i) const
inline

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

Parameters
iAttributeList index, referring to a return value or argument.

Definition at line 448 of file Function.h.

References llvm::AttributeList::getDereferenceableOrNullBytes().

◆ getEntryBlock() [1/2]

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

Definition at line 640 of file Function.h.

Referenced by addArgumentAttrsFromCallsites(), llvm::CFGMST< Edge, BBInfo >::buildEdges(), llvm::BranchProbabilityInfo::calculate(), calculateStateNumbersForInvokes(), callsiteIsHot(), llvm::CloneAndPruneIntoFromInst(), llvm::colorEHFunclets(), llvm::FunctionComparator::compare(), ComputePostOrders(), llvm::createConstantHoistingPass(), CreatePrologue(), llvm::createScalarizerPass(), llvm::createShadowStackGCLoweringPass(), cxxDtorIsEmpty(), llvm::DemotePHIToStack(), llvm::DemoteRegToStack(), eliminateRecursiveTailCall(), findArgumentCopyElisionCandidates(), llvm::FindFunctionBackedges(), llvm::CodeExtractor::findInputsOutputs(), findLocationForEntrySafepoint(), findTRECandidate(), llvm::FunctionComparator::functionHash(), llvm::MemoryDependenceResults::getDependency(), llvm::GraphTraits< Function * >::getEntryNode(), llvm::GraphTraits< const Function * >::getEntryNode(), getFirstNonAllocaInTheEntryBlock(), GetLocation(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), getParentPad(), getPredState(), GetRMWLibcall(), getSignature(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), getSuccState(), hasSameExtUse(), INITIALIZE_PASS(), llvm::InlineFunction(), InsertRootInitializers(), insertSinCosCall(), instrumentMaskedLoadOrStore(), isAtomic(), isColdCallSite(), isEmptyFunction(), llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), isObjectDereferencedInBlock(), isOnlyReachableViaThisEdge(), llvm::isPotentiallyReachable(), isPromotedInstructionLegal(), llvm::PPCInstrInfo::isSignOrZeroExtended(), isThunkProfitable(), isWrapperOnlyCall(), isZero(), maybePrintComdat(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), mergeCleanupPad(), NegateValue(), prepareForSplit(), llvm::PrepareToSplitEntryBlock(), llvm::JumpThreadingPass::ProcessBlock(), processInternalGlobal(), promoteMemoryToRegister(), llvm::RegionInfo::recalculate(), RedzoneSizeForScale(), relocateInstructionBefore(), relocationViaAlloca(), removeUndefIntroducingPredecessor(), llvm::ConstantHoistingPass::run(), llvm::GVNHoist::run(), llvm::SLPVectorizerPass::runImpl(), runImpl(), llvm::IRTranslator::runOnMachineFunction(), llvm::CaptureTracker::shouldExplore(), shouldInstrumentBlock(), shouldKeepInEntry(), llvm::BasicBlockPass::skipBasicBlock(), llvm::RegionPass::skipRegion(), llvm::fuzzerop::splitBlockDescriptor(), StackMallocSizeClass(), TryToMergeLandingPad(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), TypeSizeToSizeIndex(), UpdateAnalysisInformation(), valueDominatesPHI(), and llvm::InstCombiner::visitAllocaInst().

◆ getEntryBlock() [2/2]

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

Definition at line 641 of file Function.h.

◆ getEntryCount()

ProfileCount Function::getEntryCount ( ) const

◆ getFnAttribute() [1/2]

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

Return the attribute for the given attribute kind.

Definition at line 331 of file Function.h.

References llvm::AttributeList::FunctionIndex.

Referenced by adjustCallerStackProbes(), adjustCallerStackProbeSize(), adjustMinLegalVectorWidth(), adjustNullPointerValidAttr(), llvm::NVPTXTargetLowering::allowUnsafeFPMath(), llvm::TargetTransformInfoImplBase::areFunctionArgsABICompatible(), llvm::TargetTransformInfoImplBase::areInlineCompatible(), llvm::TargetLoweringBase::areJTsAllowed(), llvm::ARMTargetLowering::CCAssignFnForReturn(), checkFunctionsAttributeConsistency(), combineADDToADDZE(), llvm::TargetOptions::DisableFramePointerElim(), doesNotGeneratecode(), eliminateTailRecursion(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), foldFPToIntToFP(), getAllocationSize(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), getDeoptLowering(), llvm::TargetLoweringObjectFileELF::getExplicitSectionGlobal(), llvm::AMDGPUTargetMachine::getFeatureString(), llvm::AMDGPUTargetMachine::getGPUName(), llvm::AMDGPU::getIntegerAttribute(), llvm::AMDGPU::getIntegerPairAttribute(), getMOVL(), getRecipEstimateForFunc(), llvm::X86TargetLowering::getStackProbeSymbolName(), getSubOpcode(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), hasUnsafeFPMath(), INITIALIZE_PASS(), isEqual(), llvm::RecurrenceDescriptor::isReductionPHI(), isThumbFunction(), llvm::LoopVectorizationLegality::isUniform(), llvm::AMDGPULibCalls::isUnsafeMath(), llvm::HexagonTargetLowering::LowerCall(), LowerInterruptReturn(), MatchReductions(), llvm::HexagonTargetLowering::mayBeEmittedAsTailCall(), llvm::SITargetLowering::mayBeEmittedAsTailCall(), llvm::AsmPrinter::recordSled(), replaceShuffleOfInsert(), llvm::TargetMachine::resetTargetOptions(), RetagMask(), llvm::WholeProgramDevirtPass::run(), runOnFunction(), llvm::StackProtector::runOnFunction(), shouldGuaranteeTCO(), ShouldSignReturnAddress(), ShouldSignWithAKey(), SimplifyNVVMIntrinsic(), unpackF64OnRV32DSoftABI(), llvm::NVPTXTargetLowering::useF32FTZ(), WindowsRequiresStackProbe(), and windowsRequiresStackProbe().

◆ getFnAttribute() [2/2]

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

Return the attribute for the given attribute kind.

Definition at line 336 of file Function.h.

References llvm::AttributeList::FunctionIndex.

◆ getFnStackAlignment()

unsigned llvm::Function::getFnStackAlignment ( ) const
inline

◆ getFunction()

const Function& llvm::Function::getFunction ( ) const
inline

◆ getFunctionType()

FunctionType* llvm::Function::getFunctionType ( ) const
inline

Returns the FunctionType for me.

Definition at line 164 of file Function.h.

Referenced by assureFPCallStub(), llvm::Interpreter::callExternalFunction(), llvm::Interpreter::callFunction(), CallingConvSupported(), canCreateAliasFor(), canTransformToMemCmp(), CC_Lanai32_VarArg(), CC_RISCV(), llvm::CloneFunction(), llvm::FunctionComparator::compareSignature(), llvm::CallInst::Create(), llvm::InvokeInst::Create(), llvm::IRBuilder< TargetFolder >::CreateCall(), llvm::createDeadArgHackingPass(), createFPFnStub(), llvm::IRBuilder< TargetFolder >::CreateInvoke(), llvm::IRBuilder< TargetFolder >::CreateLaunderInvariantGroup(), llvm::IRBuilder< TargetFolder >::CreateStripInvariantGroup(), CreateWrapper(), doPromotion(), eliminateTailRecursion(), llvm::WebAssemblyAsmPrinter::EmitFunctionBodyStart(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::Evaluator::EvaluateBlock(), llvm::CodeExtractor::extractCodeRegion(), forceRenaming(), getAllocationDataForFunction(), llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getCallCost(), llvm::Evaluator::getFormalParams(), llvm::TargetLibraryInfoImpl::getLibFunc(), llvm::Mangler::getNameWithPrefix(), getParentPad(), getRetComponentType(), getSignature(), getSuccPad(), INITIALIZE_PASS(), llvm::InlineFunction(), isCallPromotable(), llvm::isFreeCall(), isKnownTypeIdMember(), llvm::isLegalToPromote(), isReportingError(), isThunkProfitable(), lookupFunction(), LowerADJUST_TRAMPOLINE(), llvm::HexagonTargetLowering::LowerFormalArguments(), llvm::SITargetLowering::LowerFormalArguments(), lowerObjCCall(), maybePrintComdat(), needsFPStubFromParams(), llvm::DiagnosticInfoUnsupported::print(), llvm::promoteCall(), PushArgMD(), llvm::Intrinsic::remangleIntrinsicFunction(), llvm::DeadArgumentEliminationPass::run(), llvm::Interpreter::runFunction(), llvm::MCJIT::runFunction(), llvm::orc::OrcMCJITReplacement::runFunction(), llvm::ExecutionEngine::runFunctionAsMain(), ShrinkDemandedConstant(), UpgradeIntrinsicFunction1(), UpgradePTESTIntrinsic(), UpgradeX86IntrinsicFunction(), UpgradeX86IntrinsicsWith8BitMask(), and whichFPParamVariantNeeded().

◆ getGC()

const std::string & Function::getGC ( ) const

◆ getImportGUIDs()

DenseSet< GlobalValue::GUID > Function::getImportGUIDs ( ) const

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.

Definition at line 1402 of file Function.cpp.

References llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::insert(), and llvm::LLVMContext::MD_prof.

◆ getInstructionCount()

unsigned Function::getInstructionCount ( ) const

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.

Definition at line 197 of file Function.cpp.

Referenced by llvm::LPPassManager::runOnFunction(), and llvm::FPPassManager::runOnFunction().

◆ getIntrinsicID()

Intrinsic::ID llvm::Function::getIntrinsicID ( ) const
inline

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

Referenced by llvm::CallGraphNode::addCalledFunction(), addIntrinsicToSummary(), asmClobbersCTR(), llvm::canConstantFoldCallTo(), computeKnownBitsFromAssume(), llvm::ConstantFoldCall(), copyFeaturesToFunction(), CreateGCRelocates(), llvm::createShadowStackGCLoweringPass(), llvm::VerifierSupport::DebugInfoCheckFailed(), DeleteBasicBlock(), llvm::findDevirtualizableCallsForTypeCheckedLoad(), llvm::findDevirtualizableCallsForTypeTest(), llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getCallCost(), llvm::objcarc::GetFunctionClass(), llvm::getIntrinsicForCallSite(), llvm::IntrinsicInst::getIntrinsicID(), getOffsetFromIndices(), getParentPad(), getScalarIntrinsicDeclaration(), getSignature(), getSqrtCall(), getSuccPad(), handleBrSelExpect(), handleSwitchExpect(), hasOnlyColdCalls(), INITIALIZE_PASS(), InsertRootInitializers(), inversePermutation(), isFuncOrArgAttr(), llvm::isInlineViable(), lowerExpectIntrinsic(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::AMDGPUSubtarget::makeLIDRangeMetadata(), makeStatepointExplicitImpl(), markAliveBlocks(), optimizeDoubleFP(), llvm::Intrinsic::remangleIntrinsicFunction(), llvm::returnTypeIsEligibleForTailCall(), llvm::LoopDataPrefetchPass::run(), llvm::FastISel::selectInstruction(), simplifyBinaryIntrinsic(), simplifyIntrinsic(), simplifyUnaryIntrinsic(), llvm::UpgradeIntrinsicFunction(), useFuncSeen(), and llvm::Interpreter::visitCallSite().

◆ getParamAlignment()

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

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

Definition at line 428 of file Function.h.

References llvm::AttributeList::getParamAlignment().

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

◆ getParamDereferenceableBytes()

uint64_t llvm::Function::getParamDereferenceableBytes ( unsigned  ArgNo) const
inline

Extract the number of dereferenceable bytes for a parameter.

Parameters
ArgNoIndex of an argument, with 0 being the first function arg.

Definition at line 441 of file Function.h.

References llvm::AttributeList::getParamDereferenceableBytes().

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

◆ getParamDereferenceableOrNullBytes()

uint64_t llvm::Function::getParamDereferenceableOrNullBytes ( unsigned  ArgNo) const
inline

Extract the number of dereferenceable_or_null bytes for a parameter.

Parameters
ArgNoAttributeList ArgNo, referring to an argument.

Definition at line 455 of file Function.h.

References llvm::AttributeList::getParamDereferenceableOrNullBytes().

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

◆ getPersonalityFn()

Constant * Function::getPersonalityFn ( ) const

Get the personality function associated with this function.

Definition at line 1299 of file Function.cpp.

References assert().

Referenced by llvm::WinException::beginFunclet(), llvm::DwarfCFIException::beginFunction(), llvm::WinException::beginFunction(), llvm::CodeViewDebug::beginFunctionImpl(), llvm::canSimplifyInvokeNoUnwind(), llvm::rdf::DataFlowGraph::DefStack::clear_block(), llvm::CloneFunctionInto(), llvm::LoopSafetyInfo::computeBlockColors(), copyAttributesFrom(), createCallInst(), llvm::createObjCARCOptPass(), createPHIsForCMOVsInSinkBB(), llvm::XCoreFrameLowering::emitEpilogue(), llvm::AArch64TargetLowering::EmitLoweredCatchRet(), llvm::XCoreFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::WinException::endFunclet(), llvm::ARMException::endFunction(), llvm::WinException::endFunction(), llvm::CodeExtractor::extractCodeRegion(), findUnwindDestinations(), llvm::getEHScopeMembership(), getMOVL(), getSEHRegistrationNodeSize(), INITIALIZE_PASS(), llvm::InlineFunction(), isFuncletReturnInstr(), isSortedByValueNo(), isUsingScopeBasedEH(), llvm::MachineFunction::MachineFunction(), mapWasmLandingPadIndex(), MarkBlocksLiveIn(), matchPair(), maybePrintComdat(), mergeCleanupPad(), needFuncLabelsForEHOrDebugInfo(), llvm::X86FrameLowering::processFunctionBeforeFrameFinalized(), llvm::X86FrameLowering::restoreCalleeSavedRegisters(), llvm::StackProtector::runOnFunction(), llvm::FunctionLoweringInfo::set(), shouldInstrumentBlock(), llvm::X86FrameLowering::spillCalleeSavedRegisters(), and llvm::InstCombiner::visitLandingPadInst().

◆ getPrefixData()

Constant * Function::getPrefixData ( ) const

Get the prefix data associated with this function.

Definition at line 1309 of file Function.cpp.

References assert().

Referenced by copyAttributesFrom(), llvm::AsmPrinter::EmitDebugValue(), and maybePrintComdat().

◆ getPrologueData()

Constant * Function::getPrologueData ( ) const

Get the prologue data associated with this function.

Definition at line 1319 of file Function.cpp.

References assert().

Referenced by copyAttributesFrom(), llvm::AsmPrinter::EmitDebugValue(), and maybePrintComdat().

◆ getReturnType()

Type* llvm::Function::getReturnType ( ) const
inline

Returns the type of the ret val.

Definition at line 169 of file Function.h.

Referenced by assureFPCallStub(), llvm::Interpreter::callFunction(), CC_MipsO32_FP64(), llvm::ConstantFoldCall(), copyMustTailReturn(), llvm::IRBuilder< TargetFolder >::CreateLaunderInvariantGroup(), llvm::IRBuilder< TargetFolder >::CreateStripInvariantGroup(), ExpandBVWithShuffles(), explicifyGuards(), llvm::CodeExtractor::findInputsOutputs(), FindPredecessorAutoreleaseWithSafePath(), findUnwindDestinations(), getCompareCC(), llvm::IRBuilderBase::getCurrentFunctionReturnType(), getParentPad(), getRetComponentType(), llvm::MipsCCState::getSpecialCallingConvForCallee(), getSuccPad(), llvm::HexagonTargetLowering::getTgtMemIntrinsic(), getX86SSEConditionCode(), llvm::InlineFunction(), llvm::isLegalToPromote(), isReturnNonNull(), llvm::PPCInstrInfo::isSignOrZeroExtended(), isThunkProfitable(), LowerFPOWI(), lowerGuardIntrinsic(), llvm::BPFTargetLowering::LowerOperation(), llvm::NVPTXTargetLowering::LowerReturn(), llvm::makeGuardControlFlowExplicit(), llvm::orc::makeStub(), MatchingStackOffset(), maybePrintComdat(), needsFPFromSig(), needsFPReturnHelper(), NumRetVals(), llvm::promoteCall(), PropagateConstantReturn(), llvm::runIPSCCP(), llvm::FastISel::selectStackmap(), llvm::FunctionLoweringInfo::set(), setRetNonNull(), shouldKeepInEntry(), simplifyBinaryIntrinsic(), simplifyIntrinsic(), stripNonValidAttributesFromPrototype(), tryToElideArgumentCopy(), unifyReturnBlockSet(), unpackF64OnRV32DSoftABI(), UpgradeIntrinsicFunction1(), and X86ChooseCmpImmediateOpcode().

◆ getSectionPrefix()

Optional< StringRef > Function::getSectionPrefix ( ) const

Get the section prefix for this function.

Definition at line 1420 of file Function.cpp.

References assert(), llvm::LLVMContext::MD_section_prefix, and llvm::None.

Referenced by callsShareTOCBase().

◆ getSublistAccess()

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

Definition at line 636 of file Function.h.

◆ getSubprogram()

DISubprogram * Function::getSubprogram ( ) const

◆ getValueSymbolTable() [1/2]

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

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

Definition at line 648 of file Function.h.

Referenced by emitSignedInt64(), FunctionNumber(), llvm::MIRParserImpl::initializeFrameInfo(), and toString().

◆ getValueSymbolTable() [2/2]

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

Definition at line 649 of file Function.h.

◆ hasAddressTaken()

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

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

Referenced by llvm::canRenameComdatFunc(), llvm::canTrackArgumentsInterprocedurally(), llvm::createDeadArgHackingPass(), llvm::createX86IndirectBranchTrackingPass(), hasOnlyColdCalls(), hasProfileData(), INITIALIZE_PASS(), llvm::TargetFrameLowering::isSafeForNoCSROpt(), OptimizeFunctions(), selectJumpTableArmEncoding(), and shouldRecordFunctionAddr().

◆ hasAttribute()

bool llvm::Function::hasAttribute ( unsigned  i,
Attribute::AttrKind  Kind 
) const
inline

check if an attributes is in the list of attributes.

Definition at line 393 of file Function.h.

References llvm::Intrinsic::getAttributes(), and llvm::AttributeList::hasAttribute().

Referenced by setRetDoesNotAlias(), and setRetNonNull().

◆ hasFnAttribute() [1/2]

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

Return true if the function has the attribute.

Definition at line 321 of file Function.h.

References llvm::AttributeList::hasFnAttribute().

Referenced by llvm::AArch64FunctionInfo::AArch64FunctionInfo(), addEpilogOnlyR10(), addForcedAttributes(), adjustCallerSSPLevel(), adjustCallerStackProbes(), adjustCallerStackProbeSize(), adjustMinLegalVectorWidth(), llvm::NVPTXTargetLowering::allowUnsafeFPMath(), allPredecessorsComeFromSameSource(), llvm::CodeViewDebug::beginFunctionImpl(), llvm::buildModuleSummaryIndex(), calculateSetFPREG(), llvm::AArch64TargetLowering::canMergeStoresTo(), llvm::X86TargetLowering::canMergeStoresTo(), llvm::TargetRegisterInfo::canRealignStack(), llvm::canTrackReturnsInterprocedurally(), canTransformToMemCmp(), llvm::AArch64FrameLowering::canUseRedZone(), changeFCMPPredToAArch64CC(), checkNumAlignedDPRCS2Regs(), llvm::X86Subtarget::classifyGlobalFunctionReference(), combineStore(), computeCalleeSaveRegisterPairs(), llvm::createAMDGPUFunctionInliningPass(), llvm::createDeadArgHackingPass(), llvm::createLoadStoreVectorizerPass(), llvm::createSampleProfileLoaderPass(), llvm::createSIWholeQuadModePass(), llvm::RISCVFrameLowering::determineCalleeSaves(), llvm::TargetFrameLowering::determineCalleeSaves(), llvm::PPCFrameLowering::determineFrameLayout(), llvm::TargetOptions::DisableFramePointerElim(), doesNotGeneratecode(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::MipsSEFrameLowering::emitEpilogue(), llvm::MipsAsmPrinter::EmitFunctionBodyStart(), EmitGCCInlineAsmStr(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), emitPostSt(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::SystemZFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::ARMFrameLowering::enableCalleeSaveSkip(), llvm::TargetFrameLowering::enableCalleeSaveSkip(), llvm::X86FrameLowering::enableShrinkWrapping(), EqualityPropUnSafe(), FindLIVLoopCondition(), findStackProtectorIntrinsic(), FoldTwoEntryPHINode(), get64BitArgumentXMMs(), llvm::RISCVRegisterInfo::getCalleeSavedRegs(), llvm::X86RegisterInfo::getCalleeSavedRegs(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), llvm::RISCVRegisterInfo::getCallPreservedMask(), llvm::AArch64RegisterInfo::getCallPreservedMask(), getDeoptLowering(), getDivRemArgList(), llvm::ARMTargetLowering::getExceptionSelectorRegister(), llvm::TargetLoweringObjectFileELF::getExplicitSectionGlobal(), getFnStackAlignment(), llvm::getInlineCost(), llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), llvm::GCNSubtarget::getMaxNumSGPRs(), llvm::GCNSubtarget::getMaxNumVGPRs(), llvm::X86TargetLowering::getMaxSupportedInterleaveFactor(), llvm::ARMBaseInstrInfo::getOperandLatency(), llvm::MipsTargetLowering::getOpndList(), llvm::ARMTargetLowering::getOptimalMemOpType(), llvm::AArch64TargetLowering::getOptimalMemOpType(), llvm::X86TargetLowering::getOptimalMemOpType(), llvm::PPCTargetLowering::getOptimalMemOpType(), llvm::AArch64InstrInfo::getOutliningCandidateInfo(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::AArch64RegisterInfo::getReservedRegs(), getRetComponentType(), llvm::MipsCCState::getSpecialCallingConvForCallee(), llvm::X86TargetLowering::getStackProbeSymbolName(), getSubOpcode(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::AMDGPUSubtarget::getWavesPerEU(), giveUpWithRemarks(), handleAttr(), llvm::HexagonFrameLowering::hasFP(), hasProfileData(), hasReturnsTwiceAttr(), llvm::ARMTargetLowering::hasStandaloneRem(), hasVulnerableLoad(), INITIALIZE_PASS(), llvm::AArch64TargetLowering::insertCopiesSplitCSR(), llvm::PPCTargetLowering::insertCopiesSplitCSR(), instrumentMaskedLoadOrStore(), isAtomic(), isEFLAGSLive(), llvm::ProfileSummaryInfo::isFunctionEntryCold(), llvm::X86InstrInfo::isFunctionSafeToOutlineFrom(), llvm::isInlineViable(), llvm::X86TargetLowering::isIntDivCheap(), llvm::PPCTargetLowering::isLegalAddressingMode(), isNoReturnDef(), isOptNone(), llvm::TargetFrameLowering::isSafeForNoCSROpt(), llvm::isSafeToSpeculativelyExecute(), isSortedByValueNo(), llvm::MipsSEInstrInfo::loadRegFromStack(), LowerInterruptReturn(), llvm::MachineFunction::MachineFunction(), MatchingStackOffset(), mayLoopAccessLocation(), mayTailCallThisCC(), llvm::PPCFrameLowering::needsFP(), llvm::WebAssemblyFrameLowering::needsPrologForEH(), llvm::TargetRegisterInfo::needsStackRealignment(), OptimizeFunctions(), Passv64i1ArgInRegs(), performBRCONDCombine(), PGOMemOPSizeOptImpl(), promoteArguments(), PropagateConstantReturn(), llvm::AsmPrinter::recordSled(), llvm::LegacyInlinerBase::removeDeadFunctions(), removeUseSoftFloat(), replaceDevirtTrigger(), reportLoadElim(), RetagMask(), llvm::LoadStoreVectorizerPass::run(), llvm::WarnMissedTransformationsPass::run(), llvm::PostOrderFunctionAttrsPass::run(), llvm::InlinerPass::run(), llvm::SLPVectorizerPass::runImpl(), runImpl(), llvm::ARMAsmPrinter::runOnMachineFunction(), setNonLazyBind(), llvm::TargetMachine::shouldAssumeDSOLocal(), shouldRecordFunctionAddr(), ShouldSignReturnAddress(), ShouldSignWithAKey(), llvm::MachineFunction::shouldSplitStack(), ShrinkLoadReplaceStoreWithStore(), llvm::BasicBlockPass::skipBasicBlock(), llvm::FunctionPass::skipFunction(), llvm::LoopPass::skipLoop(), llvm::RegionPass::skipRegion(), llvm::MipsSEFrameLowering::spillCalleeSavedRegisters(), llvm::AArch64FrameLowering::spillCalleeSavedRegisters(), llvm::MipsSEInstrInfo::storeRegToStack(), llvm::AArch64TargetLowering::supportSplitCSR(), llvm::PPCTargetLowering::supportSplitCSR(), TypeSizeToSizeIndex(), unpackF64OnRV32DSoftABI(), UnpackFromArgumentSlot(), llvm::NVPTXTargetLowering::useF32FTZ(), WindowsRequiresStackProbe(), and windowsRequiresStackProbe().

◆ hasFnAttribute() [2/2]

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

Return true if the function has the attribute.

Definition at line 326 of file Function.h.

References llvm::AttributeList::hasFnAttribute().

◆ hasGC()

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

◆ hasLazyArguments()

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

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.

Definition at line 105 of file Function.h.

References N.

Referenced by stealArgumentListFrom().

◆ hasParamAttribute()

bool llvm::Function::hasParamAttribute ( unsigned  ArgNo,
Attribute::AttrKind  Kind 
) const
inline

◆ hasPersonalityFn()

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

◆ hasPrefixData()

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

Check whether this function has prefix data.

Definition at line 711 of file Function.h.

Referenced by copyAttributesFrom(), llvm::AsmPrinter::EmitDebugValue(), and maybePrintComdat().

◆ hasProfileData()

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

◆ hasPrologueData()

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

Check whether this function has prologue data.

Definition at line 720 of file Function.h.

References print().

Referenced by copyAttributesFrom(), llvm::AsmPrinter::EmitDebugValue(), and maybePrintComdat().

◆ hasStructRetAttr()

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

◆ hasUWTable()

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

References llvm::Attribute::UWTable.

Referenced by llvm::CodeExtractor::findInputsOutputs().

◆ isConvergent()

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

Determine if the call is convergent.

Definition at line 536 of file Function.h.

References llvm::Attribute::Convergent.

◆ isDebugInfoForProfiling()

bool Function::isDebugInfoForProfiling ( ) const

Returns true if we should emit debug info for profiling.

Definition at line 1512 of file Metadata.cpp.

References getSubprogram().

Referenced by llvm::UnrollAndJamLoop(), and llvm::UnrollLoop().

◆ isDefTriviallyDead()

bool Function::isDefTriviallyDead ( ) const

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

To make this more accurate, call removeDeadConstantUsers first.

Definition at line 1274 of file Function.cpp.

References llvm::Value::users().

Referenced by optimizeGlobalsInModule(), llvm::LegacyInlinerBase::removeDeadFunctions(), and llvm::AlwaysInlinerPass::run().

◆ isIntrinsic()

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

◆ isMaterializable()

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

Definition at line 179 of file Function.h.

Referenced by maybePrintComdat().

◆ isSpeculatable()

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

Determine if the call has sideeffects.

Definition at line 547 of file Function.h.

References llvm::Attribute::Speculatable.

Referenced by getSuccPad().

◆ isVarArg()

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

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

Definition at line 177 of file Function.h.

Referenced by llvm::ARMFrameLowering::adjustForSegmentedStacks(), llvm::X86FrameLowering::adjustForSegmentedStacks(), CC_MipsO32_FP64(), combineADDToADDZE(), llvm::FunctionComparator::compareSignature(), createCallInst(), llvm::XCoreFunctionInfo::createLRSpillSlot(), CreateWrapper(), llvm::SystemZFrameLowering::determineCalleeSaves(), llvm::XCoreFrameLowering::determineCalleeSaves(), determinePointerReadAttrs(), llvm::ARCFrameLowering::emitEpilogue(), llvm::ARCFrameLowering::emitPrologue(), llvm::CodeExtractor::findInputsOutputs(), findUnwindDestinations(), llvm::FunctionComparator::functionHash(), getCompareCC(), llvm::AMDGPULibFunc::getFunction(), llvm::AMDGPULibFunc::getOrInsertFunction(), llvm::CallLowering::handleAssignments(), hasOnlyColdCalls(), INITIALIZE_PASS(), llvm::isLegalToPromote(), isSupportedType(), lookupFunction(), LowerADJUST_TRAMPOLINE(), llvm::MipsCallLowering::lowerCall(), llvm::X86CallLowering::lowerFormalArguments(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerReturn(), OptimizeFunctions(), promoteArguments(), llvm::FunctionLoweringInfo::set(), llvm::SystemZFrameLowering::spillCalleeSavedRegisters(), tryToElideArgumentCopy(), and X86ChooseCmpImmediateOpcode().

◆ lookupIntrinsicID()

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

This does the actual lookup of an intrinsic ID which matches the given function name.

Definition at line 535 of file Function.cpp.

References assert(), llvm::ArrayRef< T >::data(), findTargetSubtable(), IntrinsicNameTable, llvm::Intrinsic::isOverloaded(), llvm::Intrinsic::lookupLLVMIntrinsicByName(), llvm::Intrinsic::not_intrinsic, and llvm::StringRef::size().

◆ needsUnwindTableEntry()

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

◆ nullPointerIsDefined()

bool Function::nullPointerIsDefined ( ) const

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.

Definition at line 1431 of file Function.cpp.

Referenced by adjustNullPointerValidAttr(), llvm::getInlineCost(), and llvm::NullPointerIsDefined().

◆ onlyAccessesArgMemory()

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

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

Definition at line 485 of file Function.h.

References llvm::Attribute::ArgMemOnly.

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

◆ onlyAccessesInaccessibleMemOrArgMem()

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

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

Definition at line 501 of file Function.h.

References llvm::Attribute::InaccessibleMemOrArgMemOnly.

Referenced by llvm::BasicAAResult::getModRefBehavior().

◆ onlyAccessesInaccessibleMemory()

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

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

Definition at line 492 of file Function.h.

References llvm::Attribute::InaccessibleMemOnly.

Referenced by llvm::BasicAAResult::getModRefBehavior().

◆ onlyReadsMemory()

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

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

Definition at line 468 of file Function.h.

References llvm::Attribute::ReadOnly.

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

◆ operator=()

void llvm::Function::operator= ( const Function )
delete

◆ optForMinSize()

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

◆ optForSize()

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

◆ print()

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

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

Definition at line 4054 of file AsmWriter.cpp.

References getParent(), and llvm::RISCVFenceField::W.

Referenced by intersect(), and isMustExecuteIn().

◆ recalculateIntrinsicID()

void Function::recalculateIntrinsicID ( )

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

References llvm::Value::getName(), Name, llvm::Intrinsic::not_intrinsic, and llvm::StringRef::startswith().

◆ removeAttribute() [1/2]

void Function::removeAttribute ( unsigned  i,
Attribute::AttrKind  Kind 
)

removes the attribute from the list of attributes.

Definition at line 404 of file Function.cpp.

References llvm::Intrinsic::getAttributes(), llvm::Value::getContext(), and llvm::AttributeList::removeAttribute().

Referenced by runOnFunction().

◆ removeAttribute() [2/2]

void Function::removeAttribute ( unsigned  i,
StringRef  Kind 
)

removes the attribute from the list of attributes.

Definition at line 410 of file Function.cpp.

References llvm::Intrinsic::getAttributes(), llvm::Value::getContext(), and llvm::AttributeList::removeAttribute().

◆ removeAttributes()

void Function::removeAttributes ( unsigned  i,
const AttrBuilder Attrs 
)

◆ removeFnAttr() [1/2]

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

Remove function attributes from this function.

Definition at line 246 of file Function.h.

References llvm::AttributeList::FunctionIndex.

Referenced by adjustMinLegalVectorWidth(), and INITIALIZE_PASS().

◆ removeFnAttr() [2/2]

void llvm::Function::removeFnAttr ( StringRef  Kind)
inline

Remove function attribute from this function.

Definition at line 251 of file Function.h.

References llvm::AttributeList::FunctionIndex, and llvm::Intrinsic::getAttributes().

◆ removeFromParent()

void Function::removeFromParent ( )

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

Definition at line 210 of file Function.cpp.

References llvm::Argument::getParent().

◆ removeParamAttr() [1/2]

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

removes the attribute from the list of attributes.

Definition at line 422 of file Function.cpp.

References llvm::Intrinsic::getAttributes(), llvm::Value::getContext(), and llvm::AttributeList::removeParamAttribute().

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

◆ removeParamAttr() [2/2]

void Function::removeParamAttr ( unsigned  ArgNo,
StringRef  Kind 
)

removes the attribute from the list of attributes.

Definition at line 428 of file Function.cpp.

References llvm::Intrinsic::getAttributes(), llvm::Value::getContext(), and llvm::AttributeList::removeParamAttribute().

◆ removeParamAttrs()

void Function::removeParamAttrs ( unsigned  ArgNo,
const AttrBuilder Attrs 
)

removes the attribute from the list of attributes.

Definition at line 434 of file Function.cpp.

References llvm::Intrinsic::getAttributes(), llvm::Value::getContext(), and llvm::AttributeList::removeParamAttributes().

◆ returnDoesNotAlias()

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

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

Definition at line 586 of file Function.h.

References llvm::AttributeList::hasAttribute(), llvm::Attribute::NoAlias, and llvm::AttributeList::ReturnIndex.

Referenced by llvm::buildModuleSummaryIndex().

◆ setAttributes()

void llvm::Function::setAttributes ( AttributeList  Attrs)
inline

◆ setCallingConv()

void llvm::Function::setCallingConv ( CallingConv::ID  CC)
inline

◆ setCannotDuplicate()

void llvm::Function::setCannotDuplicate ( )
inline

Definition at line 531 of file Function.h.

References llvm::Attribute::NoDuplicate.

◆ setConvergent()

void llvm::Function::setConvergent ( )
inline

Definition at line 539 of file Function.h.

References llvm::Attribute::Convergent.

◆ setDoesNotAccessMemory()

void llvm::Function::setDoesNotAccessMemory ( )
inline

Definition at line 463 of file Function.h.

References llvm::Attribute::ReadNone.

Referenced by setDoesNotAccessMemory().

◆ setDoesNotReadMemory()

void llvm::Function::setDoesNotReadMemory ( )
inline

Definition at line 479 of file Function.h.

References llvm::Attribute::WriteOnly.

◆ setDoesNotRecurse()

void llvm::Function::setDoesNotRecurse ( )
inline

Definition at line 559 of file Function.h.

References llvm::Attribute::NoRecurse.

Referenced by setDoesNotRecurse().

◆ setDoesNotReturn()

void llvm::Function::setDoesNotReturn ( )
inline

Definition at line 512 of file Function.h.

References llvm::Attribute::NoReturn.

◆ setDoesNotThrow()

void llvm::Function::setDoesNotThrow ( )
inline

◆ setEntryCount() [1/2]

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

Set the entry count for this function.

Entry count is the number of times this function was executed based on pgo data. 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.

Definition at line 1363 of file Function.cpp.

References assert(), llvm::Value::getContext(), llvm::Function::ProfileCount::getCount(), llvm::Function::ProfileCount::getType(), llvm::Function::ProfileCount::hasValue(), llvm::Function::ProfileCount::isSynthetic(), llvm::LLVMContext::MD_prof, and setMetadata().

Referenced by llvm::createSampleProfileLoaderPass(), llvm::CodeExtractor::extractCodeRegion(), SortCallTargets(), and updateCalleeCount().

◆ setEntryCount() [2/2]

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

A convenience wrapper for setting entry count.

Definition at line 1376 of file Function.cpp.

◆ setGC()

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

◆ setHasUWTable()

void llvm::Function::setHasUWTable ( )
inline

Definition at line 568 of file Function.h.

References llvm::Attribute::UWTable.

Referenced by llvm::CodeExtractor::findInputsOutputs().

◆ setIsMaterializable()

void llvm::Function::setIsMaterializable ( bool  V)
inline

Definition at line 182 of file Function.h.

References llvm::BitmaskEnumDetail::Mask().

◆ setNotConvergent()

void llvm::Function::setNotConvergent ( )
inline

Definition at line 542 of file Function.h.

References llvm::Attribute::Convergent.

◆ setOnlyAccessesArgMemory()

void llvm::Function::setOnlyAccessesArgMemory ( )
inline

Definition at line 488 of file Function.h.

References llvm::Attribute::ArgMemOnly.

Referenced by setOnlyAccessesArgMemory().

◆ setOnlyAccessesInaccessibleMemOrArgMem()

void llvm::Function::setOnlyAccessesInaccessibleMemOrArgMem ( )
inline

Definition at line 504 of file Function.h.

References llvm::Attribute::InaccessibleMemOrArgMemOnly.

◆ setOnlyAccessesInaccessibleMemory()

void llvm::Function::setOnlyAccessesInaccessibleMemory ( )
inline

Definition at line 495 of file Function.h.

References llvm::Attribute::InaccessibleMemOnly.

◆ setOnlyReadsMemory()

void llvm::Function::setOnlyReadsMemory ( )
inline

Definition at line 471 of file Function.h.

References llvm::Attribute::ReadOnly.

Referenced by setOnlyReadsMemory().

◆ setPersonalityFn()

void Function::setPersonalityFn ( Constant Fn)

◆ setPrefixData()

void Function::setPrefixData ( Constant PrefixData)

Definition at line 1314 of file Function.cpp.

Referenced by FunctionNumber().

◆ setPrologueData()

void Function::setPrologueData ( Constant PrologueData)

◆ setReturnDoesNotAlias()

void llvm::Function::setReturnDoesNotAlias ( )
inline

Definition at line 590 of file Function.h.

References llvm::Attribute::NoAlias, and llvm::AttributeList::ReturnIndex.

◆ setSectionPrefix()

void Function::setSectionPrefix ( StringRef  Prefix)

Set the section prefix for this function.

Definition at line 1414 of file Function.cpp.

References llvm::MDBuilder::createFunctionSectionPrefix(), llvm::Value::getContext(), llvm::LLVMContext::MD_section_prefix, and setMetadata().

Referenced by llvm::createCodeGenPreparePass().

◆ setSpeculatable()

void llvm::Function::setSpeculatable ( )
inline

Definition at line 550 of file Function.h.

References llvm::Attribute::Speculatable.

◆ setSubprogram()

void Function::setSubprogram ( DISubprogram SP)

Set the attached subprogram.

Calls setMetadata() with LLVMContext::MD_dbg.

Definition at line 1504 of file Metadata.cpp.

References llvm::LLVMContext::MD_dbg, and setMetadata().

Referenced by doPromotion(), INITIALIZE_PASS(), and llvm::stripDebugInfo().

◆ size()

size_t llvm::Function::size ( ) const
inline

◆ stealArgumentListFrom()

void Function::stealArgumentListFrom ( Function Src)

Steal arguments from another function.

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

Definition at line 301 of file Function.cpp.

References llvm::all_of(), arg_size(), Arguments, assert(), llvm::SmallVectorBase::empty(), llvm::Value::getSubclassDataFromValue(), hasLazyArguments(), makeArgArray(), Name, llvm::Value::setValueSubclassData(), and llvm::Value::use_empty().

◆ viewCFG()

void 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.

You can just say 'call F->viewCFG()' and a ghostview window should pop up from the program, displaying the CFG of the current function. This depends on there being a 'dot' and 'gv' program in your path.

Definition at line 177 of file CFGPrinter.cpp.

References CFGFuncName, llvm::StringRef::contains(), getName(), and ViewGraph().

Referenced by LLVMViewFunctionCFG().

◆ viewCFGOnly()

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 188 of file CFGPrinter.cpp.

References CFGFuncName, llvm::StringRef::contains(), getName(), and ViewGraph().

Referenced by LLVMViewFunctionCFGOnly(), and llvm::CFGViewerPass::run().

Friends And Related Function Documentation

◆ SymbolTableListTraits< Function >

friend class SymbolTableListTraits< Function >
friend

Definition at line 98 of file Function.h.


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