1 //===-- BitstreamRemarkContainer.h - Container for remarks --------------*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file provides declarations for things used in the various types of
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_REMARKS_REMARK_CONTAINER_H
15 #define LLVM_REMARKS_REMARK_CONTAINER_H
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Bitstream/BitCodes.h"
24 /// The current version of the remark container.
25 /// Note: this is different from the version of the remark entry.
26 constexpr uint64_t CurrentContainerVersion = 0;
27 /// The magic number used for identifying remark blocks.
28 constexpr StringLiteral ContainerMagic("RMRK");
30 /// Type of the remark container.
31 /// The remark container has two modes:
32 /// * separate: the metadata is separate from the remarks and points to the
33 /// auxiliary file that contains the remarks.
34 /// * standalone: the metadata and the remarks are emitted together.
35 enum class BitstreamRemarkContainerType {
36 /// The metadata emitted separately.
37 /// This will contain the following:
38 /// * Container version and type
42 /// The remarks emitted separately.
43 /// This will contain the following:
44 /// * Container version and type
47 /// Everything is emitted together.
48 /// This will contain the following:
49 /// * Container version and type
53 First = SeparateRemarksMeta,
57 /// The possible blocks that will be encountered in a bitstream remark
60 /// The metadata block is mandatory. It should always come after the
61 /// BLOCKINFO_BLOCK, and contains metadata that should be used when parsing
63 /// There should always be only one META_BLOCK.
64 META_BLOCK_ID = bitc::FIRST_APPLICATION_BLOCKID,
65 /// One remark entry is represented using a REMARK_BLOCK. There can be
66 /// multiple REMARK_BLOCKs in the same file.
70 constexpr StringRef MetaBlockName = StringRef("Meta", 4);
71 constexpr StringRef RemarkBlockName = StringRef("Remark", 6);
73 /// The possible records that can be encountered in the previously described
76 // Meta block records.
77 RECORD_META_CONTAINER_INFO = 1,
78 RECORD_META_REMARK_VERSION,
80 RECORD_META_EXTERNAL_FILE,
81 // Remark block records.
83 RECORD_REMARK_DEBUG_LOC,
84 RECORD_REMARK_HOTNESS,
85 RECORD_REMARK_ARG_WITH_DEBUGLOC,
86 RECORD_REMARK_ARG_WITHOUT_DEBUGLOC,
88 RECORD_FIRST = RECORD_META_CONTAINER_INFO,
89 RECORD_LAST = RECORD_REMARK_ARG_WITHOUT_DEBUGLOC
92 constexpr StringRef MetaContainerInfoName = StringRef("Container info", 14);
93 constexpr StringRef MetaRemarkVersionName = StringRef("Remark version", 14);
94 constexpr StringRef MetaStrTabName = StringRef("String table", 12);
95 constexpr StringRef MetaExternalFileName = StringRef("External File", 13);
96 constexpr StringRef RemarkHeaderName = StringRef("Remark header", 13);
97 constexpr StringRef RemarkDebugLocName = StringRef("Remark debug location", 21);
98 constexpr StringRef RemarkHotnessName = StringRef("Remark hotness", 14);
99 constexpr StringRef RemarkArgWithDebugLocName =
100 StringRef("Argument with debug location", 28);
101 constexpr StringRef RemarkArgWithoutDebugLocName = StringRef("Argument", 8);
103 } // end namespace remarks
104 } // end namespace llvm
106 #endif /* LLVM_REMARKS_REMARK_CONTAINER_H */