Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:25

0001 //===-- BitstreamRemarkContainer.h - Container for remarks --------------*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file provides declarations for things used in the various types of
0010 // remark containers.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_REMARKS_BITSTREAMREMARKCONTAINER_H
0015 #define LLVM_REMARKS_BITSTREAMREMARKCONTAINER_H
0016 
0017 #include "llvm/ADT/StringRef.h"
0018 #include "llvm/Bitstream/BitCodes.h"
0019 #include <cstdint>
0020 
0021 namespace llvm {
0022 namespace remarks {
0023 
0024 /// The current version of the remark container.
0025 /// Note: this is different from the version of the remark entry.
0026 constexpr uint64_t CurrentContainerVersion = 0;
0027 /// The magic number used for identifying remark blocks.
0028 constexpr StringLiteral ContainerMagic("RMRK");
0029 
0030 /// Type of the remark container.
0031 /// The remark container has two modes:
0032 /// * separate: the metadata is separate from the remarks and points to the
0033 ///             auxiliary file that contains the remarks.
0034 /// * standalone: the metadata and the remarks are emitted together.
0035 enum class BitstreamRemarkContainerType {
0036   /// The metadata emitted separately.
0037   /// This will contain the following:
0038   /// * Container version and type
0039   /// * String table
0040   /// * External file
0041   SeparateRemarksMeta,
0042   /// The remarks emitted separately.
0043   /// This will contain the following:
0044   /// * Container version and type
0045   /// * Remark version
0046   SeparateRemarksFile,
0047   /// Everything is emitted together.
0048   /// This will contain the following:
0049   /// * Container version and type
0050   /// * Remark version
0051   /// * String table
0052   Standalone,
0053   First = SeparateRemarksMeta,
0054   Last = Standalone,
0055 };
0056 
0057 /// The possible blocks that will be encountered in a bitstream remark
0058 /// container.
0059 enum BlockIDs {
0060   /// The metadata block is mandatory. It should always come after the
0061   /// BLOCKINFO_BLOCK, and contains metadata that should be used when parsing
0062   /// REMARK_BLOCKs.
0063   /// There should always be only one META_BLOCK.
0064   META_BLOCK_ID = bitc::FIRST_APPLICATION_BLOCKID,
0065   /// One remark entry is represented using a REMARK_BLOCK. There can be
0066   /// multiple REMARK_BLOCKs in the same file.
0067   REMARK_BLOCK_ID
0068 };
0069 
0070 constexpr StringRef MetaBlockName = StringRef("Meta", 4);
0071 constexpr StringRef RemarkBlockName = StringRef("Remark", 6);
0072 
0073 /// The possible records that can be encountered in the previously described
0074 /// blocks.
0075 enum RecordIDs {
0076   // Meta block records.
0077   RECORD_META_CONTAINER_INFO = 1,
0078   RECORD_META_REMARK_VERSION,
0079   RECORD_META_STRTAB,
0080   RECORD_META_EXTERNAL_FILE,
0081   // Remark block records.
0082   RECORD_REMARK_HEADER,
0083   RECORD_REMARK_DEBUG_LOC,
0084   RECORD_REMARK_HOTNESS,
0085   RECORD_REMARK_ARG_WITH_DEBUGLOC,
0086   RECORD_REMARK_ARG_WITHOUT_DEBUGLOC,
0087   // Helpers.
0088   RECORD_FIRST = RECORD_META_CONTAINER_INFO,
0089   RECORD_LAST = RECORD_REMARK_ARG_WITHOUT_DEBUGLOC
0090 };
0091 
0092 constexpr StringRef MetaContainerInfoName = StringRef("Container info", 14);
0093 constexpr StringRef MetaRemarkVersionName = StringRef("Remark version", 14);
0094 constexpr StringRef MetaStrTabName = StringRef("String table", 12);
0095 constexpr StringRef MetaExternalFileName = StringRef("External File", 13);
0096 constexpr StringRef RemarkHeaderName = StringRef("Remark header", 13);
0097 constexpr StringRef RemarkDebugLocName = StringRef("Remark debug location", 21);
0098 constexpr StringRef RemarkHotnessName = StringRef("Remark hotness", 14);
0099 constexpr StringRef RemarkArgWithDebugLocName =
0100     StringRef("Argument with debug location", 28);
0101 constexpr StringRef RemarkArgWithoutDebugLocName = StringRef("Argument", 8);
0102 
0103 } // end namespace remarks
0104 } // end namespace llvm
0105 
0106 #endif // LLVM_REMARKS_BITSTREAMREMARKCONTAINER_H