OLD | NEW |
1 //===- NaClBitCodes.h - Enum values for the bitcode format ------*- C++ -*-===// | 1 //===- NaClBitCodes.h - Enum values for the bitcode format ------*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This header Bitcode enum values. | 10 // This header Bitcode enum values. |
11 // | 11 // |
12 // The enum values defined in this file should be considered permanent. If | 12 // The enum values defined in this file should be considered permanent. If |
13 // new features are added, they should have values added at the end of the | 13 // new features are added, they should have values added at the end of the |
14 // respective lists. | 14 // respective lists. |
15 // | 15 // |
16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
17 | 17 |
18 #ifndef LLVM_BITCODE_NACL_NACLBITCODES_H | 18 #ifndef LLVM_BITCODE_NACL_NACLBITCODES_H |
19 #define LLVM_BITCODE_NACL_NACLBITCODES_H | 19 #define LLVM_BITCODE_NACL_NACLBITCODES_H |
20 | 20 |
21 #include "llvm/ADT/SmallVector.h" | 21 #include "llvm/ADT/SmallVector.h" |
22 #include "llvm/Support/DataTypes.h" | 22 #include "llvm/Support/DataTypes.h" |
23 #include "llvm/Support/ErrorHandling.h" | 23 #include "llvm/Support/ErrorHandling.h" |
24 #include "llvm/Support/MathExtras.h" | 24 #include "llvm/Support/MathExtras.h" |
25 #include <cassert> | 25 #include <climits> |
26 | 26 |
27 namespace llvm { | 27 namespace llvm { |
28 class raw_ostream; | 28 class raw_ostream; |
29 | 29 |
30 namespace naclbitc { | 30 namespace naclbitc { |
31 enum StandardWidths { | 31 enum StandardWidths { |
32 BlockIDWidth = 8, // We use VBR-8 for block IDs. | 32 BlockIDWidth = 8, // We use VBR-8 for block IDs. |
33 CodeLenWidth = 4, // Codelen are VBR-4. | 33 CodeLenWidth = 4, // Codelen are VBR-4. |
34 BlockSizeWidth = 32, // BlockSize up to 2^32 32-bit words = 16GB per block. | 34 BlockSizeWidth = 32, // BlockSize up to 2^32 32-bit words = 16GB per block. |
35 MaxAbbrevWidth = 32, // Maximum value allowed for Fixed and VBR. | 35 MaxAbbrevWidth = 32, // Maximum value allowed for Fixed and VBR. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 DEFAULT_MAX_ABBREV = FIRST_APPLICATION_ABBREV-1 | 72 DEFAULT_MAX_ABBREV = FIRST_APPLICATION_ABBREV-1 |
73 }; | 73 }; |
74 | 74 |
75 /// StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO | 75 /// StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO |
76 /// block, which contains metadata about other blocks in the file. | 76 /// block, which contains metadata about other blocks in the file. |
77 enum StandardBlockIDs { | 77 enum StandardBlockIDs { |
78 /// BLOCKINFO_BLOCK is used to define metadata about blocks, for example, | 78 /// BLOCKINFO_BLOCK is used to define metadata about blocks, for example, |
79 /// standard abbrevs that should be available to all blocks of a specified | 79 /// standard abbrevs that should be available to all blocks of a specified |
80 /// ID. | 80 /// ID. |
81 BLOCKINFO_BLOCK_ID = 0, | 81 BLOCKINFO_BLOCK_ID = 0, |
82 | 82 // Block IDs 1-6 are reserved for future expansion. |
83 // Block IDs 1-7 are reserved for future expansion. | 83 // Dummy block added around all records in a bitcode file. Allows the code |
| 84 // to treat top-level records like all other records (i.e. all records |
| 85 // appear in a block). |
| 86 TOP_LEVEL_BLOCKID = 7, |
84 FIRST_APPLICATION_BLOCKID = 8 | 87 FIRST_APPLICATION_BLOCKID = 8 |
85 }; | 88 }; |
86 | 89 |
87 /// BlockInfoCodes - The blockinfo block contains metadata about user-defined | 90 /// BlockInfoCodes - The blockinfo block contains metadata about user-defined |
88 /// blocks. | 91 /// blocks. |
89 enum BlockInfoCodes { | 92 enum BlockInfoCodes { |
90 // DEFINE_ABBREV has magic semantics here, applying to the current SETBID'd | 93 // DEFINE_ABBREV has magic semantics here, applying to the current SETBID'd |
91 // block, instead of the BlockInfo block. | 94 // block, instead of the BlockInfo block. |
92 | 95 |
93 BLOCKINFO_CODE_SETBID = 1, // SETBID: [blockid#] | 96 BLOCKINFO_CODE_SETBID = 1, // SETBID: [blockid#] |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 403 |
401 // Creates a selector range to handle fixed abbrevations up to | 404 // Creates a selector range to handle fixed abbrevations up to |
402 // the specified value. | 405 // the specified value. |
403 explicit NaClBitcodeSelectorAbbrev(unsigned MaxAbbrev) | 406 explicit NaClBitcodeSelectorAbbrev(unsigned MaxAbbrev) |
404 : IsFixed(true), | 407 : IsFixed(true), |
405 NumBits(NaClBitsNeededForValue(MaxAbbrev)) {} | 408 NumBits(NaClBitsNeededForValue(MaxAbbrev)) {} |
406 }; | 409 }; |
407 } // End llvm namespace | 410 } // End llvm namespace |
408 | 411 |
409 #endif | 412 #endif |
OLD | NEW |