LLVM API Documentation
00001 //===-- llvm/Bytecode/Format.h - VM bytecode file format info ---*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This header defines intrinsic constants that are useful to libraries that 00011 // need to hack on bytecode files directly, like the reader and writer. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_BYTECODE_FORMAT_H 00016 #define LLVM_BYTECODE_FORMAT_H 00017 00018 namespace llvm { 00019 00020 class BytecodeFormat { // Throw the constants into a poorman's namespace... 00021 BytecodeFormat(); // do not implement 00022 public: 00023 00024 // ID Numbers that are used in bytecode files... 00025 enum FileBlockIDs { 00026 // File level identifiers... 00027 Module = 0x01, 00028 00029 // Module subtypes: 00030 Function = 0x11, 00031 ConstantPool, 00032 SymbolTable, 00033 ModuleGlobalInfo, 00034 GlobalTypePlane, 00035 DependentLibs, 00036 00037 // Function subtypes: 00038 // Can also have ConstantPool block 00039 // Can also have SymbolTable block 00040 BasicBlock = 0x31,// May contain many basic blocks (obsolete since LLVM 1.1) 00041 00042 // InstructionList - The instructions in the body of a function. This 00043 // superceeds the old BasicBlock node used in LLVM 1.0. 00044 InstructionList = 0x32, 00045 00046 // CompactionTable - blocks with this id are used to define local remapping 00047 // tables for a function, allowing the indices used within the function to 00048 // be as small as possible. This often allows the instructions to be 00049 // encoded more efficiently. 00050 CompactionTable = 0x33 00051 }; 00052 00053 /// In LLVM 1.3 format, the identifier and the size of the block are 00054 /// encoded into a single vbr_uint32 with 5 bits for the block identifier 00055 /// and 27-bits for block length. This limits blocks to a maximum of 00056 /// 128MBytes of data, and block types to 31 which should be sufficient 00057 /// for the foreseeable usage. Because the values of block identifiers MUST 00058 /// fit within 5 bits (values 1-31), this enumeration is used to ensure 00059 /// smaller values are used for 1.3 and subsequent bytecode versions. 00060 /// @brief The block number identifiers used in LLVM 1.3 bytecode 00061 /// format. 00062 enum CompressedBytecodeBlockIdentifiers { 00063 00064 // Zero value ist verbotten! 00065 Reserved_DoNotUse = 0x00, ///< Don't use this! 00066 00067 // This is the uber block that contains the rest of the blocks. 00068 ModuleBlockID = 0x01, ///< 1.3 identifier for modules 00069 00070 // Module subtypes: 00071 00072 // This is the identifier for a function 00073 FunctionBlockID = 0x02, ///< 1.3 identifier for Functions 00074 ConstantPoolBlockID = 0x03, ///< 1.3 identifier for constant pool 00075 SymbolTableBlockID = 0x04, ///< 1.3 identifier for symbol table 00076 ModuleGlobalInfoBlockID = 0x05,///< 1.3 identifier for module globals 00077 GlobalTypePlaneBlockID = 0x06, ///< 1.3 identifier for global types 00078 00079 // Function subtypes: 00080 00081 // InstructionList - The instructions in the body of a function. This 00082 // superceeds the old BasicBlock node used in LLVM 1.0. 00083 InstructionListBlockID = 0x07, ///< 1.3 identifier for insruction list 00084 00085 // CompactionTable - blocks with this id are used to define local remapping 00086 // tables for a function, allowing the indices used within the function to 00087 // be as small as possible. This often allows the instructions to be 00088 // encoded more efficiently. 00089 CompactionTableBlockID = 0x08, ///< 1.3 identifier for compaction tables 00090 00091 // Not a block id, just used to count them 00092 NumberOfBlockIDs 00093 }; 00094 00095 }; 00096 00097 } // End llvm namespace 00098 00099 #endif