LLVM  16.0.0git
BitCodeEnums.h
Go to the documentation of this file.
1 //===- BitCodeEnums.h - Core enums for the bitstream format -----*- C++ -*-===//
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 header defines "core" bitstream enum values.
10 // It has been separated from the other header that defines bitstream enum
11 // values, BitCodes.h, to allow tools to track changes to the various
12 // bitstream and bitcode enums without needing to fully or partially build
13 // LLVM itself.
14 //
15 // The enum values defined in this file should be considered permanent. If
16 // new features are added, they should have values added at the end of the
17 // respective lists.
18 //
19 //===----------------------------------------------------------------------===//
20 
21 #ifndef LLVM_BITSTREAM_BITCODEENUMS_H
22 #define LLVM_BITSTREAM_BITCODEENUMS_H
23 
24 namespace llvm {
25 /// Offsets of the 32-bit fields of bitstream wrapper header.
26 enum BitstreamWrapperHeader : unsigned {
27  BWH_MagicField = 0 * 4,
29  BWH_OffsetField = 2 * 4,
30  BWH_SizeField = 3 * 4,
33 };
34 
35 namespace bitc {
37  BlockIDWidth = 8, // We use VBR-8 for block IDs.
38  CodeLenWidth = 4, // Codelen are VBR-4.
39  BlockSizeWidth = 32 // BlockSize up to 2^32 32-bit words = 16GB per block.
40 };
41 
42 // The standard abbrev namespace always has a way to exit a block, enter a
43 // nested block, define abbrevs, and define an unabbreviated record.
45  END_BLOCK = 0, // Must be zero to guarantee termination for broken bitcode.
47 
48  /// DEFINE_ABBREV - Defines an abbrev for the current block. It consists
49  /// of a vbr5 for # operand infos. Each operand info is emitted with a
50  /// single bit to indicate if it is a literal encoding. If so, the value is
51  /// emitted with a vbr8. If not, the encoding is emitted as 3 bits followed
52  /// by the info value as a vbr5 if needed.
54 
55  // UNABBREV_RECORDs are emitted with a vbr6 for the record code, followed by
56  // a vbr6 for the # operands, followed by vbr6's for each operand.
58 
59  // This is not a code, this is a marker for the first abbrev assignment.
61 };
62 
63 /// StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO
64 /// block, which contains metadata about other blocks in the file.
66  /// BLOCKINFO_BLOCK is used to define metadata about blocks, for example,
67  /// standard abbrevs that should be available to all blocks of a specified
68  /// ID.
70 
71  // Block IDs 1-7 are reserved for future expansion.
73 };
74 
75 /// BlockInfoCodes - The blockinfo block contains metadata about user-defined
76 /// blocks.
78  // DEFINE_ABBREV has magic semantics here, applying to the current SETBID'd
79  // block, instead of the BlockInfo block.
80 
81  BLOCKINFO_CODE_SETBID = 1, // SETBID: [blockid#]
82  BLOCKINFO_CODE_BLOCKNAME = 2, // BLOCKNAME: [name]
83  BLOCKINFO_CODE_SETRECORDNAME = 3 // BLOCKINFO_CODE_SETRECORDNAME:
84  // [id, name]
85 };
86 
87 } // namespace bitc
88 } // namespace llvm
89 
90 #endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::bitc::DEFINE_ABBREV
@ DEFINE_ABBREV
DEFINE_ABBREV - Defines an abbrev for the current block.
Definition: BitCodeEnums.h:53
llvm::bitc::BLOCKINFO_BLOCK_ID
@ BLOCKINFO_BLOCK_ID
BLOCKINFO_BLOCK is used to define metadata about blocks, for example, standard abbrevs that should be...
Definition: BitCodeEnums.h:69
llvm::bitc::StandardBlockIDs
StandardBlockIDs
StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO block, which contains metadat...
Definition: BitCodeEnums.h:65
llvm::bitc::BlockIDWidth
@ BlockIDWidth
Definition: BitCodeEnums.h:37
llvm::bitc::ENTER_SUBBLOCK
@ ENTER_SUBBLOCK
Definition: BitCodeEnums.h:46
llvm::BWH_CPUTypeField
@ BWH_CPUTypeField
Definition: BitCodeEnums.h:31
llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME
@ BLOCKINFO_CODE_SETRECORDNAME
Definition: BitCodeEnums.h:83
llvm::bitc::END_BLOCK
@ END_BLOCK
Definition: BitCodeEnums.h:45
llvm::BWH_OffsetField
@ BWH_OffsetField
Definition: BitCodeEnums.h:29
llvm::BWH_MagicField
@ BWH_MagicField
Definition: BitCodeEnums.h:27
llvm::bitc::FIRST_APPLICATION_BLOCKID
@ FIRST_APPLICATION_BLOCKID
Definition: BitCodeEnums.h:72
llvm::BWH_HeaderSize
@ BWH_HeaderSize
Definition: BitCodeEnums.h:32
llvm::BWH_SizeField
@ BWH_SizeField
Definition: BitCodeEnums.h:30
llvm::bitc::StandardWidths
StandardWidths
Definition: BitCodeEnums.h:36
llvm::bitc::BlockSizeWidth
@ BlockSizeWidth
Definition: BitCodeEnums.h:39
llvm::bitc::BlockInfoCodes
BlockInfoCodes
BlockInfoCodes - The blockinfo block contains metadata about user-defined blocks.
Definition: BitCodeEnums.h:77
llvm::bitc::BLOCKINFO_CODE_SETBID
@ BLOCKINFO_CODE_SETBID
Definition: BitCodeEnums.h:81
llvm::bitc::BLOCKINFO_CODE_BLOCKNAME
@ BLOCKINFO_CODE_BLOCKNAME
Definition: BitCodeEnums.h:82
llvm::bitc::FixedAbbrevIDs
FixedAbbrevIDs
Definition: BitCodeEnums.h:44
llvm::bitc::UNABBREV_RECORD
@ UNABBREV_RECORD
Definition: BitCodeEnums.h:57
llvm::bitc::FIRST_APPLICATION_ABBREV
@ FIRST_APPLICATION_ABBREV
Definition: BitCodeEnums.h:60
llvm::bitc::CodeLenWidth
@ CodeLenWidth
Definition: BitCodeEnums.h:38
llvm::BWH_VersionField
@ BWH_VersionField
Definition: BitCodeEnums.h:28
llvm::BitstreamWrapperHeader
BitstreamWrapperHeader
Offsets of the 32-bit fields of bitstream wrapper header.
Definition: BitCodeEnums.h:26