LLVM
15.0.0git
include
llvm
Analysis
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
16
#include "
llvm/ADT/STLFunctionalExtras.h
"
17
#include "
llvm/Analysis/CallGraph.h
"
18
#include "
llvm/Support/ScaledNumber.h
"
19
20
namespace
llvm
{
21
22
/// Class with methods to propagate synthetic entry counts.
23
///
24
/// This class is templated on the type of the call graph and designed to work
25
/// with the traditional per-module callgraph and the summary callgraphs used in
26
/// ThinLTO. This contains only static methods and alias templates.
27
template
<
typename
CallGraphType>
class
SyntheticCountsUtils
{
28
public
:
29
using
Scaled64
=
ScaledNumber<uint64_t>
;
30
using
CGT
=
GraphTraits<CallGraphType>
;
31
using
NodeRef
=
typename
CGT::NodeRef
;
32
using
EdgeRef
=
typename
CGT::EdgeRef;
33
using
SccTy
= std::vector<NodeRef>;
34
35
// Not all EdgeRef have information about the source of the edge. Hence
36
// NodeRef corresponding to the source of the EdgeRef is explicitly passed.
37
using
GetProfCountTy
=
function_ref<Optional<Scaled64>
(
NodeRef
,
EdgeRef
)>;
38
using
AddCountTy
=
function_ref
<void(
NodeRef
,
Scaled64
)>;
39
40
static
void
propagate
(
const
CallGraphType &CG,
GetProfCountTy
GetProfCount,
41
AddCountTy
AddCount);
42
43
private
:
44
static
void
propagateFromSCC(
const
SccTy
&
SCC
,
GetProfCountTy
GetProfCount,
45
AddCountTy
AddCount);
46
};
47
}
// namespace llvm
48
49
#endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:17
llvm::SyntheticCountsUtils::propagate
static void propagate(const CallGraphType &CG, GetProfCountTy GetProfCount, AddCountTy AddCount)
Propgate synthetic entry counts on a callgraph CG.
Definition:
SyntheticCountsUtils.cpp:83
llvm::SyntheticCountsUtils::EdgeRef
typename CGT::EdgeRef EdgeRef
Definition:
SyntheticCountsUtils.h:32
STLFunctionalExtras.h
llvm::SyntheticCountsUtils::SccTy
std::vector< NodeRef > SccTy
Definition:
SyntheticCountsUtils.h:33
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition:
STLFunctionalExtras.h:36
llvm::AMDGPU::CPol::SCC
@ SCC
Definition:
SIDefines.h:307
llvm::SyntheticCountsUtils::NodeRef
typename CGT::NodeRef NodeRef
Definition:
SyntheticCountsUtils.h:31
ScaledNumber.h
llvm::ScaledNumber< uint64_t >
CallGraph.h
llvm::SyntheticCountsUtils
Class with methods to propagate synthetic entry counts.
Definition:
SyntheticCountsUtils.h:27
llvm::GraphTraits::NodeRef
typename GraphType::UnknownGraphTypeError NodeRef
Definition:
GraphTraits.h:80
llvm::GraphTraits
Definition:
GraphTraits.h:37
Generated on Fri Jul 1 2022 12:29:20 for LLVM by
1.8.17