10
10
11
11
namespace llvm {
12
12
namespace memprof {
13
- namespace {
14
- size_t serializedSizeV0 (const IndexedAllocationInfo &IAI) {
13
+ static size_t serializedSizeV0 (const IndexedAllocationInfo &IAI) {
15
14
size_t Size = 0 ;
16
15
// The number of frames to serialize.
17
16
Size += sizeof (uint64_t );
@@ -22,15 +21,14 @@ size_t serializedSizeV0(const IndexedAllocationInfo &IAI) {
22
21
return Size;
23
22
}
24
23
25
- size_t serializedSizeV2 (const IndexedAllocationInfo &IAI) {
24
+ static size_t serializedSizeV2 (const IndexedAllocationInfo &IAI) {
26
25
size_t Size = 0 ;
27
26
// The CallStackId
28
27
Size += sizeof (CallStackId);
29
28
// The size of the payload.
30
29
Size += PortableMemInfoBlock::serializedSize ();
31
30
return Size;
32
31
}
33
- } // namespace
34
32
35
33
size_t IndexedAllocationInfo::serializedSize (IndexedVersion Version) const {
36
34
switch (Version) {
@@ -43,8 +41,7 @@ size_t IndexedAllocationInfo::serializedSize(IndexedVersion Version) const {
43
41
llvm_unreachable (" unsupported MemProf version" );
44
42
}
45
43
46
- namespace {
47
- size_t serializedSizeV0 (const IndexedMemProfRecord &Record) {
44
+ static size_t serializedSizeV0 (const IndexedMemProfRecord &Record) {
48
45
size_t Result = sizeof (GlobalValue::GUID);
49
46
for (const IndexedAllocationInfo &N : Record.AllocSites )
50
47
Result += N.serializedSize (Version0);
@@ -59,7 +56,7 @@ size_t serializedSizeV0(const IndexedMemProfRecord &Record) {
59
56
return Result;
60
57
}
61
58
62
- size_t serializedSizeV2 (const IndexedMemProfRecord &Record) {
59
+ static size_t serializedSizeV2 (const IndexedMemProfRecord &Record) {
63
60
size_t Result = sizeof (GlobalValue::GUID);
64
61
for (const IndexedAllocationInfo &N : Record.AllocSites )
65
62
Result += N.serializedSize (Version2);
@@ -70,7 +67,6 @@ size_t serializedSizeV2(const IndexedMemProfRecord &Record) {
70
67
Result += Record.CallSiteIds .size () * sizeof (CallStackId);
71
68
return Result;
72
69
}
73
- } // namespace
74
70
75
71
size_t IndexedMemProfRecord::serializedSize (IndexedVersion Version) const {
76
72
switch (Version) {
@@ -83,9 +79,8 @@ size_t IndexedMemProfRecord::serializedSize(IndexedVersion Version) const {
83
79
llvm_unreachable (" unsupported MemProf version" );
84
80
}
85
81
86
- namespace {
87
- void serializeV0 (const IndexedMemProfRecord &Record,
88
- const MemProfSchema &Schema, raw_ostream &OS) {
82
+ static void serializeV0 (const IndexedMemProfRecord &Record,
83
+ const MemProfSchema &Schema, raw_ostream &OS) {
89
84
using namespace support ;
90
85
91
86
endian::Writer LE (OS, llvm::endianness::little);
@@ -107,8 +102,8 @@ void serializeV0(const IndexedMemProfRecord &Record,
107
102
}
108
103
}
109
104
110
- void serializeV2 (const IndexedMemProfRecord &Record,
111
- const MemProfSchema &Schema, raw_ostream &OS) {
105
+ static void serializeV2 (const IndexedMemProfRecord &Record,
106
+ const MemProfSchema &Schema, raw_ostream &OS) {
112
107
using namespace support ;
113
108
114
109
endian::Writer LE (OS, llvm::endianness::little);
@@ -124,7 +119,6 @@ void serializeV2(const IndexedMemProfRecord &Record,
124
119
for (const auto &CSId : Record.CallSiteIds )
125
120
LE.write <CallStackId>(CSId);
126
121
}
127
- } // namespace
128
122
129
123
void IndexedMemProfRecord::serialize (const MemProfSchema &Schema,
130
124
raw_ostream &OS, IndexedVersion Version) {
@@ -140,9 +134,8 @@ void IndexedMemProfRecord::serialize(const MemProfSchema &Schema,
140
134
llvm_unreachable (" unsupported MemProf version" );
141
135
}
142
136
143
- namespace {
144
- IndexedMemProfRecord deserializeV0 (const MemProfSchema &Schema,
145
- const unsigned char *Ptr) {
137
+ static IndexedMemProfRecord deserializeV0 (const MemProfSchema &Schema,
138
+ const unsigned char *Ptr) {
146
139
using namespace support ;
147
140
148
141
IndexedMemProfRecord Record;
@@ -185,8 +178,8 @@ IndexedMemProfRecord deserializeV0(const MemProfSchema &Schema,
185
178
return Record;
186
179
}
187
180
188
- IndexedMemProfRecord deserializeV2 (const MemProfSchema &Schema,
189
- const unsigned char *Ptr) {
181
+ static IndexedMemProfRecord deserializeV2 (const MemProfSchema &Schema,
182
+ const unsigned char *Ptr) {
190
183
using namespace support ;
191
184
192
185
IndexedMemProfRecord Record;
@@ -214,7 +207,6 @@ IndexedMemProfRecord deserializeV2(const MemProfSchema &Schema,
214
207
215
208
return Record;
216
209
}
217
- } // namespace
218
210
219
211
IndexedMemProfRecord
220
212
IndexedMemProfRecord::deserialize (const MemProfSchema &Schema,
0 commit comments