[llvm-commits] CVS: llvm/include/llvm/Bytecode/Analyzer.h Format.h

Reid Spencer reid at x10sys.com
Mon Nov 13 20:47:39 PST 2006



Changes in directory llvm/include/llvm/Bytecode:

Analyzer.h updated: 1.11 -> 1.12
Format.h updated: 1.13 -> 1.14
---
Log message:

Discard code that supported old bytecode formats. This makes the Bytecode
Reader code much easier to read and maintain. Backwards compatibility from
version 5 format has been retained. Older formats will produce an error.


---
Diffs of the changes:  (+21 -62)

 Analyzer.h |    2 -
 Format.h   |   81 +++++++++++++++----------------------------------------------
 2 files changed, 21 insertions(+), 62 deletions(-)


Index: llvm/include/llvm/Bytecode/Analyzer.h
diff -u llvm/include/llvm/Bytecode/Analyzer.h:1.11 llvm/include/llvm/Bytecode/Analyzer.h:1.12
--- llvm/include/llvm/Bytecode/Analyzer.h:1.11	Thu Apr 21 15:34:13 2005
+++ llvm/include/llvm/Bytecode/Analyzer.h	Mon Nov 13 22:47:22 2006
@@ -68,7 +68,7 @@
   unsigned vbrCompBytes;    ///< Number of vbr bytes (compressed)
   unsigned vbrExpdBytes;    ///< Number of vbr bytes (expanded)
 
-  typedef std::map<BytecodeFormat::CompressedBytecodeBlockIdentifiers,unsigned>
+  typedef std::map<BytecodeFormat::BytecodeBlockIdentifiers,unsigned>
       BlockSizeMap;
   BlockSizeMap BlockSizes;
 


Index: llvm/include/llvm/Bytecode/Format.h
diff -u llvm/include/llvm/Bytecode/Format.h:1.13 llvm/include/llvm/Bytecode/Format.h:1.14
--- llvm/include/llvm/Bytecode/Format.h:1.13	Wed Feb 22 10:23:42 2006
+++ llvm/include/llvm/Bytecode/Format.h	Mon Nov 13 22:47:22 2006
@@ -20,78 +20,37 @@
 class BytecodeFormat {   // Throw the constants into a poorman's namespace...
   BytecodeFormat();      // do not implement
 public:
-
-  // ID Numbers that are used in bytecode files...
-  enum FileBlockIDs {
-    // File level identifiers...
-    Module = 0x01,
-
-    // Module subtypes:
-    Function = 0x11,
-    ConstantPool,
-    SymbolTable,
-    ModuleGlobalInfo,
-    GlobalTypePlane,
-    DependentLibs,
-
-    // Function subtypes:
-    // Can also have ConstantPool block
-    // Can also have SymbolTable block
-    BasicBlock = 0x31,// May contain many basic blocks (obsolete since LLVM 1.1)
-
-    // InstructionList - The instructions in the body of a function.  This
-    // superceeds the old BasicBlock node used in LLVM 1.0.
-    InstructionList = 0x32,
-
-    // CompactionTable - blocks with this id are used to define local remapping
-    // tables for a function, allowing the indices used within the function to
-    // be as small as possible.  This often allows the instructions to be
-    // encoded more efficiently.
-    CompactionTable = 0x33
-  };
-
-  /// In LLVM 1.3 format, the identifier and the size of the block are
-  /// encoded into a single vbr_uint32 with 5 bits for the block identifier
-  /// and 27-bits for block length. This limits blocks to a maximum of
+  /// The the identifier and the size of the block are encoded into a single 
+  /// vbr_uint32 with 5 bits for the block identifier and 27-bits for block 
+  /// length. This limits blocks to a maximum of
   /// 128MBytes of data, and block types to 31 which should be sufficient
   /// for the foreseeable usage. Because the values of block identifiers MUST
   /// fit within 5 bits (values 1-31), this enumeration is used to ensure
   /// smaller values are used for 1.3 and subsequent bytecode versions.
   /// @brief The block number identifiers used in LLVM 1.3 bytecode
   /// format.
-  enum CompressedBytecodeBlockIdentifiers {
+  enum BytecodeBlockIdentifiers {
 
-    // Zero value ist verbotten!
-    Reserved_DoNotUse = 0x00,      ///< Don't use this!
-
-    // This is the uber block that contains the rest of the blocks.
-    ModuleBlockID = 0x01,          ///< 1.3 identifier for modules
-
-    // Module subtypes:
-
-    // This is the identifier for a function
-    FunctionBlockID = 0x02,        ///< 1.3 identifier for Functions
-    ConstantPoolBlockID = 0x03,    ///< 1.3 identifier for constant pool
-    SymbolTableBlockID = 0x04,     ///< 1.3 identifier for symbol table
-    ModuleGlobalInfoBlockID = 0x05,///< 1.3 identifier for module globals
-    GlobalTypePlaneBlockID = 0x06, ///< 1.3 identifier for global types
-
-    // Function subtypes:
-
-    // InstructionList - The instructions in the body of a function.  This
-    // superceeds the old BasicBlock node used in LLVM 1.0.
-    InstructionListBlockID = 0x07, ///< 1.3 identifier for insruction list
-
-    // CompactionTable - blocks with this id are used to define local remapping
-    // tables for a function, allowing the indices used within the function to
-    // be as small as possible.  This often allows the instructions to be
-    // encoded more efficiently.
-    CompactionTableBlockID = 0x08, ///< 1.3 identifier for compaction tables
+    Reserved_DoNotUse      = 0,  ///< Zero value is forbidden, do not use.
+    ModuleBlockID          = 1,  ///< Module block that contains other blocks.
+    FunctionBlockID        = 2,  ///< Function block identifier
+    ConstantPoolBlockID    = 3,  ///< Constant pool identifier
+    SymbolTableBlockID     = 4,  ///< Symbol table identifier
+    ModuleGlobalInfoBlockID= 5,  ///< Module global info identifier
+    GlobalTypePlaneBlockID = 6,  ///< Global type plan identifier
+    InstructionListBlockID = 7,  ///< All instructions in a function
+
+    /// Blocks with this id are used to define a function local remapping
+    /// table for the function's values. This allows the indices used within 
+    /// the function to be as small as possible.  This often allows the 
+    /// instructions to be encoded more efficiently because VBR takes fewer
+    /// bytes with smaller values.
+    /// @brief Value Compaction Table Block
+    CompactionTableBlockID = 0x08,
 
     // Not a block id, just used to count them
     NumberOfBlockIDs
   };
-
 };
 
 } // End llvm namespace






More information about the llvm-commits mailing list