Added target hook for post-indexed memory ops transformation.
[oota-llvm.git] / include / llvm / Bytecode / Format.h
1 //===-- llvm/Bytecode/Format.h - VM bytecode file format info ---*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 //
8 //===----------------------------------------------------------------------===//
9 //
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.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_BYTECODE_FORMAT_H
16 #define LLVM_BYTECODE_FORMAT_H
17
18 namespace llvm {
19
20 class BytecodeFormat {   // Throw the constants into a poorman's namespace...
21   BytecodeFormat();      // do not implement
22 public:
23
24   // ID Numbers that are used in bytecode files...
25   enum FileBlockIDs {
26     // File level identifiers...
27     Module = 0x01,
28
29     // Module subtypes:
30     Function = 0x11,
31     ConstantPool,
32     SymbolTable,
33     ModuleGlobalInfo,
34     GlobalTypePlane,
35     DependentLibs,
36
37     // Function subtypes:
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)
41
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,
45
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
51   };
52
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
61   /// format.
62   enum CompressedBytecodeBlockIdentifiers {
63
64     // Zero value ist verbotten!
65     Reserved_DoNotUse = 0x00,      ///< Don't use this!
66
67     // This is the uber block that contains the rest of the blocks.
68     ModuleBlockID = 0x01,          ///< 1.3 identifier for modules
69
70     // Module subtypes:
71
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
78
79     // Function subtypes:
80
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
84
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
90
91     // Not a block id, just used to count them
92     NumberOfBlockIDs
93   };
94
95 };
96
97 } // End llvm namespace
98
99 #endif