LLVM 20.0.0git
SyntheticCountsUtils.h
Go to the documentation of this file.
1//===- SyntheticCountsUtils.h - utilities for count propagation--*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines utilities for synthetic counts propagation.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_ANALYSIS_SYNTHETICCOUNTSUTILS_H
14#define LLVM_ANALYSIS_SYNTHETICCOUNTSUTILS_H
15
19#include <vector>
20
21namespace llvm {
22
23/// Class with methods to propagate synthetic entry counts.
24///
25/// This class is templated on the type of the call graph and designed to work
26/// with the traditional per-module callgraph and the summary callgraphs used in
27/// ThinLTO. This contains only static methods and alias templates.
28template <typename CallGraphType> class SyntheticCountsUtils {
29public:
32 using NodeRef = typename CGT::NodeRef;
33 using EdgeRef = typename CGT::EdgeRef;
34 using SccTy = std::vector<NodeRef>;
35
36 // Not all EdgeRef have information about the source of the edge. Hence
37 // NodeRef corresponding to the source of the EdgeRef is explicitly passed.
41
42 static void propagate(const CallGraphType &CG, GetProfCountTy GetProfCount,
43 AddCountTy AddCount);
44
45private:
46 static void propagateFromSCC(const SccTy &SCC, GetProfCountTy GetProfCount,
47 AddCountTy AddCount);
48};
49} // namespace llvm
50
51#endif
This file defines the little GraphTraits<X> template class that should be specialized by classes that...
Class with methods to propagate synthetic entry counts.
typename CGT::NodeRef NodeRef
std::vector< NodeRef > SccTy
typename CGT::EdgeRef EdgeRef
static void propagate(const CallGraphType &CG, GetProfCountTy GetProfCount, AddCountTy AddCount)
Propgate synthetic entry counts on a callgraph CG.
An efficient, type-erasing, non-owning reference to a callable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
typename GraphType::UnknownGraphTypeError NodeRef
Definition: GraphTraits.h:95