LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
llvm::FunctionSummary Class Reference

Function summary information to aid decisions and implementation of importing. More...

#include "llvm/IR/ModuleSummaryIndex.h"

Inheritance diagram for llvm::FunctionSummary:
Inheritance graph
[legend]

Classes

struct  ConstVCall
 A specification for a virtual function call with all constant integer arguments. More...
 
struct  FFlags
 Flags specific to function summaries. More...
 
struct  ParamAccess
 Describes the uses of a parameter by the function. More...
 
struct  TypeIdInfo
 All type identifier related information. More...
 
struct  VFuncId
 An "identifier" for a virtual function. More...
 

Public Types

enum  ForceSummaryHotnessType : unsigned { FSHT_None , FSHT_AllNonCritical , FSHT_All }
 Types for -force-summary-edges-cold debugging option. More...
 
using EdgeTy = std::pair< ValueInfo, CalleeInfo >
 <CalleeValueInfo, CalleeInfo> call edge pair.
 
- Public Types inherited from llvm::GlobalValueSummary
enum  SummaryKind : unsigned { AliasKind , FunctionKind , GlobalVarKind }
 Sububclass discriminator (for dyn_cast<> et al.) More...
 
enum  ImportKind : unsigned { Definition = 0 , Declaration = 1 }
 

Public Member Functions

 FunctionSummary (GVFlags Flags, unsigned NumInsts, FFlags FunFlags, uint64_t EntryCount, std::vector< ValueInfo > Refs, std::vector< EdgeTy > CGEdges, std::vector< GlobalValue::GUID > TypeTests, std::vector< VFuncId > TypeTestAssumeVCalls, std::vector< VFuncId > TypeCheckedLoadVCalls, std::vector< ConstVCall > TypeTestAssumeConstVCalls, std::vector< ConstVCall > TypeCheckedLoadConstVCalls, std::vector< ParamAccess > Params, CallsitesTy CallsiteList, AllocsTy AllocList)
 
std::pair< unsigned, unsignedspecialRefCounts () const
 
FFlags fflags () const
 Get function summary flags.
 
void setNoRecurse ()
 
void setNoUnwind ()
 
unsigned instCount () const
 Get the instruction count recorded for this function.
 
uint64_t entryCount () const
 Get the synthetic entry count for this function.
 
void setEntryCount (uint64_t EC)
 Set the synthetic entry count for this function.
 
ArrayRef< EdgeTycalls () const
 Return the list of <CalleeValueInfo, CalleeInfo> pairs.
 
std::vector< EdgeTy > & mutableCalls ()
 
void addCall (EdgeTy E)
 
ArrayRef< GlobalValue::GUIDtype_tests () const
 Returns the list of type identifiers used by this function in llvm.type.test intrinsics other than by an llvm.assume intrinsic, represented as GUIDs.
 
ArrayRef< VFuncIdtype_test_assume_vcalls () const
 Returns the list of virtual calls made by this function using llvm.assume(llvm.type.test) intrinsics that do not have all constant integer arguments.
 
ArrayRef< VFuncIdtype_checked_load_vcalls () const
 Returns the list of virtual calls made by this function using llvm.type.checked.load intrinsics that do not have all constant integer arguments.
 
ArrayRef< ConstVCalltype_test_assume_const_vcalls () const
 Returns the list of virtual calls made by this function using llvm.assume(llvm.type.test) intrinsics with all constant integer arguments.
 
ArrayRef< ConstVCalltype_checked_load_const_vcalls () const
 Returns the list of virtual calls made by this function using llvm.type.checked.load intrinsics with all constant integer arguments.
 
ArrayRef< ParamAccessparamAccesses () const
 Returns the list of known uses of pointer parameters.
 
void setParamAccesses (std::vector< ParamAccess > NewParams)
 Sets the list of known uses of pointer parameters.
 
void addTypeTest (GlobalValue::GUID Guid)
 Add a type test to the summary.
 
const TypeIdInfogetTypeIdInfo () const
 
ArrayRef< CallsiteInfocallsites () const
 
CallsitesTy & mutableCallsites ()
 
void addCallsite (CallsiteInfo &Callsite)
 
ArrayRef< AllocInfoallocs () const
 
AllocsTy & mutableAllocs ()
 
- Public Member Functions inherited from llvm::GlobalValueSummary
virtual ~GlobalValueSummary ()=default
 
GlobalValue::GUID getOriginalName () const
 Returns the hash of the original name, it is identical to the GUID for externally visible symbols, but not for local ones.
 
void setOriginalName (GlobalValue::GUID Name)
 Initialize the original name hash in this summary.
 
SummaryKind getSummaryKind () const
 Which kind of summary subclass this is.
 
void setModulePath (StringRef ModPath)
 Set the path to the module containing this function, for use in the combined index.
 
StringRef modulePath () const
 Get the path to the module containing this function.
 
GVFlags flags () const
 Get the flags for this GlobalValue (see struct GVFlags).
 
GlobalValue::LinkageTypes linkage () const
 Return linkage type recorded for this global value.
 
void setLinkage (GlobalValue::LinkageTypes Linkage)
 Sets the linkage to the value determined by global summary-based optimization.
 
bool notEligibleToImport () const
 Return true if this global value can't be imported.
 
bool isLive () const
 
void setLive (bool Live)
 
void setDSOLocal (bool Local)
 
bool isDSOLocal () const
 
void setCanAutoHide (bool CanAutoHide)
 
bool canAutoHide () const
 
bool shouldImportAsDecl () const
 
void setImportKind (ImportKind IK)
 
GlobalValueSummary::ImportKind importType () const
 
GlobalValue::VisibilityTypes getVisibility () const
 
void setVisibility (GlobalValue::VisibilityTypes Vis)
 
void setNotEligibleToImport ()
 Flag that this global value cannot be imported.
 
ArrayRef< ValueInforefs () const
 Return the list of values referenced by this global value definition.
 
GlobalValueSummarygetBaseObject ()
 If this is an alias summary, returns the summary of the aliased object (a global variable or function), otherwise returns itself.
 
const GlobalValueSummarygetBaseObject () const
 

Static Public Member Functions

static FunctionSummary makeDummyFunctionSummary (std::vector< FunctionSummary::EdgeTy > Edges)
 Create an empty FunctionSummary (with specified call edges).
 
static bool classof (const GlobalValueSummary *GVS)
 Check if this is a function summary.
 

Static Public Attributes

static FunctionSummary ExternalNode
 A dummy node to reference external functions that aren't in the index.
 

Friends

struct GraphTraits< ValueInfo >
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::GlobalValueSummary
 GlobalValueSummary (SummaryKind K, GVFlags Flags, std::vector< ValueInfo > Refs)
 

Detailed Description

Function summary information to aid decisions and implementation of importing.

Definition at line 697 of file ModuleSummaryIndex.h.

Member Typedef Documentation

◆ EdgeTy

<CalleeValueInfo, CalleeInfo> call edge pair.

Definition at line 700 of file ModuleSummaryIndex.h.

Member Enumeration Documentation

◆ ForceSummaryHotnessType

Types for -force-summary-edges-cold debugging option.

Enumerator
FSHT_None 
FSHT_AllNonCritical 
FSHT_All 

Definition at line 703 of file ModuleSummaryIndex.h.

Constructor & Destructor Documentation

◆ FunctionSummary()

llvm::FunctionSummary::FunctionSummary ( GVFlags  Flags,
unsigned  NumInsts,
FFlags  FunFlags,
uint64_t  EntryCount,
std::vector< ValueInfo Refs,
std::vector< EdgeTy CGEdges,
std::vector< GlobalValue::GUID TypeTests,
std::vector< VFuncId TypeTestAssumeVCalls,
std::vector< VFuncId TypeCheckedLoadVCalls,
std::vector< ConstVCall TypeTestAssumeConstVCalls,
std::vector< ConstVCall TypeCheckedLoadConstVCalls,
std::vector< ParamAccess Params,
CallsitesTy  CallsiteList,
AllocsTy  AllocList 
)
inline

Definition at line 915 of file ModuleSummaryIndex.h.

Member Function Documentation

◆ addCall()

void llvm::FunctionSummary::addCall ( EdgeTy  E)
inline

Definition at line 972 of file ModuleSummaryIndex.h.

References E.

◆ addCallsite()

void llvm::FunctionSummary::addCallsite ( CallsiteInfo Callsite)
inline

Definition at line 1056 of file ModuleSummaryIndex.h.

◆ addTypeTest()

void llvm::FunctionSummary::addTypeTest ( GlobalValue::GUID  Guid)
inline

Add a type test to the summary.

This is used by WholeProgramDevirt if we were unable to devirtualize a checked call.

Definition at line 1037 of file ModuleSummaryIndex.h.

References llvm::Guid.

◆ allocs()

ArrayRef< AllocInfo > llvm::FunctionSummary::allocs ( ) const
inline

Definition at line 1062 of file ModuleSummaryIndex.h.

◆ calls()

ArrayRef< EdgeTy > llvm::FunctionSummary::calls ( ) const
inline

Return the list of <CalleeValueInfo, CalleeInfo> pairs.

Definition at line 968 of file ModuleSummaryIndex.h.

Referenced by llvm::thinLTOPropagateFunctionAttrs().

◆ callsites()

ArrayRef< CallsiteInfo > llvm::FunctionSummary::callsites ( ) const
inline

Definition at line 1045 of file ModuleSummaryIndex.h.

◆ classof()

static bool llvm::FunctionSummary::classof ( const GlobalValueSummary GVS)
inlinestatic

Check if this is a function summary.

Definition at line 947 of file ModuleSummaryIndex.h.

References llvm::GlobalValueSummary::FunctionKind, and llvm::GlobalValueSummary::getSummaryKind().

◆ entryCount()

uint64_t llvm::FunctionSummary::entryCount ( ) const
inline

Get the synthetic entry count for this function.

Definition at line 962 of file ModuleSummaryIndex.h.

◆ fflags()

FFlags llvm::FunctionSummary::fflags ( ) const
inline

Get function summary flags.

Definition at line 952 of file ModuleSummaryIndex.h.

Referenced by computeImportForFunction(), and llvm::thinLTOPropagateFunctionAttrs().

◆ getTypeIdInfo()

const TypeIdInfo * llvm::FunctionSummary::getTypeIdInfo ( ) const
inline

Definition at line 1043 of file ModuleSummaryIndex.h.

◆ instCount()

unsigned llvm::FunctionSummary::instCount ( ) const
inline

Get the instruction count recorded for this function.

Definition at line 959 of file ModuleSummaryIndex.h.

Referenced by computeImportForFunction().

◆ makeDummyFunctionSummary()

static FunctionSummary llvm::FunctionSummary::makeDummyFunctionSummary ( std::vector< FunctionSummary::EdgeTy Edges)
inlinestatic

Create an empty FunctionSummary (with specified call edges).

Used to represent external nodes and the dummy root node.

Definition at line 852 of file ModuleSummaryIndex.h.

References llvm::GlobalValue::AvailableExternallyLinkage, llvm::GlobalValue::DefaultVisibility, and llvm::GlobalValueSummary::Definition.

Referenced by llvm::ModuleSummaryIndex::calculateCallGraphRoot().

◆ mutableAllocs()

AllocsTy & llvm::FunctionSummary::mutableAllocs ( )
inline

Definition at line 1068 of file ModuleSummaryIndex.h.

◆ mutableCalls()

std::vector< EdgeTy > & llvm::FunctionSummary::mutableCalls ( )
inline

Definition at line 970 of file ModuleSummaryIndex.h.

◆ mutableCallsites()

CallsitesTy & llvm::FunctionSummary::mutableCallsites ( )
inline

Definition at line 1051 of file ModuleSummaryIndex.h.

References assert().

◆ paramAccesses()

ArrayRef< ParamAccess > llvm::FunctionSummary::paramAccesses ( ) const
inline

Returns the list of known uses of pointer parameters.

Definition at line 1019 of file ModuleSummaryIndex.h.

◆ setEntryCount()

void llvm::FunctionSummary::setEntryCount ( uint64_t  EC)
inline

Set the synthetic entry count for this function.

Definition at line 965 of file ModuleSummaryIndex.h.

◆ setNoRecurse()

void llvm::FunctionSummary::setNoRecurse ( )
inline

Definition at line 954 of file ModuleSummaryIndex.h.

References llvm::FunctionSummary::FFlags::NoRecurse.

◆ setNoUnwind()

void llvm::FunctionSummary::setNoUnwind ( )
inline

Definition at line 956 of file ModuleSummaryIndex.h.

References llvm::FunctionSummary::FFlags::NoUnwind.

◆ setParamAccesses()

void llvm::FunctionSummary::setParamAccesses ( std::vector< ParamAccess NewParams)
inline

Sets the list of known uses of pointer parameters.

Definition at line 1026 of file ModuleSummaryIndex.h.

◆ specialRefCounts()

std::pair< unsigned, unsigned > FunctionSummary::specialRefCounts ( ) const

Definition at line 77 of file ModuleSummaryIndex.cpp.

References I, and llvm::GlobalValueSummary::refs().

◆ type_checked_load_const_vcalls()

ArrayRef< ConstVCall > llvm::FunctionSummary::type_checked_load_const_vcalls ( ) const
inline

Returns the list of virtual calls made by this function using llvm.type.checked.load intrinsics with all constant integer arguments.

Definition at line 1012 of file ModuleSummaryIndex.h.

◆ type_checked_load_vcalls()

ArrayRef< VFuncId > llvm::FunctionSummary::type_checked_load_vcalls ( ) const
inline

Returns the list of virtual calls made by this function using llvm.type.checked.load intrinsics that do not have all constant integer arguments.

Definition at line 995 of file ModuleSummaryIndex.h.

◆ type_test_assume_const_vcalls()

ArrayRef< ConstVCall > llvm::FunctionSummary::type_test_assume_const_vcalls ( ) const
inline

Returns the list of virtual calls made by this function using llvm.assume(llvm.type.test) intrinsics with all constant integer arguments.

Definition at line 1004 of file ModuleSummaryIndex.h.

◆ type_test_assume_vcalls()

ArrayRef< VFuncId > llvm::FunctionSummary::type_test_assume_vcalls ( ) const
inline

Returns the list of virtual calls made by this function using llvm.assume(llvm.type.test) intrinsics that do not have all constant integer arguments.

Definition at line 986 of file ModuleSummaryIndex.h.

◆ type_tests()

ArrayRef< GlobalValue::GUID > llvm::FunctionSummary::type_tests ( ) const
inline

Returns the list of type identifiers used by this function in llvm.type.test intrinsics other than by an llvm.assume intrinsic, represented as GUIDs.

Definition at line 977 of file ModuleSummaryIndex.h.

Friends And Related Function Documentation

◆ GraphTraits< ValueInfo >

friend struct GraphTraits< ValueInfo >
friend

Definition at line 1068 of file ModuleSummaryIndex.h.

Member Data Documentation

◆ ExternalNode

FunctionSummary FunctionSummary::ExternalNode
static
Initial value:
=
static FunctionSummary makeDummyFunctionSummary(std::vector< FunctionSummary::EdgeTy > Edges)
Create an empty FunctionSummary (with specified call edges).

A dummy node to reference external functions that aren't in the index.

Definition at line 871 of file ModuleSummaryIndex.h.

Referenced by llvm::GraphTraits< ValueInfo >::child_begin(), llvm::GraphTraits< ValueInfo >::child_edge_begin(), llvm::GraphTraits< ValueInfo >::child_edge_end(), and llvm::GraphTraits< ValueInfo >::child_end().


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