@@ -152,26 +152,6 @@ Other tools that support remarks:
152152 .. option :: -opt-remarks-format= <format >
153153 .. option :: -opt-remarks-with-hotness
154154
155- Serialization modes
156- ===================
157-
158- There are two modes available for serializing remarks:
159-
160- ``Separate ``
161-
162- In this mode, the remarks and the metadata are serialized separately. The
163- client is responsible for parsing the metadata first, then use the metadata
164- to correctly parse the remarks.
165-
166- ``Standalone ``
167-
168- In this mode, the remarks and the metadata are serialized to the same
169- stream. The metadata will always come before the remarks.
170-
171- The compiler does not support emitting standalone remarks. This mode is
172- more suited for post-processing tools like linkers, that can merge the
173- remarks for one whole project.
174-
175155.. _yamlremarks :
176156
177157YAML remarks
@@ -374,27 +354,11 @@ This block can contain the following records:
374354The remark container
375355--------------------
376356
377- Bitstream remarks are designed to be used in two different modes:
378-
379- ``The separate mode ``
380-
381- The separate mode is the mode that is typically used during compilation. It
382- provides a way to serialize the remark entries to a stream while some
383- metadata is kept in memory to be emitted in the product of the compilation
384- (typically, an object file).
385-
386- ``The standalone mode ``
387-
388- The standalone mode is typically stored and used after the distribution of
389- a program. It contains all the information that allows the parsing of all
390- the remarks without having any external dependencies.
391-
392- In order to support multiple modes, the format introduces the concept of a
393- bitstream remark container type.
357+ The bitstream remark container supports multiple types:
394358
395- .. _ bitstreamremarksseparateremarksmeta :
359+ .. _ bitstreamremarksfileexternal :
396360
397- ``SeparateRemarksMeta: the metadata emitted separately ``
361+ ``RemarksFileExternal: a link to an external remarks file ``
398362
399363 This container type expects only a :ref: `META_BLOCK <bitstreamremarksmetablock >` containing only:
400364
@@ -406,84 +370,33 @@ bitstream remark container type.
406370 clients to retrieve remarks and their associated metadata directly from
407371 intermediate products.
408372
409- ``SeparateRemarksFile: the remark entries emitted separately ``
373+ The container versions of the external separate container should match in order to
374+ have a well-formed file.
410375
411- This container type expects only a :ref: `META_BLOCK <bitstreamremarksmetablock >` containing only:
412-
413- * :ref: `RECORD_META_CONTAINER_INFO <bitstreamremarksrecordmetacontainerinfo >`
414- * :ref: `RECORD_META_REMARK_VERSION <bitstreamremarksrecordmetaremarkversion >`
376+ .. _bitstreamremarksfile :
415377
416- This container type expects 0 or more :ref: ` REMARK_BLOCK < bitstreamremarksremarkblock >`.
378+ `` RemarksFile: a standalone remarks file ``
417379
418- Typically, this is emitted in a side-file alongside an object file, and is
419- made to be able to stream to without increasing the memory consumption of
420- the compiler. This is referenced by the :ref: `RECORD_META_EXTERNAL_FILE
421- <bitstreamremarksrecordmetaexternalfile>` entry in the
422- :ref: `SeparateRemarksMeta <bitstreamremarksseparateremarksmeta >` container.
380+ This container type expects a :ref: `META_BLOCK <bitstreamremarksmetablock >` containing only:
423381
424- When the parser tries to parse a container that contains the metadata for the
425- separate remarks, it should parse the version and type, then keep the string
426- table in memory while opening the external file, validating its metadata and
427- parsing the remark entries.
382+ * :ref: `RECORD_META_CONTAINER_INFO <bitstreamremarksrecordmetacontainerinfo >`
383+ * :ref: `RECORD_META_REMARK_VERSION <bitstreamremarksrecordmetaremarkversion >`
428384
429- The container versions from the separate container should match in order to
430- have a well-formed file.
385+ Then, this container type expects 1 or more :ref: ` REMARK_BLOCK < bitstreamremarksremarkblock >`.
386+ If no remarks are emitted, the meta blocks are also not emitted, so the file is empty .
431387
432- ``Standalone: the metadata and the remark entries emitted together ``
388+ After the remark blocks, another :ref: `META_BLOCK <bitstreamremarksmetablock >` is emitted, containing:
389+ * :ref: `RECORD_META_STRTAB <bitstreamremarksrecordmetastrtab >`
433390
434- This container type expects only a :ref: `META_BLOCK <bitstreamremarksmetablock >` containing only:
391+ When the parser reads this container type, it jumps to the end of the file
392+ to read the string table before parsing the individual remarks.
435393
436- * :ref: `RECORD_META_CONTAINER_INFO <bitstreamremarksrecordmetacontainerinfo >`
437- * :ref: `RECORD_META_REMARK_VERSION <bitstreamremarksrecordmetaremarkversion >`
438- * :ref: `RECORD_META_STRTAB <bitstreamremarksrecordmetastrtab >`
394+ Standalone remarks files can be referenced by the
395+ :ref: `RECORD_META_EXTERNAL_FILE <bitstreamremarksrecordmetaexternalfile >`
396+ entry in the :ref: `RemarksFileExternal
397+ <bitstreamremarksfileexternal>` container.
439398
440- This container type expects 0 or more :ref: `REMARK_BLOCK <bitstreamremarksremarkblock >`.
441-
442- A complete output of :program: `llvm-bcanalyzer ` on the different container types:
443-
444- ``SeparateRemarksMeta ``
445-
446- .. code-block :: none
447-
448- <BLOCKINFO_BLOCK/>
449- <Meta BlockID=8 NumWords=13 BlockCodeSize=3>
450- <Container info codeid=1 abbrevid=4 op0=5 op1=0/>
451- <String table codeid=3 abbrevid=5/> blob data = 'pass\\x00key\\x00value\\x00'
452- <External File codeid=4 abbrevid=6/> blob data = '/path/to/file/name'
453- </Meta>
454-
455- ``SeparateRemarksFile ``
456-
457- .. code-block :: none
458-
459- <BLOCKINFO_BLOCK/>
460- <Meta BlockID=8 NumWords=3 BlockCodeSize=3>
461- <Container info codeid=1 abbrevid=4 op0=0 op1=1/>
462- <Remark version codeid=2 abbrevid=5 op0=0/>
463- </Meta>
464- <Remark BlockID=9 NumWords=8 BlockCodeSize=4>
465- <Remark header codeid=5 abbrevid=4 op0=2 op1=0 op2=1 op3=2/>
466- <Remark debug location codeid=6 abbrevid=5 op0=3 op1=99 op2=55/>
467- <Remark hotness codeid=7 abbrevid=6 op0=999999999/>
468- <Argument with debug location codeid=8 abbrevid=7 op0=4 op1=5 op2=6 op3=11 op4=66/>
469- </Remark>
470-
471- ``Standalone ``
472-
473- .. code-block :: none
474-
475- <BLOCKINFO_BLOCK/>
476- <Meta BlockID=8 NumWords=15 BlockCodeSize=3>
477- <Container info codeid=1 abbrevid=4 op0=5 op1=2/>
478- <Remark version codeid=2 abbrevid=5 op0=30/>
479- <String table codeid=3 abbrevid=6/> blob data = 'pass\\x00remark\\x00function\\x00path\\x00key\\x00value\\x00argpath\\x00'
480- </Meta>
481- <Remark BlockID=9 NumWords=8 BlockCodeSize=4>
482- <Remark header codeid=5 abbrevid=4 op0=2 op1=1 op2=0 op3=2/>
483- <Remark debug location codeid=6 abbrevid=5 op0=3 op1=99 op2=55/>
484- <Remark hotness codeid=7 abbrevid=6 op0=999999999/>
485- <Argument with debug location codeid=8 abbrevid=7 op0=4 op1=5 op2=6 op3=11 op4=66/>
486- </Remark>
399+ .. FIXME: Add complete output of :program:`llvm-bcanalyzer` on the different container types (once format changes are completed)
487400
488401 opt-viewer
489402==========
0 commit comments