File indexing completed on 2026-05-10 08:43:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_ANALYSIS_SYNTHETICCOUNTSUTILS_H
0014 #define LLVM_ANALYSIS_SYNTHETICCOUNTSUTILS_H
0015
0016 #include "llvm/ADT/GraphTraits.h"
0017 #include "llvm/ADT/STLFunctionalExtras.h"
0018 #include "llvm/Support/ScaledNumber.h"
0019 #include <vector>
0020
0021 namespace llvm {
0022
0023
0024
0025
0026
0027
0028 template <typename CallGraphType> class SyntheticCountsUtils {
0029 public:
0030 using Scaled64 = ScaledNumber<uint64_t>;
0031 using CGT = GraphTraits<CallGraphType>;
0032 using NodeRef = typename CGT::NodeRef;
0033 using EdgeRef = typename CGT::EdgeRef;
0034 using SccTy = std::vector<NodeRef>;
0035
0036
0037
0038 using GetProfCountTy =
0039 function_ref<std::optional<Scaled64>(NodeRef, EdgeRef)>;
0040 using AddCountTy = function_ref<void(NodeRef, Scaled64)>;
0041
0042 static void propagate(const CallGraphType &CG, GetProfCountTy GetProfCount,
0043 AddCountTy AddCount);
0044
0045 private:
0046 static void propagateFromSCC(const SccTy &SCC, GetProfCountTy GetProfCount,
0047 AddCountTy AddCount);
0048 };
0049 }
0050
0051 #endif