1 //===-- llvm/Bytecode/Format.h - VM bytecode file format info ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header defines intrinsic constants that are useful to libraries that
11 // need to hack on bytecode files directly, like the reader and writer.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_BYTECODE_FORMAT_H
16 #define LLVM_BYTECODE_FORMAT_H
20 class BytecodeFormat { // Throw the constants into a poorman's namespace...
21 BytecodeFormat(); // do not implement
24 // ID Numbers that are used in bytecode files...
26 // File level identifiers...
38 // Can also have ConstantPool block
39 // Can also have SymbolTable block
40 BasicBlock = 0x31,// May contain many basic blocks (obsolete since LLVM 1.1)
42 // InstructionList - The instructions in the body of a function. This
43 // superceeds the old BasicBlock node used in LLVM 1.0.
44 InstructionList = 0x32,
46 // CompactionTable - blocks with this id are used to define local remapping
47 // tables for a function, allowing the indices used within the function to
48 // be as small as possible. This often allows the instructions to be
49 // encoded more efficiently.
50 CompactionTable = 0x33,
53 /// In LLVM 1.3 format, the identifier and the size of the block are
54 /// encoded into a single vbr_uint32 with 5 bits for the block identifier
55 /// and 27-bits for block length. This limits blocks to a maximum of
56 /// 128MBytes of data, and block types to 31 which should be sufficient
57 /// for the foreseeable usage. Because the values of block identifiers MUST
58 /// fit within 5 bits (values 1-31), this enumeration is used to ensure
59 /// smaller values are used for 1.3 and subsequent bytecode versions.
60 /// @brief The block number identifiers used in LLVM 1.3 bytecode
62 enum CompressedBytecodeBlockIdentifiers {
64 // Zero value ist verbotten!
65 Reserved_DoNotUse = 0x00, ///< Don't use this!
67 // This is the uber block that contains the rest of the blocks.
68 ModuleBlockID = 0x01, ///< 1.3 identifier for modules
72 // This is the identifier for a function
73 FunctionBlockID = 0x02, ///< 1.3 identifier for Functions
74 ConstantPoolBlockID = 0x03, ///< 1.3 identifier for constant pool
75 SymbolTableBlockID = 0x04, ///< 1.3 identifier for symbol table
76 ModuleGlobalInfoBlockID = 0x05,///< 1.3 identifier for module globals
77 GlobalTypePlaneBlockID = 0x06, ///< 1.3 identifier for global types
81 // InstructionList - The instructions in the body of a function. This
82 // superceeds the old BasicBlock node used in LLVM 1.0.
83 InstructionListBlockID = 0x07, ///< 1.3 identifier for insruction list
85 // CompactionTable - blocks with this id are used to define local remapping
86 // tables for a function, allowing the indices used within the function to
87 // be as small as possible. This often allows the instructions to be
88 // encoded more efficiently.
89 CompactionTableBlockID = 0x08, ///< 1.3 identifier for compaction tables
91 // Not a block id, just used to count them
97 } // End llvm namespace