LLVM  16.0.0git
BitstreamRemarkSerializer.cpp
Go to the documentation of this file.
1 //===- BitstreamRemarkSerializer.cpp --------------------------------------===//
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 provides the implementation of the LLVM bitstream remark serializer
10 // using LLVM's bitstream writer.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "llvm/Remarks/Remark.h"
16 
17 using namespace llvm;
18 using namespace llvm::remarks;
19 
21  BitstreamRemarkContainerType ContainerType)
22  : Bitstream(Encoded), ContainerType(ContainerType) {}
23 
25  append_range(R, Str);
26 }
27 
28 static void setRecordName(unsigned RecordID, BitstreamWriter &Bitstream,
30  R.clear();
31  R.push_back(RecordID);
32  push(R, Str);
34 }
35 
36 static void initBlock(unsigned BlockID, BitstreamWriter &Bitstream,
38  R.clear();
39  R.push_back(BlockID);
41 
42  R.clear();
43  push(R, Str);
45 }
46 
48  // Setup the metadata block.
50 
51  // The container information.
54 
55  auto Abbrev = std::make_shared<BitCodeAbbrev>();
57  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Version.
58  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Type.
61 }
62 
66 
67  auto Abbrev = std::make_shared<BitCodeAbbrev>();
69  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Version.
72 }
73 
75  uint64_t RemarkVersion) {
76  // The remark version is emitted only if we emit remarks.
77  R.clear();
78  R.push_back(RECORD_META_REMARK_VERSION);
79  R.push_back(RemarkVersion);
81 }
82 
85 
86  auto Abbrev = std::make_shared<BitCodeAbbrev>();
87  Abbrev->Add(BitCodeAbbrevOp(RECORD_META_STRTAB));
88  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Raw table.
91 }
92 
94  const StringTable &StrTab) {
95  // The string table is not emitted if we emit remarks separately.
96  R.clear();
97  R.push_back(RECORD_META_STRTAB);
98 
99  // Serialize to a blob.
100  std::string Buf;
101  raw_string_ostream OS(Buf);
102  StrTab.serialize(OS);
103  StringRef Blob = OS.str();
105 }
106 
109 
110  auto Abbrev = std::make_shared<BitCodeAbbrev>();
112  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Filename.
115 }
116 
118  // The external file is emitted only if we emit the separate metadata.
119  R.clear();
120  R.push_back(RECORD_META_EXTERNAL_FILE);
122 }
123 
125  // Setup the remark block.
127 
128  // The header of a remark.
129  {
131 
132  auto Abbrev = std::make_shared<BitCodeAbbrev>();
134  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Type
135  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Remark Name
136  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Pass name
137  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // Function name
140  }
141 
142  // The location of a remark.
143  {
145 
146  auto Abbrev = std::make_shared<BitCodeAbbrev>();
148  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // File
149  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Line
150  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Column
153  }
154 
155  // The hotness of a remark.
156  {
158 
159  auto Abbrev = std::make_shared<BitCodeAbbrev>();
161  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // Hotness
164  }
165 
166  // An argument entry with a debug location attached.
167  {
170 
171  auto Abbrev = std::make_shared<BitCodeAbbrev>();
173  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // Key
174  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // Value
175  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // File
176  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Line
177  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Column
180  }
181 
182  // An argument entry with no debug location attached.
183  {
186 
187  auto Abbrev = std::make_shared<BitCodeAbbrev>();
189  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // Key
190  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // Value
193  }
194 }
195 
197  // Emit magic number.
198  for (const char C : ContainerMagic)
199  Bitstream.Emit(static_cast<unsigned>(C), 8);
200 
202 
203  // Setup the main metadata. Depending on the container type, we'll setup the
204  // required records next.
206 
207  switch (ContainerType) {
209  // Needs a string table that the separate remark file is using.
210  setupMetaStrTab();
211  // Needs to know where the external remarks file is.
213  break;
215  // Contains remarks: emit the version.
217  // Contains remarks: emit the remark abbrevs.
219  break;
221  // Contains remarks: emit the version.
223  // Needs a string table.
224  setupMetaStrTab();
225  // Contains remarks: emit the remark abbrevs.
227  break;
228  }
229 
231 }
232 
234  uint64_t ContainerVersion, Optional<uint64_t> RemarkVersion,
236  // Emit the meta block
238 
239  // The container version and type.
240  R.clear();
241  R.push_back(RECORD_META_CONTAINER_INFO);
242  R.push_back(ContainerVersion);
243  R.push_back(static_cast<uint64_t>(ContainerType));
245 
246  switch (ContainerType) {
248  assert(StrTab != None && *StrTab != nullptr);
249  emitMetaStrTab(**StrTab);
250  assert(Filename != None);
251  emitMetaExternalFile(*Filename);
252  break;
254  assert(RemarkVersion != None);
255  emitMetaRemarkVersion(*RemarkVersion);
256  break;
258  assert(RemarkVersion != None);
259  emitMetaRemarkVersion(*RemarkVersion);
260  assert(StrTab != None && *StrTab != nullptr);
261  emitMetaStrTab(**StrTab);
262  break;
263  }
264 
266 }
267 
269  StringTable &StrTab) {
271 
272  R.clear();
273  R.push_back(RECORD_REMARK_HEADER);
274  R.push_back(static_cast<uint64_t>(Remark.RemarkType));
275  R.push_back(StrTab.add(Remark.RemarkName).first);
276  R.push_back(StrTab.add(Remark.PassName).first);
277  R.push_back(StrTab.add(Remark.FunctionName).first);
279 
280  if (const Optional<RemarkLocation> &Loc = Remark.Loc) {
281  R.clear();
282  R.push_back(RECORD_REMARK_DEBUG_LOC);
283  R.push_back(StrTab.add(Loc->SourceFilePath).first);
284  R.push_back(Loc->SourceLine);
285  R.push_back(Loc->SourceColumn);
287  }
288 
289  if (Optional<uint64_t> Hotness = Remark.Hotness) {
290  R.clear();
291  R.push_back(RECORD_REMARK_HOTNESS);
292  R.push_back(*Hotness);
294  }
295 
296  for (const Argument &Arg : Remark.Args) {
297  R.clear();
298  unsigned Key = StrTab.add(Arg.Key).first;
299  unsigned Val = StrTab.add(Arg.Val).first;
300  bool HasDebugLoc = Arg.Loc != None;
301  R.push_back(HasDebugLoc ? RECORD_REMARK_ARG_WITH_DEBUGLOC
303  R.push_back(Key);
304  R.push_back(Val);
305  if (HasDebugLoc) {
306  R.push_back(StrTab.add(Arg.Loc->SourceFilePath).first);
307  R.push_back(Arg.Loc->SourceLine);
308  R.push_back(Arg.Loc->SourceColumn);
309  }
310  Bitstream.EmitRecordWithAbbrev(HasDebugLoc
313  R);
314  }
316 }
317 
319  OS.write(Encoded.data(), Encoded.size());
320  Encoded.clear();
321 }
322 
324  return StringRef(Encoded.data(), Encoded.size());
325 }
326 
332  "For SerializerMode::Standalone, a pre-filled string table needs to "
333  "be provided.");
334  // We always use a string table with bitstream.
335  StrTab.emplace();
336 }
337 
340  StringTable StrTabIn)
342  Helper(Mode == SerializerMode::Separate
345  StrTab = std::move(StrTabIn);
346 }
347 
349  if (!DidSetUp) {
350  // Emit the metadata that is embedded in the remark file.
351  // If we're in standalone mode, serialize the string table as well.
352  bool IsStandalone =
355  OS, Helper,
356  IsStandalone ? &*StrTab : Optional<const StringTable *>(None));
358  DidSetUp = true;
359  }
360 
361  assert(DidSetUp &&
362  "The Block info block and the meta block were not emitted yet.");
364 
366 }
367 
368 std::unique_ptr<MetaSerializer> BitstreamRemarkSerializer::metaSerializer(
369  raw_ostream &OS, Optional<StringRef> ExternalFilename) {
372  bool IsStandalone =
374  return std::make_unique<BitstreamMetaSerializer>(
375  OS,
378  &*StrTab, ExternalFilename);
379 }
380 
386 }
llvm::remarks::SerializerMode
SerializerMode
Definition: RemarkSerializer.h:27
llvm::remarks::BitstreamMetaSerializer::Helper
BitstreamRemarkSerializerHelper * Helper
The actual helper, that can point to TmpHelper or to an external helper object.
Definition: BitstreamRemarkSerializer.h:167
llvm::remarks::Remark::Args
SmallVector< Argument, 5 > Args
Arguments collected via the streaming interface.
Definition: Remark.h:90
llvm::remarks::RemarkArgWithoutDebugLocName
constexpr StringRef RemarkArgWithoutDebugLocName
Definition: BitstreamRemarkContainer.h:101
llvm::remarks::BitstreamRemarkSerializer::DidSetUp
bool DidSetUp
The file should contain: 1) The block info block that describes how to read the blocks.
Definition: BitstreamRemarkSerializer.h:132
llvm::BitstreamWriter::EmitRecordWithBlob
void EmitRecordWithBlob(unsigned Abbrev, const Container &Vals, StringRef Blob)
EmitRecordWithBlob - Emit the specified record to the stream, using an abbrev that includes a blob at...
Definition: BitstreamWriter.h:514
llvm::remarks::BitstreamRemarkSerializerHelper::Bitstream
BitstreamWriter Bitstream
The Bitstream writer.
Definition: BitstreamRemarkSerializer.h:57
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::remarks::Format::Bitstream
@ Bitstream
llvm::remarks::MetaBlockName
constexpr StringRef MetaBlockName
Definition: BitstreamRemarkContainer.h:70
llvm::remarks::StringTable
The string table used for serializing remarks.
Definition: RemarkStringTable.h:36
llvm::remarks::BitstreamRemarkSerializerHelper::RecordMetaExternalFileAbbrevID
uint64_t RecordMetaExternalFileAbbrevID
Definition: BitstreamRemarkSerializer.h:68
llvm::remarks::BitstreamRemarkSerializerHelper::R
SmallVector< uint64_t, 64 > R
Buffer used to construct records and pass to the bitstream writer.
Definition: BitstreamRemarkSerializer.h:55
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:628
llvm::remarks::RECORD_META_CONTAINER_INFO
@ RECORD_META_CONTAINER_INFO
Definition: BitstreamRemarkContainer.h:77
llvm::BitCodeAbbrevOp::Fixed
@ Fixed
Definition: BitCodes.h:39
llvm::remarks::SerializerMode::Separate
@ Separate
llvm::remarks::RECORD_REMARK_DEBUG_LOC
@ RECORD_REMARK_DEBUG_LOC
Definition: BitstreamRemarkContainer.h:83
llvm::remarks::Remark::Hotness
Optional< uint64_t > Hotness
If profile information is available, this is the number of times the corresponding code was executed ...
Definition: Remark.h:87
llvm::BitstreamWriter::Emit
void Emit(uint32_t Val, unsigned NumBits)
Definition: BitstreamWriter.h:197
push
static void push(SmallVectorImpl< uint64_t > &R, StringRef Str)
Definition: BitstreamRemarkSerializer.cpp:24
llvm::remarks::Remark::PassName
StringRef PassName
Name of the pass that triggers the emission of this remark.
Definition: Remark.h:72
llvm::remarks::RemarkSerializer::StrTab
Optional< StringTable > StrTab
The string table containing all the unique strings used in the output.
Definition: RemarkSerializer.h:50
llvm::remarks::BitstreamRemarkSerializerHelper::RecordMetaRemarkVersionAbbrevID
uint64_t RecordMetaRemarkVersionAbbrevID
Definition: BitstreamRemarkSerializer.h:66
llvm::Optional< uint64_t >
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkHeaderAbbrevID
uint64_t RecordRemarkHeaderAbbrevID
Definition: BitstreamRemarkSerializer.h:69
llvm::remarks::RemarkArgWithDebugLocName
constexpr StringRef RemarkArgWithDebugLocName
Definition: BitstreamRemarkContainer.h:99
llvm::remarks::BitstreamRemarkSerializerHelper::setupMetaRemarkVersion
void setupMetaRemarkVersion()
The remark version in the metadata block.
Definition: BitstreamRemarkSerializer.cpp:63
llvm::remarks::RemarkSerializer::OS
raw_ostream & OS
The open raw_ostream that the remark diagnostics are emitted to.
Definition: RemarkSerializer.h:45
llvm::remarks::BitstreamRemarkSerializerHelper::setupRemarkBlockInfo
void setupRemarkBlockInfo()
The block info for the remarks block.
Definition: BitstreamRemarkSerializer.cpp:124
llvm::remarks::RemarkHeaderName
constexpr StringRef RemarkHeaderName
Definition: BitstreamRemarkContainer.h:96
llvm::remarks::BitstreamRemarkSerializer::Helper
BitstreamRemarkSerializerHelper Helper
The helper to emit bitstream.
Definition: BitstreamRemarkSerializer.h:134
llvm::remarks::StringTable::serialize
void serialize(raw_ostream &OS) const
Serialize the string table to a stream.
Definition: RemarkStringTable.cpp:56
llvm::remarks::BitstreamRemarkSerializerHelper::emitMetaExternalFile
void emitMetaExternalFile(StringRef Filename)
Definition: BitstreamRemarkSerializer.cpp:117
llvm::remarks::BitstreamRemarkSerializerHelper::RecordMetaContainerInfoAbbrevID
uint64_t RecordMetaContainerInfoAbbrevID
Abbrev IDs initialized in the block info block.
Definition: BitstreamRemarkSerializer.h:65
llvm::remarks::RemarkSerializer::Mode
SerializerMode Mode
The serialization mode.
Definition: RemarkSerializer.h:47
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:187
llvm::remarks::BitstreamRemarkSerializerHelper::emitRemarkBlock
void emitRemarkBlock(const Remark &Remark, StringTable &StrTab)
Emit a remark block. The string table is required.
Definition: BitstreamRemarkSerializer.cpp:268
llvm::remarks::BitstreamRemarkSerializerHelper::BitstreamRemarkSerializerHelper
BitstreamRemarkSerializerHelper(BitstreamRemarkContainerType ContainerType)
Definition: BitstreamRemarkSerializer.cpp:20
llvm::remarks::RECORD_REMARK_ARG_WITH_DEBUGLOC
@ RECORD_REMARK_ARG_WITH_DEBUGLOC
Definition: BitstreamRemarkContainer.h:85
llvm::BitstreamWriter::EnterSubblock
void EnterSubblock(unsigned BlockID, unsigned CodeLen)
Definition: BitstreamWriter.h:276
llvm::remarks::Remark::FunctionName
StringRef FunctionName
Mangled name of the function that triggers the emssion of this remark.
Definition: Remark.h:80
llvm::remarks::BitstreamRemarkSerializerHelper::RecordMetaStrTabAbbrevID
uint64_t RecordMetaStrTabAbbrevID
Definition: BitstreamRemarkSerializer.h:67
initBlock
static void initBlock(unsigned BlockID, BitstreamWriter &Bitstream, SmallVectorImpl< uint64_t > &R, StringRef Str)
Definition: BitstreamRemarkSerializer.cpp:36
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME
@ BLOCKINFO_CODE_SETRECORDNAME
Definition: BitCodeEnums.h:83
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:486
Remark.h
llvm::BitstreamWriter
Definition: BitstreamWriter.h:30
llvm::remarks::RECORD_META_EXTERNAL_FILE
@ RECORD_META_EXTERNAL_FILE
Definition: BitstreamRemarkContainer.h:80
llvm::remarks::BitstreamRemarkSerializerHelper::emitMetaRemarkVersion
void emitMetaRemarkVersion(uint64_t RemarkVersion)
Definition: BitstreamRemarkSerializer.cpp:74
llvm::raw_ostream::write
raw_ostream & write(unsigned char C)
Definition: raw_ostream.cpp:218
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::remarks::MetaRemarkVersionName
constexpr StringRef MetaRemarkVersionName
Definition: BitstreamRemarkContainer.h:93
llvm::remarks::Remark
A remark type used for both emission and parsing.
Definition: Remark.h:67
llvm::BitstreamWriter::EmitBlockInfoAbbrev
unsigned EmitBlockInfoAbbrev(unsigned BlockID, std::shared_ptr< BitCodeAbbrev > Abbv)
EmitBlockInfoAbbrev - Emit a DEFINE_ABBREV record for the specified BlockID.
Definition: BitstreamWriter.h:606
llvm::remarks::MetaSerializer::emit
virtual void emit()=0
llvm::BitCodeAbbrevOp::Blob
@ Blob
Definition: BitCodes.h:43
llvm::None
const NoneType None
Definition: None.h:24
llvm::remarks::RemarkSerializer
This is the base class for a remark serializer.
Definition: RemarkSerializer.h:41
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkArgWithDebugLocAbbrevID
uint64_t RecordRemarkArgWithDebugLocAbbrevID
Definition: BitstreamRemarkSerializer.h:72
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkArgWithoutDebugLocAbbrevID
uint64_t RecordRemarkArgWithoutDebugLocAbbrevID
Definition: BitstreamRemarkSerializer.h:73
llvm::remarks
Definition: AsmPrinter.h:79
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkDebugLocAbbrevID
uint64_t RecordRemarkDebugLocAbbrevID
Definition: BitstreamRemarkSerializer.h:70
llvm::remarks::RECORD_REMARK_HEADER
@ RECORD_REMARK_HEADER
Definition: BitstreamRemarkContainer.h:82
uint64_t
llvm::BitstreamWriter::EnterBlockInfoBlock
void EnterBlockInfoBlock()
EnterBlockInfoBlock - Start emitting the BLOCKINFO_BLOCK.
Definition: BitstreamWriter.h:576
llvm::remarks::BitstreamRemarkContainerType::Standalone
@ Standalone
Everything is emitted together.
llvm::remarks::BitstreamRemarkSerializerHelper::setupMetaBlockInfo
void setupMetaBlockInfo()
Set up the block info for the metadata block.
Definition: BitstreamRemarkSerializer.cpp:47
llvm::remarks::BitstreamRemarkSerializer::emit
void emit(const Remark &Remark) override
Emit a remark to the stream.
Definition: BitstreamRemarkSerializer.cpp:348
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::remarks::BitstreamRemarkSerializerHelper::setupBlockInfo
void setupBlockInfo()
Set up the necessary block info entries according to the container type.
Definition: BitstreamRemarkSerializer.cpp:196
llvm::remarks::BitstreamRemarkSerializerHelper::setupMetaExternalFile
void setupMetaExternalFile()
The external file in the metadata block.
Definition: BitstreamRemarkSerializer.cpp:107
llvm::remarks::RECORD_REMARK_HOTNESS
@ RECORD_REMARK_HOTNESS
Definition: BitstreamRemarkContainer.h:84
llvm::remarks::BitstreamMetaSerializer::StrTab
Optional< const StringTable * > StrTab
Definition: BitstreamRemarkSerializer.h:169
llvm::remarks::BitstreamRemarkSerializerHelper::emitMetaStrTab
void emitMetaStrTab(const StringTable &StrTab)
Definition: BitstreamRemarkSerializer.cpp:93
llvm::BitCodeAbbrevOp::VBR
@ VBR
Definition: BitCodes.h:40
llvm::remarks::CurrentContainerVersion
constexpr uint64_t CurrentContainerVersion
The current version of the remark container.
Definition: BitstreamRemarkContainer.h:26
llvm::BitstreamWriter::ExitBlock
void ExitBlock()
Definition: BitstreamWriter.h:303
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::remarks::BitstreamRemarkSerializerHelper::setupMetaStrTab
void setupMetaStrTab()
The strtab in the metadata block.
Definition: BitstreamRemarkSerializer.cpp:83
Mode
SI Whole Quad Mode
Definition: SIWholeQuadMode.cpp:262
llvm::bitc::BLOCKINFO_CODE_SETBID
@ BLOCKINFO_CODE_SETBID
Definition: BitCodeEnums.h:81
llvm::remarks::RemarkBlockName
constexpr StringRef RemarkBlockName
Definition: BitstreamRemarkContainer.h:71
llvm::remarks::BitstreamRemarkContainerType::SeparateRemarksMeta
@ SeparateRemarksMeta
The metadata emitted separately.
llvm::remarks::MetaSerializer::OS
raw_ostream & OS
The open raw_ostream that the metadata is emitted to.
Definition: RemarkSerializer.h:69
llvm::remarks::META_BLOCK_ID
@ META_BLOCK_ID
The metadata block is mandatory.
Definition: BitstreamRemarkContainer.h:64
llvm::remarks::RECORD_META_STRTAB
@ RECORD_META_STRTAB
Definition: BitstreamRemarkContainer.h:79
llvm::remarks::REMARK_BLOCK_ID
@ REMARK_BLOCK_ID
One remark entry is represented using a REMARK_BLOCK.
Definition: BitstreamRemarkContainer.h:67
llvm::bitc::BLOCKINFO_CODE_BLOCKNAME
@ BLOCKINFO_CODE_BLOCKNAME
Definition: BitCodeEnums.h:82
llvm::remarks::BitstreamRemarkSerializer::metaSerializer
std::unique_ptr< MetaSerializer > metaSerializer(raw_ostream &OS, Optional< StringRef > ExternalFilename=None) override
The metadata serializer associated to this remark serializer.
Definition: BitstreamRemarkSerializer.cpp:368
llvm::remarks::ContainerMagic
constexpr StringLiteral ContainerMagic("RMRK")
The magic number used for identifying remark blocks.
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::remarks::RECORD_REMARK_ARG_WITHOUT_DEBUGLOC
@ RECORD_REMARK_ARG_WITHOUT_DEBUGLOC
Definition: BitstreamRemarkContainer.h:86
BitstreamRemarkSerializer.h
llvm::remarks::BitstreamRemarkSerializer::BitstreamRemarkSerializer
BitstreamRemarkSerializer(raw_ostream &OS, SerializerMode Mode)
Construct a serializer that will create its own string table.
Definition: BitstreamRemarkSerializer.cpp:327
llvm::remarks::MetaExternalFileName
constexpr StringRef MetaExternalFileName
Definition: BitstreamRemarkContainer.h:95
llvm::append_range
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
Definition: STLExtras.h:1818
llvm::remarks::RemarkHotnessName
constexpr StringRef RemarkHotnessName
Definition: BitstreamRemarkContainer.h:98
llvm::remarks::BitstreamRemarkSerializerHelper::flushToStream
void flushToStream(raw_ostream &OS)
Finalize the writing to OS.
Definition: BitstreamRemarkSerializer.cpp:318
llvm::remarks::MetaStrTabName
constexpr StringRef MetaStrTabName
Definition: BitstreamRemarkContainer.h:94
llvm::remarks::RECORD_META_REMARK_VERSION
@ RECORD_META_REMARK_VERSION
Definition: BitstreamRemarkContainer.h:78
llvm::remarks::MetaSerializer
This is the base class for a remark metadata serializer.
Definition: RemarkSerializer.h:67
llvm::remarks::RemarkDebugLocName
constexpr StringRef RemarkDebugLocName
Definition: BitstreamRemarkContainer.h:97
llvm::remarks::Argument
A key-value pair with a debug location that is used to display the remarks at the right place in the ...
Definition: Remark.h:42
llvm::remarks::StringTable::add
std::pair< unsigned, StringRef > add(StringRef Str)
Add a string to the table. It returns an unique ID of the string.
Definition: RemarkStringTable.cpp:31
llvm::remarks::MetaContainerInfoName
constexpr StringRef MetaContainerInfoName
Definition: BitstreamRemarkContainer.h:92
llvm::BitstreamWriter::EmitRecordWithAbbrev
void EmitRecordWithAbbrev(unsigned Abbrev, const Container &Vals)
EmitRecordWithAbbrev - Emit a record with the specified abbreviation.
Definition: BitstreamWriter.h:504
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:596
llvm::BitCodeAbbrevOp
BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
Definition: BitCodes.h:33
llvm::remarks::Remark::RemarkType
Type RemarkType
The type of the remark.
Definition: Remark.h:69
llvm::remarks::BitstreamRemarkSerializerHelper::ContainerType
BitstreamRemarkContainerType ContainerType
The type of the container we are serializing.
Definition: BitstreamRemarkSerializer.h:59
llvm::remarks::Remark::RemarkName
StringRef RemarkName
Textual identifier for the remark (single-word, camel-case).
Definition: Remark.h:77
llvm::remarks::CurrentRemarkVersion
constexpr uint64_t CurrentRemarkVersion
The current version of the remark entry.
Definition: Remark.h:27
llvm::remarks::Remark::Loc
Optional< RemarkLocation > Loc
The location in the source file of the remark.
Definition: Remark.h:83
llvm::remarks::BitstreamMetaSerializer
Serializer of metadata for bitstream remarks.
Definition: BitstreamRemarkSerializer.h:159
llvm::SmallVectorImpl< uint64_t >
llvm::remarks::BitstreamRemarkSerializerHelper::emitMetaBlock
void emitMetaBlock(uint64_t ContainerVersion, Optional< uint64_t > RemarkVersion, Optional< const StringTable * > StrTab=None, Optional< StringRef > Filename=None)
Emit the metadata for the remarks.
Definition: BitstreamRemarkSerializer.cpp:233
setRecordName
static void setRecordName(unsigned RecordID, BitstreamWriter &Bitstream, SmallVectorImpl< uint64_t > &R, StringRef Str)
Definition: BitstreamRemarkSerializer.cpp:28
llvm::remarks::BitstreamRemarkContainerType::SeparateRemarksFile
@ SeparateRemarksFile
The remarks emitted separately.
llvm::remarks::BitstreamMetaSerializer::ExternalFilename
Optional< StringRef > ExternalFilename
Definition: BitstreamRemarkSerializer.h:170
llvm::remarks::BitstreamMetaSerializer::emit
void emit() override
Definition: BitstreamRemarkSerializer.cpp:381
llvm::raw_string_ostream::str
std::string & str()
Returns the string's reference.
Definition: raw_ostream.h:646
llvm::remarks::BitstreamRemarkSerializerHelper::getBuffer
StringRef getBuffer()
Finalize the writing to a buffer.
Definition: BitstreamRemarkSerializer.cpp:323
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkHotnessAbbrevID
uint64_t RecordRemarkHotnessAbbrevID
Definition: BitstreamRemarkSerializer.h:71
llvm::remarks::BitstreamRemarkSerializerHelper::Encoded
SmallVector< char, 1024 > Encoded
Buffer used for encoding the bitstream before writing it to the final stream.
Definition: BitstreamRemarkSerializer.h:53
llvm::remarks::BitstreamRemarkContainerType
BitstreamRemarkContainerType
Type of the remark container.
Definition: BitstreamRemarkContainer.h:35
llvm::remarks::Format
Format
The format used for serializing/deserializing remarks.
Definition: RemarkFormat.h:25