LLVM: lib/Remarks/BitstreamRemarkSerializer.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
17#include
18#include
19
20using namespace llvm;
22
26
29 R.clear();
30 R.push_back(RecordID);
33}
34
37 R.clear();
38 R.push_back(BlockID);
40
41 R.clear();
44}
45
47
49
50
53
54 auto Abbrev = std::make_shared();
60}
61
65
66 auto Abbrev = std::make_shared();
71}
72
75
76 R.clear();
78 R.push_back(RemarkVersion);
80}
81
84
85 auto Abbrev = std::make_shared();
90}
91
94
95 R.clear();
97
98
99 std::string Buf;
104}
105
108
109 auto Abbrev = std::make_shared();
114}
115
122
124
126
127
128 {
130
131 auto Abbrev = std::make_shared();
139 }
140
141
142 {
144
145 auto Abbrev = std::make_shared();
152 }
153
154
155 {
157
158 auto Abbrev = std::make_shared();
163 }
164
165
166 {
169
170 auto Abbrev = std::make_shared();
179 }
180
181
182 {
185
186 auto Abbrev = std::make_shared();
192 }
193}
194
196
198 Bitstream.Emit(static_cast<unsigned>(C), 8);
199
202
203
204
206
209
211 return;
213
215
217
219 return;
220 }
222}
223
225 std::optional Filename) {
226
229
230
231 R.clear();
236
239 assert(Filename != std::nullopt);
241 return;
244 return;
245 }
247}
248
256
260
261 R.clear();
268
269 if (const std::optional &Loc = Remark.Loc) {
270 R.clear();
272 R.push_back(StrTab.add(Loc->SourceFilePath).first);
273 R.push_back(Loc->SourceLine);
274 R.push_back(Loc->SourceColumn);
276 }
277
278 if (std::optional<uint64_t> Hotness = Remark.Hotness) {
279 R.clear();
281 R.push_back(*Hotness);
283 }
284
286 R.clear();
287 unsigned Key = StrTab.add(Arg.Key).first;
288 unsigned Val = StrTab.add(Arg.Val).first;
289 bool HasDebugLoc = Arg.Loc != std::nullopt;
293 R.push_back(Val);
294 if (HasDebugLoc) {
295 R.push_back(StrTab.add(Arg.Loc->SourceFilePath).first);
296 R.push_back(Arg.Loc->SourceLine);
297 R.push_back(Arg.Loc->SourceColumn);
298 }
299 Bitstream.EmitRecordWithAbbrev(HasDebugLoc
302 R);
303 }
305}
306
311
315 StrTab = std::move(StrTabIn);
316}
317
319
320void BitstreamRemarkSerializer::setup() {
322 return;
324 Helper->setupBlockInfo();
325 Helper->emitMetaBlock();
326}
327
330 return;
332 Helper = std::nullopt;
333}
334
339
340std::unique_ptr
343 return std::make_unique(
345}
346
348 assert(Helper && "BitstreamMetaSerializer emitted multiple times");
349 Helper->setupBlockInfo();
351 Helper = std::nullopt;
352}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the make_scope_exit function, which executes user-defined cleanup logic at scope ex...
BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
std::string & str()
Returns the string's reference.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
@ BLOCKINFO_CODE_BLOCKNAME
@ BLOCKINFO_CODE_SETRECORDNAME
This is an optimization pass for GlobalISel generic memory operations.
detail::scope_exit< std::decay_t< Callable > > make_scope_exit(Callable &&F)
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key