24
24
#include < vector>
25
25
26
26
namespace llvm {
27
- // / The loaded contextual profile, suitable for mutation during IPO passes. We
28
- // / generally expect a fraction of counters and of callsites to be populated.
29
- // / We continue to model counters as vectors, but callsites are modeled as a map
30
- // / of a map. The expectation is that, typically, there is a small number of
31
- // / indirect targets (usually, 1 for direct calls); but potentially a large
32
- // / number of callsites, and, as inlining progresses, the callsite count of a
33
- // / caller will grow.
34
- class PGOContextualProfile final {
27
+ // / A node (context) in the loaded contextual profile, suitable for mutation
28
+ // / during IPO passes. We generally expect a fraction of counters and
29
+ // / callsites to be populated. We continue to model counters as vectors, but
30
+ // / callsites are modeled as a map of a map. The expectation is that, typically,
31
+ // / there is a small number of indirect targets (usually, 1 for direct calls);
32
+ // / but potentially a large number of callsites, and, as inlining progresses,
33
+ // / the callsite count of a caller will grow.
34
+ class PGOCtxProfContext final {
35
35
public:
36
- using CallTargetMapTy = std::map<GlobalValue::GUID, PGOContextualProfile >;
36
+ using CallTargetMapTy = std::map<GlobalValue::GUID, PGOCtxProfContext >;
37
37
using CallsiteMapTy = DenseMap<uint32_t , CallTargetMapTy>;
38
38
39
39
private:
@@ -42,19 +42,18 @@ class PGOContextualProfile final {
42
42
SmallVector<uint64_t , 16 > Counters;
43
43
CallsiteMapTy Callsites;
44
44
45
- PGOContextualProfile (GlobalValue::GUID G,
46
- SmallVectorImpl<uint64_t > &&Counters)
45
+ PGOCtxProfContext (GlobalValue::GUID G, SmallVectorImpl<uint64_t > &&Counters)
47
46
: GUID(G), Counters(std::move(Counters)) {}
48
47
49
- Expected<PGOContextualProfile &>
48
+ Expected<PGOCtxProfContext &>
50
49
getOrEmplace (uint32_t Index, GlobalValue::GUID G,
51
50
SmallVectorImpl<uint64_t > &&Counters);
52
51
53
52
public:
54
- PGOContextualProfile (const PGOContextualProfile &) = delete ;
55
- PGOContextualProfile &operator =(const PGOContextualProfile &) = delete ;
56
- PGOContextualProfile (PGOContextualProfile &&) = default ;
57
- PGOContextualProfile &operator =(PGOContextualProfile &&) = default ;
53
+ PGOCtxProfContext (const PGOCtxProfContext &) = delete ;
54
+ PGOCtxProfContext &operator =(const PGOCtxProfContext &) = delete ;
55
+ PGOCtxProfContext (PGOCtxProfContext &&) = default ;
56
+ PGOCtxProfContext &operator =(PGOCtxProfContext &&) = default ;
58
57
59
58
GlobalValue::GUID guid () const { return GUID; }
60
59
const SmallVectorImpl<uint64_t > &counters () const { return Counters; }
@@ -80,7 +79,7 @@ class PGOCtxProfileReader final {
80
79
Error wrongValue (const Twine &);
81
80
Error unsupported (const Twine &);
82
81
83
- Expected<std::pair<std::optional<uint32_t >, PGOContextualProfile >>
82
+ Expected<std::pair<std::optional<uint32_t >, PGOCtxProfContext >>
84
83
readContext (bool ExpectIndex);
85
84
bool canReadContext ();
86
85
@@ -89,7 +88,7 @@ class PGOCtxProfileReader final {
89
88
: Magic(Buffer.substr(0 , PGOCtxProfileWriter::ContainerMagic.size())),
90
89
Cursor (Buffer.substr(PGOCtxProfileWriter::ContainerMagic.size())) {}
91
90
92
- Expected<std::map<GlobalValue::GUID, PGOContextualProfile >> loadContexts ();
91
+ Expected<std::map<GlobalValue::GUID, PGOCtxProfContext >> loadContexts ();
93
92
};
94
93
} // namespace llvm
95
94
#endif
0 commit comments