[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitCodes.h BitstreamReader.h BitstreamWriter.h LLVMBitCodes.h

Chris Lattner sabre at nondot.org
Fri May 4 11:26:07 PDT 2007



Changes in directory llvm/include/llvm/Bitcode:

BitCodes.h updated: 1.3 -> 1.4
BitstreamReader.h updated: 1.12 -> 1.13
BitstreamWriter.h updated: 1.7 -> 1.8
LLVMBitCodes.h updated: 1.14 -> 1.15
---
Log message:

minor cleanups.  Add provisions for a new standard BLOCKINFO_BLOCK
block type.


---
Diffs of the changes:  (+41 -17)

 BitCodes.h        |   32 ++++++++++++++++++++++++++++----
 BitstreamReader.h |    2 +-
 BitstreamWriter.h |    6 +++---
 LLVMBitCodes.h    |   18 +++++++++---------
 4 files changed, 41 insertions(+), 17 deletions(-)


Index: llvm/include/llvm/Bitcode/BitCodes.h
diff -u llvm/include/llvm/Bitcode/BitCodes.h:1.3 llvm/include/llvm/Bitcode/BitCodes.h:1.4
--- llvm/include/llvm/Bitcode/BitCodes.h:1.3	Fri May  4 12:35:19 2007
+++ llvm/include/llvm/Bitcode/BitCodes.h	Fri May  4 13:25:49 2007
@@ -30,9 +30,9 @@
     BlockSizeWidth = 32  // BlockSize up to 2^32 32-bit words = 32GB per block.
   };
   
-  // The standard code namespace always has a way to exit a block, enter a
+  // The standard abbrev namespace always has a way to exit a block, enter a
   // nested block, define abbrevs, and define an unabbreviated record.
-  enum FixedCodes {
+  enum FixedAbbrevIDs {
     END_BLOCK = 0,  // Must be zero to guarantee termination for broken bitcode.
     ENTER_SUBBLOCK = 1,
 
@@ -48,8 +48,29 @@
     UNABBREV_RECORD = 3,
     
     // This is not a code, this is a marker for the first abbrev assignment.
-    FIRST_ABBREV = 4
+    FIRST_APPLICATION_ABBREV = 4
   };
+  
+  /// StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO
+  /// block, which contains metadata about other blocks in the file.
+  enum StandardBlockIDs {
+    /// BLOCKINFO_BLOCK is used to define metadata about blocks, for example,
+    /// standard abbrevs that should be available to all blocks of a specified
+    /// ID.
+    BLOCKINFO_BLOCK_ID = 0,
+    
+    // Block IDs 1-7 are reserved for future expansion.
+    FIRST_APPLICATION_BLOCKID = 8
+  };
+  
+  /// BlockInfoCodes - The blockinfo block contains metadata about user-defined
+  /// blocks.
+  enum BlockInfoCodes {
+    BLOCKINFO_CODE_SETBID = 1,  // SETBID: [blockid#]
+    BLOCKINFO_CODE_ABBREV = 2   // ABBREV: [standard abbrev encoding]
+    // BLOCKNAME: give string name to block, if desired.
+  };
+  
 } // End bitc namespace
 
 /// BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
@@ -63,7 +84,7 @@
   unsigned Enc   : 3;     // The encoding to use.
 public:
   enum Encoding {
-    FixedWidth = 1,   // A fixed with field, Val specifies number of bits.
+    FixedWidth = 1,  // A fixed with field, Val specifies number of bits.
     VBR        = 2   // A VBR field where Val specifies the width of each chunk.
   };
     
@@ -87,6 +108,9 @@
   }
 };
 
+/// BitCodeAbbrev - This class represents an abbreviation record.  An
+/// abbreviation allows a complex record that has redundancy to be stored in a
+/// specialized format instead of the fully-general, fully-vbr, format.
 class BitCodeAbbrev {
   SmallVector<BitCodeAbbrevOp, 8> OperandList;
   unsigned char RefCount; // Number of things using this.


Index: llvm/include/llvm/Bitcode/BitstreamReader.h
diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.12 llvm/include/llvm/Bitcode/BitstreamReader.h:1.13
--- llvm/include/llvm/Bitcode/BitstreamReader.h:1.12	Fri May  4 12:35:19 2007
+++ llvm/include/llvm/Bitcode/BitstreamReader.h	Fri May  4 13:25:49 2007
@@ -283,7 +283,7 @@
       return Code;
     }
     
-    unsigned AbbrevNo = AbbrevID-bitc::FIRST_ABBREV;
+    unsigned AbbrevNo = AbbrevID-bitc::FIRST_APPLICATION_ABBREV;
     assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!");
     BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo];
 


Index: llvm/include/llvm/Bitcode/BitstreamWriter.h
diff -u llvm/include/llvm/Bitcode/BitstreamWriter.h:1.7 llvm/include/llvm/Bitcode/BitstreamWriter.h:1.8
--- llvm/include/llvm/Bitcode/BitstreamWriter.h:1.7	Fri May  4 12:35:19 2007
+++ llvm/include/llvm/Bitcode/BitstreamWriter.h	Fri May  4 13:25:49 2007
@@ -194,7 +194,7 @@
   void EmitRecord(unsigned Code, SmallVectorImpl<uint64_t> &Vals,
                   unsigned Abbrev = 0) {
     if (Abbrev) {
-      unsigned AbbrevNo = Abbrev-bitc::FIRST_ABBREV;
+      unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
       assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!");
       BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo];
       
@@ -247,7 +247,7 @@
   void EmitRecord(unsigned Code, SmallVectorImpl<unsigned> &Vals,
                   unsigned Abbrev = 0) {
     if (Abbrev) {
-      unsigned AbbrevNo = Abbrev-bitc::FIRST_ABBREV;
+      unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
       assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!");
       BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo];
       
@@ -318,7 +318,7 @@
     }
     
     CurAbbrevs.push_back(Abbv);
-    return CurAbbrevs.size()-1+bitc::FIRST_ABBREV;
+    return CurAbbrevs.size()-1+bitc::FIRST_APPLICATION_ABBREV;
   }
 };
 


Index: llvm/include/llvm/Bitcode/LLVMBitCodes.h
diff -u llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.14 llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.15
--- llvm/include/llvm/Bitcode/LLVMBitCodes.h:1.14	Thu May  3 22:01:46 2007
+++ llvm/include/llvm/Bitcode/LLVMBitCodes.h	Fri May  4 13:25:49 2007
@@ -25,15 +25,15 @@
   // The only top-level block type defined is for a module.
   enum BlockIDs {
     // Blocks
-    MODULE_BLOCK_ID          = 0,
+    MODULE_BLOCK_ID          = FIRST_APPLICATION_BLOCKID,
   
-    // Module sub-block id's
-    PARAMATTR_BLOCK_ID       = 1,
-    TYPE_BLOCK_ID            = 2,
-    CONSTANTS_BLOCK_ID       = 3,
-    FUNCTION_BLOCK_ID        = 4,
-    TYPE_SYMTAB_BLOCK_ID     = 5,
-    VALUE_SYMTAB_BLOCK_ID    = 6
+    // Module sub-block id's.
+    PARAMATTR_BLOCK_ID,
+    TYPE_BLOCK_ID,
+    CONSTANTS_BLOCK_ID,
+    FUNCTION_BLOCK_ID,
+    TYPE_SYMTAB_BLOCK_ID,
+    VALUE_SYMTAB_BLOCK_ID
   };
   
   
@@ -68,7 +68,7 @@
   
   /// TYPE blocks have codes for each type primitive they use.
   enum TypeCodes {
-    TYPE_CODE_NUMENTRY =  1,   // TYPE_CODE_NUMENTRY: [numentries]
+    TYPE_CODE_NUMENTRY =  1,   // NUMENTRY: [numentries]
     
     // Type Codes
     TYPE_CODE_VOID     =  2,   // VOID






More information about the llvm-commits mailing list