| 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  : unsigned { | 
| 27 |   BWH_MagicField = 0 * 4, | 
| 28 |   BWH_VersionField = 1 * 4, | 
| 29 |   BWH_OffsetField = 2 * 4, | 
| 30 |   BWH_SizeField = 3 * 4, | 
| 31 |   BWH_CPUTypeField = 4 * 4, | 
| 32 |    = 5 * 4 | 
| 33 | }; | 
| 34 |  | 
| 35 | namespace bitc { | 
| 36 | enum StandardWidths { | 
| 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. | 
| 44 | enum FixedAbbrevIDs { | 
| 45 |   END_BLOCK = 0, // Must be zero to guarantee termination for broken bitcode. | 
| 46 |   ENTER_SUBBLOCK = 1, | 
| 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. | 
| 53 |   DEFINE_ABBREV = 2, | 
| 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. | 
| 57 |   UNABBREV_RECORD = 3, | 
| 58 |  | 
| 59 |   // This is not a code, this is a marker for the first abbrev assignment. | 
| 60 |   FIRST_APPLICATION_ABBREV = 4 | 
| 61 | }; | 
| 62 |  | 
| 63 | /// StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO | 
| 64 | /// block, which contains metadata about other blocks in the file. | 
| 65 | enum StandardBlockIDs { | 
| 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. | 
| 69 |   BLOCKINFO_BLOCK_ID = 0, | 
| 70 |  | 
| 71 |   // Block IDs 1-7 are reserved for future expansion. | 
| 72 |   FIRST_APPLICATION_BLOCKID = 8 | 
| 73 | }; | 
| 74 |  | 
| 75 | /// BlockInfoCodes - The blockinfo block contains metadata about user-defined | 
| 76 | /// blocks. | 
| 77 | enum BlockInfoCodes { | 
| 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 | 
| 91 |  |