LLVM  14.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 
16 using namespace llvm;
17 using namespace llvm::remarks;
18 
20  BitstreamRemarkContainerType ContainerType)
21  : Encoded(), R(), Bitstream(Encoded), ContainerType(ContainerType) {}
22 
24  append_range(R, Str);
25 }
26 
27 static void setRecordName(unsigned RecordID, BitstreamWriter &Bitstream,
29  R.clear();
30  R.push_back(RecordID);
31  push(R, Str);
33 }
34 
35 static void initBlock(unsigned BlockID, BitstreamWriter &Bitstream,
37  R.clear();
38  R.push_back(BlockID);
40 
41  R.clear();
42  push(R, Str);
44 }
45 
47  // Setup the metadata block.
49 
50  // The container information.
53 
54  auto Abbrev = std::make_shared<BitCodeAbbrev>();
56  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Version.
57  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Type.
60 }
61 
65 
66  auto Abbrev = std::make_shared<BitCodeAbbrev>();
68  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Version.
71 }
72 
74  uint64_t RemarkVersion) {
75  // The remark version is emitted only if we emit remarks.
76  R.clear();
77  R.push_back(RECORD_META_REMARK_VERSION);
78  R.push_back(RemarkVersion);
80 }
81 
84 
85  auto Abbrev = std::make_shared<BitCodeAbbrev>();
86  Abbrev->Add(BitCodeAbbrevOp(RECORD_META_STRTAB));
87  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Raw table.
90 }
91 
93  const StringTable &StrTab) {
94  // The string table is not emitted if we emit remarks separately.
95  R.clear();
96  R.push_back(RECORD_META_STRTAB);
97 
98  // Serialize to a blob.
99  std::string Buf;
100  raw_string_ostream OS(Buf);
101  StrTab.serialize(OS);
102  StringRef Blob = OS.str();
104 }
105 
108 
109  auto Abbrev = std::make_shared<BitCodeAbbrev>();
111  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Filename.
114 }
115 
117  // The external file is emitted only if we emit the separate metadata.
118  R.clear();
119  R.push_back(RECORD_META_EXTERNAL_FILE);
121 }
122 
124  // Setup the remark block.
126 
127  // The header of a remark.
128  {
130 
131  auto Abbrev = std::make_shared<BitCodeAbbrev>();
133  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Type
134  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Remark Name
135  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Pass name
136  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // Function name
139  }
140 
141  // The location of a remark.
142  {
144 
145  auto Abbrev = std::make_shared<BitCodeAbbrev>();
147  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // File
148  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Line
149  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Column
152  }
153 
154  // The hotness of a remark.
155  {
157 
158  auto Abbrev = std::make_shared<BitCodeAbbrev>();
160  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // Hotness
163  }
164 
165  // An argument entry with a debug location attached.
166  {
169 
170  auto Abbrev = std::make_shared<BitCodeAbbrev>();
172  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // Key
173  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // Value
174  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // File
175  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Line
176  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Column
179  }
180 
181  // An argument entry with no debug location attached.
182  {
185 
186  auto Abbrev = std::make_shared<BitCodeAbbrev>();
188  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // Key
189  Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 7)); // Value
192  }
193 }
194 
196  // Emit magic number.
197  for (const char C : ContainerMagic)
198  Bitstream.Emit(static_cast<unsigned>(C), 8);
199 
201 
202  // Setup the main metadata. Depending on the container type, we'll setup the
203  // required records next.
205 
206  switch (ContainerType) {
208  // Needs a string table that the separate remark file is using.
209  setupMetaStrTab();
210  // Needs to know where the external remarks file is.
212  break;
214  // Contains remarks: emit the version.
216  // Contains remarks: emit the remark abbrevs.
218  break;
220  // Contains remarks: emit the version.
222  // Needs a string table.
223  setupMetaStrTab();
224  // Contains remarks: emit the remark abbrevs.
226  break;
227  }
228 
230 }
231 
233  uint64_t ContainerVersion, Optional<uint64_t> RemarkVersion,
235  // Emit the meta block
237 
238  // The container version and type.
239  R.clear();
240  R.push_back(RECORD_META_CONTAINER_INFO);
241  R.push_back(ContainerVersion);
242  R.push_back(static_cast<uint64_t>(ContainerType));
244 
245  switch (ContainerType) {
247  assert(StrTab != None && *StrTab != nullptr);
248  emitMetaStrTab(**StrTab);
249  assert(Filename != None);
250  emitMetaExternalFile(*Filename);
251  break;
253  assert(RemarkVersion != None);
254  emitMetaRemarkVersion(*RemarkVersion);
255  break;
257  assert(RemarkVersion != None);
258  emitMetaRemarkVersion(*RemarkVersion);
259  assert(StrTab != None && *StrTab != nullptr);
260  emitMetaStrTab(**StrTab);
261  break;
262  }
263 
265 }
266 
268  StringTable &StrTab) {
270 
271  R.clear();
272  R.push_back(RECORD_REMARK_HEADER);
273  R.push_back(static_cast<uint64_t>(Remark.RemarkType));
274  R.push_back(StrTab.add(Remark.RemarkName).first);
275  R.push_back(StrTab.add(Remark.PassName).first);
276  R.push_back(StrTab.add(Remark.FunctionName).first);
278 
279  if (const Optional<RemarkLocation> &Loc = Remark.Loc) {
280  R.clear();
281  R.push_back(RECORD_REMARK_DEBUG_LOC);
282  R.push_back(StrTab.add(Loc->SourceFilePath).first);
283  R.push_back(Loc->SourceLine);
284  R.push_back(Loc->SourceColumn);
286  }
287 
288  if (Optional<uint64_t> Hotness = Remark.Hotness) {
289  R.clear();
290  R.push_back(RECORD_REMARK_HOTNESS);
291  R.push_back(*Hotness);
293  }
294 
295  for (const Argument &Arg : Remark.Args) {
296  R.clear();
297  unsigned Key = StrTab.add(Arg.Key).first;
298  unsigned Val = StrTab.add(Arg.Val).first;
299  bool HasDebugLoc = Arg.Loc != None;
300  R.push_back(HasDebugLoc ? RECORD_REMARK_ARG_WITH_DEBUGLOC
302  R.push_back(Key);
303  R.push_back(Val);
304  if (HasDebugLoc) {
305  R.push_back(StrTab.add(Arg.Loc->SourceFilePath).first);
306  R.push_back(Arg.Loc->SourceLine);
307  R.push_back(Arg.Loc->SourceColumn);
308  }
309  Bitstream.EmitRecordWithAbbrev(HasDebugLoc
312  R);
313  }
315 }
316 
318  OS.write(Encoded.data(), Encoded.size());
319  Encoded.clear();
320 }
321 
323  return StringRef(Encoded.data(), Encoded.size());
324 }
325 
331  "For SerializerMode::Standalone, a pre-filled string table needs to "
332  "be provided.");
333  // We always use a string table with bitstream.
334  StrTab.emplace();
335 }
336 
339  StringTable StrTabIn)
341  Helper(Mode == SerializerMode::Separate
344  StrTab = std::move(StrTabIn);
345 }
346 
348  if (!DidSetUp) {
349  // Emit the metadata that is embedded in the remark file.
350  // If we're in standalone mode, serialize the string table as well.
351  bool IsStandalone =
354  OS, Helper,
355  IsStandalone ? &*StrTab : Optional<const StringTable *>(None));
357  DidSetUp = true;
358  }
359 
360  assert(DidSetUp &&
361  "The Block info block and the meta block were not emitted yet.");
363 
365 }
366 
367 std::unique_ptr<MetaSerializer> BitstreamRemarkSerializer::metaSerializer(
368  raw_ostream &OS, Optional<StringRef> ExternalFilename) {
371  bool IsStandalone =
373  return std::make_unique<BitstreamMetaSerializer>(
374  OS,
377  &*StrTab, ExternalFilename);
378 }
379 
385 }
llvm::remarks::SerializerMode
SerializerMode
Definition: RemarkSerializer.h:24
llvm::remarks::BitstreamMetaSerializer::Helper
BitstreamRemarkSerializerHelper * Helper
The actual helper, that can point to TmpHelper or to an external helper object.
Definition: BitstreamRemarkSerializer.h:166
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:131
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:522
llvm::remarks::BitstreamRemarkSerializerHelper::Bitstream
BitstreamWriter Bitstream
The Bitstream writer.
Definition: BitstreamRemarkSerializer.h:56
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
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:67
llvm::remarks::BitstreamRemarkSerializerHelper::R
SmallVector< uint64_t, 64 > R
Buffer used to construct records and pass to the bitstream writer.
Definition: BitstreamRemarkSerializer.h:54
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:625
llvm::remarks::RECORD_META_CONTAINER_INFO
@ RECORD_META_CONTAINER_INFO
Definition: BitstreamRemarkContainer.h:77
llvm::BitCodeAbbrevOp::Fixed
@ Fixed
Definition: BitCodes.h:102
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:203
push
static void push(SmallVectorImpl< uint64_t > &R, StringRef Str)
Definition: BitstreamRemarkSerializer.cpp:23
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:47
llvm::remarks::BitstreamRemarkSerializerHelper::RecordMetaRemarkVersionAbbrevID
uint64_t RecordMetaRemarkVersionAbbrevID
Definition: BitstreamRemarkSerializer.h:65
llvm::Optional< uint64_t >
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkHeaderAbbrevID
uint64_t RecordRemarkHeaderAbbrevID
Definition: BitstreamRemarkSerializer.h:68
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:62
llvm::remarks::RemarkSerializer::OS
raw_ostream & OS
The open raw_ostream that the remark diagnostics are emitted to.
Definition: RemarkSerializer.h:42
llvm::remarks::BitstreamRemarkSerializerHelper::setupRemarkBlockInfo
void setupRemarkBlockInfo()
The block info for the remarks block.
Definition: BitstreamRemarkSerializer.cpp:123
llvm::remarks::RemarkHeaderName
constexpr StringRef RemarkHeaderName
Definition: BitstreamRemarkContainer.h:96
llvm::remarks::BitstreamRemarkSerializer::Helper
BitstreamRemarkSerializerHelper Helper
The helper to emit bitstream.
Definition: BitstreamRemarkSerializer.h:133
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:116
llvm::remarks::BitstreamRemarkSerializerHelper::RecordMetaContainerInfoAbbrevID
uint64_t RecordMetaContainerInfoAbbrevID
Abbrev IDs initialized in the block info block.
Definition: BitstreamRemarkSerializer.h:64
llvm::remarks::RemarkSerializer::Mode
SerializerMode Mode
The serialization mode.
Definition: RemarkSerializer.h:44
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:206
llvm::remarks::BitstreamRemarkSerializerHelper::emitRemarkBlock
void emitRemarkBlock(const Remark &Remark, StringTable &StrTab)
Emit a remark block. The string table is required.
Definition: BitstreamRemarkSerializer.cpp:267
llvm::remarks::BitstreamRemarkSerializerHelper::BitstreamRemarkSerializerHelper
BitstreamRemarkSerializerHelper(BitstreamRemarkContainerType ContainerType)
Definition: BitstreamRemarkSerializer.cpp:19
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:283
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:66
initBlock
static void initBlock(unsigned BlockID, BitstreamWriter &Bitstream, SmallVectorImpl< uint64_t > &R, StringRef Str)
Definition: BitstreamRemarkSerializer.cpp:35
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME
@ BLOCKINFO_CODE_SETRECORDNAME
Definition: BitCodes.h:85
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
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:73
llvm::raw_ostream::write
raw_ostream & write(unsigned char C)
Definition: raw_ostream.cpp:220
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
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:614
llvm::remarks::MetaSerializer::emit
virtual void emit()=0
llvm::BitCodeAbbrevOp::Blob
@ Blob
Definition: BitCodes.h:106
llvm::None
const NoneType None
Definition: None.h:23
llvm::remarks::RemarkSerializer
This is the base class for a remark serializer.
Definition: RemarkSerializer.h:38
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkArgWithDebugLocAbbrevID
uint64_t RecordRemarkArgWithDebugLocAbbrevID
Definition: BitstreamRemarkSerializer.h:71
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkArgWithoutDebugLocAbbrevID
uint64_t RecordRemarkArgWithoutDebugLocAbbrevID
Definition: BitstreamRemarkSerializer.h:72
llvm::remarks
Definition: AsmPrinter.h:77
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkDebugLocAbbrevID
uint64_t RecordRemarkDebugLocAbbrevID
Definition: BitstreamRemarkSerializer.h:69
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:584
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:46
llvm::remarks::BitstreamRemarkSerializer::emit
void emit(const Remark &Remark) override
Emit a remark to the stream.
Definition: BitstreamRemarkSerializer.cpp:347
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:195
llvm::remarks::BitstreamRemarkSerializerHelper::setupMetaExternalFile
void setupMetaExternalFile()
The external file in the metadata block.
Definition: BitstreamRemarkSerializer.cpp:106
llvm::remarks::RECORD_REMARK_HOTNESS
@ RECORD_REMARK_HOTNESS
Definition: BitstreamRemarkContainer.h:84
llvm::remarks::BitstreamMetaSerializer::StrTab
Optional< const StringTable * > StrTab
Definition: BitstreamRemarkSerializer.h:168
llvm::remarks::BitstreamRemarkSerializerHelper::emitMetaStrTab
void emitMetaStrTab(const StringTable &StrTab)
Definition: BitstreamRemarkSerializer.cpp:92
llvm::BitCodeAbbrevOp::VBR
@ VBR
Definition: BitCodes.h:103
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:310
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::remarks::BitstreamRemarkSerializerHelper::setupMetaStrTab
void setupMetaStrTab()
The strtab in the metadata block.
Definition: BitstreamRemarkSerializer.cpp:82
Mode
SI Whole Quad Mode
Definition: SIWholeQuadMode.cpp:262
llvm::bitc::BLOCKINFO_CODE_SETBID
@ BLOCKINFO_CODE_SETBID
Definition: BitCodes.h:83
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:66
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: BitCodes.h:84
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:367
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:58
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:326
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:1748
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:317
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:64
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:512
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:585
llvm::BitCodeAbbrevOp
BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
Definition: BitCodes.h:96
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:58
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:158
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:232
setRecordName
static void setRecordName(unsigned RecordID, BitstreamWriter &Bitstream, SmallVectorImpl< uint64_t > &R, StringRef Str)
Definition: BitstreamRemarkSerializer.cpp:27
llvm::remarks::BitstreamRemarkContainerType::SeparateRemarksFile
@ SeparateRemarksFile
The remarks emitted separately.
llvm::remarks::BitstreamMetaSerializer::ExternalFilename
Optional< StringRef > ExternalFilename
Definition: BitstreamRemarkSerializer.h:169
llvm::remarks::BitstreamMetaSerializer::emit
void emit() override
Definition: BitstreamRemarkSerializer.cpp:380
llvm::raw_string_ostream::str
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
Definition: raw_ostream.h:643
llvm::remarks::BitstreamRemarkSerializerHelper::getBuffer
StringRef getBuffer()
Finalize the writing to a buffer.
Definition: BitstreamRemarkSerializer.cpp:322
llvm::remarks::BitstreamRemarkSerializerHelper::RecordRemarkHotnessAbbrevID
uint64_t RecordRemarkHotnessAbbrevID
Definition: BitstreamRemarkSerializer.h:70
llvm::remarks::BitstreamRemarkSerializerHelper::Encoded
SmallVector< char, 1024 > Encoded
Buffer used for encoding the bitstream before writing it to the final stream.
Definition: BitstreamRemarkSerializer.h:52
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