LLVM 19.0.0git
Public Types | Static Public Member Functions | List of all members
llvm::SyntheticCountsUtils< CallGraphType > Class Template Reference

Class with methods to propagate synthetic entry counts. More...

#include "llvm/Analysis/SyntheticCountsUtils.h"

Public Types

using Scaled64 = ScaledNumber< uint64_t >
 
using CGT = GraphTraits< CallGraphType >
 
using NodeRef = typename CGT::NodeRef
 
using EdgeRef = typename CGT::EdgeRef
 
using SccTy = std::vector< NodeRef >
 
using GetProfCountTy = function_ref< std::optional< Scaled64 >(NodeRef, EdgeRef)>
 
using AddCountTy = function_ref< void(NodeRef, Scaled64)>
 

Static Public Member Functions

static void propagate (const CallGraphType &CG, GetProfCountTy GetProfCount, AddCountTy AddCount)
 Propgate synthetic entry counts on a callgraph CG.
 

Detailed Description

template<typename CallGraphType>
class llvm::SyntheticCountsUtils< CallGraphType >

Class with methods to propagate synthetic entry counts.

This class is templated on the type of the call graph and designed to work with the traditional per-module callgraph and the summary callgraphs used in ThinLTO. This contains only static methods and alias templates.

Definition at line 27 of file SyntheticCountsUtils.h.

Member Typedef Documentation

◆ AddCountTy

template<typename CallGraphType >
using llvm::SyntheticCountsUtils< CallGraphType >::AddCountTy = function_ref<void(NodeRef, Scaled64)>

Definition at line 39 of file SyntheticCountsUtils.h.

◆ CGT

template<typename CallGraphType >
using llvm::SyntheticCountsUtils< CallGraphType >::CGT = GraphTraits<CallGraphType>

Definition at line 30 of file SyntheticCountsUtils.h.

◆ EdgeRef

template<typename CallGraphType >
using llvm::SyntheticCountsUtils< CallGraphType >::EdgeRef = typename CGT::EdgeRef

Definition at line 32 of file SyntheticCountsUtils.h.

◆ GetProfCountTy

template<typename CallGraphType >
using llvm::SyntheticCountsUtils< CallGraphType >::GetProfCountTy = function_ref<std::optional<Scaled64>(NodeRef, EdgeRef)>

Definition at line 37 of file SyntheticCountsUtils.h.

◆ NodeRef

template<typename CallGraphType >
using llvm::SyntheticCountsUtils< CallGraphType >::NodeRef = typename CGT::NodeRef

Definition at line 31 of file SyntheticCountsUtils.h.

◆ Scaled64

template<typename CallGraphType >
using llvm::SyntheticCountsUtils< CallGraphType >::Scaled64 = ScaledNumber<uint64_t>

Definition at line 29 of file SyntheticCountsUtils.h.

◆ SccTy

template<typename CallGraphType >
using llvm::SyntheticCountsUtils< CallGraphType >::SccTy = std::vector<NodeRef>

Definition at line 33 of file SyntheticCountsUtils.h.

Member Function Documentation

◆ propagate()

template<typename CallGraphType >
void SyntheticCountsUtils::propagate ( const CallGraphType &  CG,
GetProfCountTy  GetProfCount,
AddCountTy  AddCount 
)
static

Propgate synthetic entry counts on a callgraph CG.

This performs a reverse post-order traversal of the callgraph SCC. For each SCC, it first propagates the entry counts to the nodes within the SCC through call edges and updates them in one shot. Then the entry counts are propagated to nodes outside the SCC. This requires GraphTraits to have a specialization for CallGraphType.

Definition at line 83 of file SyntheticCountsUtils.cpp.

References I, llvm::reverse(), and llvm::scc_begin().

Referenced by llvm::computeSyntheticCounts(), and llvm::SyntheticCountsPropagation::run().


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