[llvm-commits] [llvm] r65199 - in /llvm/trunk/include/llvm/Bitcode: Archive.h BitCodes.h BitstreamReader.h BitstreamWriter.h Deserialize.h LLVMBitCodes.h ReaderWriter.h Serialization.h SerializationFwd.h Serialize.h

Misha Brukman brukman+llvm at gmail.com
Fri Feb 20 15:04:06 PST 2009


Author: brukman
Date: Fri Feb 20 17:04:06 2009
New Revision: 65199

URL: http://llvm.org/viewvc/llvm-project?rev=65199&view=rev
Log:
Removed trailing whitespace.

Modified:
    llvm/trunk/include/llvm/Bitcode/Archive.h
    llvm/trunk/include/llvm/Bitcode/BitCodes.h
    llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
    llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
    llvm/trunk/include/llvm/Bitcode/Deserialize.h
    llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
    llvm/trunk/include/llvm/Bitcode/ReaderWriter.h
    llvm/trunk/include/llvm/Bitcode/Serialization.h
    llvm/trunk/include/llvm/Bitcode/SerializationFwd.h
    llvm/trunk/include/llvm/Bitcode/Serialize.h

Modified: llvm/trunk/include/llvm/Bitcode/Archive.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Archive.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Archive.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Archive.h Fri Feb 20 17:04:06 2009
@@ -204,7 +204,7 @@
 /// applications and the linkers. Consequently, the implementation of the class
 /// is optimized for reading.
 class Archive {
-  
+
   /// @name Types
   /// @{
   public:
@@ -485,7 +485,7 @@
     void writeSymbolTable(std::ofstream& ARFile);
 
     /// Writes one ArchiveMember to an ofstream. If an error occurs, returns
-    /// false, otherwise true. If an error occurs and error is non-null then 
+    /// false, otherwise true. If an error occurs and error is non-null then
     /// it will be set to an error message.
     /// @returns false Writing member succeeded
     /// @returns true Writing member failed, \p error set to error message

Modified: llvm/trunk/include/llvm/Bitcode/BitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitCodes.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitCodes.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitCodes.h Fri Feb 20 17:04:06 2009
@@ -29,7 +29,7 @@
     CodeLenWidth = 4,  // Codelen are VBR-4.
     BlockSizeWidth = 32  // BlockSize up to 2^32 32-bit words = 16GB per block.
   };
-  
+
   // The standard abbrev namespace always has a way to exit a block, enter a
   // nested block, define abbrevs, and define an unabbreviated record.
   enum FixedAbbrevIDs {
@@ -41,16 +41,16 @@
     /// single bit to indicate if it is a literal encoding.  If so, the value is
     /// emitted with a vbr8.  If not, the encoding is emitted as 3 bits followed
     /// by the info value as a vbr5 if needed.
-    DEFINE_ABBREV = 2, 
-    
+    DEFINE_ABBREV = 2,
+
     // UNABBREV_RECORDs are emitted with a vbr6 for the record code, followed by
     // a vbr6 for the # operands, followed by vbr6's for each operand.
     UNABBREV_RECORD = 3,
-    
+
     // This is not a code, this is a marker for the first abbrev assignment.
     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 {
@@ -58,11 +58,11 @@
     /// 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 {
@@ -71,7 +71,7 @@
     // block, instead of the BlockInfo block.
     // BLOCKNAME: give string name to block, if desired.
   };
-  
+
 } // End bitc namespace
 
 /// BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
@@ -90,24 +90,24 @@
     Array = 3,  // A sequence of fields, next field species elt encoding.
     Char6 = 4   // A 6-bit fixed field which maps to [a-zA-Z0-9._].
   };
-    
+
   explicit BitCodeAbbrevOp(uint64_t V) :  Val(V), IsLiteral(true) {}
   explicit BitCodeAbbrevOp(Encoding E, uint64_t Data = 0)
     : Val(Data), IsLiteral(false), Enc(E) {}
-  
+
   bool isLiteral() const { return IsLiteral; }
   bool isEncoding() const { return !IsLiteral; }
 
   // Accessors for literals.
   uint64_t getLiteralValue() const { assert(isLiteral()); return Val; }
-  
+
   // Accessors for encoding info.
   Encoding getEncoding() const { assert(isEncoding()); return (Encoding)Enc; }
   uint64_t getEncodingData() const {
     assert(isEncoding() && hasEncodingData());
     return Val;
   }
-  
+
   bool hasEncodingData() const { return hasEncodingData(getEncoding()); }
   static bool hasEncodingData(Encoding E) {
     switch (E) {
@@ -120,7 +120,7 @@
       return false;
     }
   }
-  
+
   /// isChar6 - Return true if this character is legal in the Char6 encoding.
   static bool isChar6(char C) {
     if (C >= 'a' && C <= 'z') return true;
@@ -138,7 +138,7 @@
     assert(0 && "Not a value Char6 character!");
     return 0;
   }
-  
+
   static char DecodeChar6(unsigned V) {
     assert((V & ~63) == 0 && "Not a Char6 encoded character!");
     if (V < 26) return V+'a';
@@ -149,7 +149,7 @@
     assert(0 && "Not a value Char6 character!");
     return ' ';
   }
-  
+
 };
 
 /// BitCodeAbbrev - This class represents an abbreviation record.  An
@@ -161,7 +161,7 @@
   ~BitCodeAbbrev() {}
 public:
   BitCodeAbbrev() : RefCount(1) {}
-  
+
   void addRef() { ++RefCount; }
   void dropRef() { if (--RefCount == 0) delete this; }
 
@@ -171,7 +171,7 @@
   const BitCodeAbbrevOp &getOperandInfo(unsigned N) const {
     return OperandList[N];
   }
-  
+
   void Add(const BitCodeAbbrevOp &OpInfo) {
     OperandList.push_back(OpInfo);
   }

Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Fri Feb 20 17:04:06 2009
@@ -19,35 +19,35 @@
 #include <vector>
 
 namespace llvm {
-  
+
   class Deserializer;
-  
+
 class BitstreamReader {
   const unsigned char *NextChar;
   const unsigned char *LastChar;
   friend class Deserializer;
-  
+
   /// CurWord - This is the current data we have pulled from the stream but have
   /// not returned to the client.
   uint32_t CurWord;
-  
+
   /// BitsInCurWord - This is the number of bits in CurWord that are valid. This
   /// is always from [0...31] inclusive.
   unsigned BitsInCurWord;
-  
+
   // CurCodeSize - This is the declared size of code values used for the current
   // block, in bits.
   unsigned CurCodeSize;
 
   /// CurAbbrevs - Abbrevs installed at in this block.
   std::vector<BitCodeAbbrev*> CurAbbrevs;
-  
+
   struct Block {
     unsigned PrevCodeSize;
     std::vector<BitCodeAbbrev*> PrevAbbrevs;
     explicit Block(unsigned PCS) : PrevCodeSize(PCS) {}
   };
-  
+
   /// BlockScope - This tracks the codesize of parent blocks.
   SmallVector<Block, 8> BlockScope;
 
@@ -58,7 +58,7 @@
     std::vector<BitCodeAbbrev*> Abbrevs;
   };
   std::vector<BlockInfo> BlockInfoRecords;
-  
+
   /// FirstChar - This remembers the first byte of the stream.
   const unsigned char *FirstChar;
 public:
@@ -72,7 +72,7 @@
   BitstreamReader(const unsigned char *Start, const unsigned char *End) {
     init(Start, End);
   }
-  
+
   void init(const unsigned char *Start, const unsigned char *End) {
     NextChar = FirstChar = Start;
     LastChar = End;
@@ -81,7 +81,7 @@
     BitsInCurWord = 0;
     CurCodeSize = 2;
   }
-  
+
   ~BitstreamReader() {
     // Abbrevs could still exist if the stream was broken.  If so, don't leak
     // them.
@@ -96,7 +96,7 @@
            i != e; ++i)
         Abbrevs[i]->dropRef();
     }
-    
+
     // Free the BlockInfoRecords.
     while (!BlockInfoRecords.empty()) {
       BlockInfo &Info = BlockInfoRecords.back();
@@ -107,37 +107,37 @@
       BlockInfoRecords.pop_back();
     }
   }
-  
+
   bool AtEndOfStream() const {
     return NextChar == LastChar && BitsInCurWord == 0;
   }
-  
+
   /// GetCurrentBitNo - Return the bit # of the bit we are reading.
   uint64_t GetCurrentBitNo() const {
     return (NextChar-FirstChar)*8 + ((32-BitsInCurWord) & 31);
   }
-  
+
   /// JumpToBit - Reset the stream to the specified bit number.
   void JumpToBit(uint64_t BitNo) {
     uintptr_t ByteNo = uintptr_t(BitNo/8) & ~3;
     uintptr_t WordBitNo = uintptr_t(BitNo) & 31;
     assert(ByteNo < (uintptr_t)(LastChar-FirstChar) && "Invalid location");
-    
+
     // Move the cursor to the right word.
     NextChar = FirstChar+ByteNo;
     BitsInCurWord = 0;
     CurWord = 0;
-    
+
     // Skip over any bits that are already consumed.
     if (WordBitNo) {
       NextChar -= 4;
       Read(static_cast<unsigned>(WordBitNo));
     }
   }
-  
+
   /// GetAbbrevIDWidth - Return the number of bits used to encode an abbrev #.
   unsigned GetAbbrevIDWidth() const { return CurCodeSize; }
-  
+
   uint32_t Read(unsigned NumBits) {
     // If the field is fully contained by CurWord, return it quickly.
     if (BitsInCurWord >= NumBits) {
@@ -153,20 +153,20 @@
       BitsInCurWord = 0;
       return 0;
     }
-    
+
     unsigned R = CurWord;
 
     // Read the next word from the stream.
     CurWord = (NextChar[0] <<  0) | (NextChar[1] << 8) |
               (NextChar[2] << 16) | (NextChar[3] << 24);
     NextChar += 4;
-    
+
     // Extract NumBits-BitsInCurWord from what we just read.
     unsigned BitsLeft = NumBits-BitsInCurWord;
-    
+
     // Be careful here, BitsLeft is in the range [1..32] inclusive.
     R |= (CurWord & (~0U >> (32-BitsLeft))) << BitsInCurWord;
-    
+
     // BitsLeft bits have just been used up from CurWord.
     if (BitsLeft != 32)
       CurWord >>= BitsLeft;
@@ -175,14 +175,14 @@
     BitsInCurWord = 32-BitsLeft;
     return R;
   }
-  
+
   uint64_t Read64(unsigned NumBits) {
     if (NumBits <= 32) return Read(NumBits);
-    
+
     uint64_t V = Read(32);
     return V | (uint64_t)Read(NumBits-32) << 32;
   }
-  
+
   uint32_t ReadVBR(unsigned NumBits) {
     uint32_t Piece = Read(NumBits);
     if ((Piece & (1U << (NumBits-1))) == 0)
@@ -195,25 +195,25 @@
 
       if ((Piece & (1U << (NumBits-1))) == 0)
         return Result;
-      
+
       NextBit += NumBits-1;
       Piece = Read(NumBits);
     }
   }
-  
+
   uint64_t ReadVBR64(unsigned NumBits) {
     uint64_t Piece = Read(NumBits);
     if ((Piece & (1U << (NumBits-1))) == 0)
       return Piece;
-    
+
     uint64_t Result = 0;
     unsigned NextBit = 0;
     while (1) {
       Result |= (Piece & ((1U << (NumBits-1))-1)) << NextBit;
-      
+
       if ((Piece & (1U << (NumBits-1))) == 0)
         return Result;
-      
+
       NextBit += NumBits-1;
       Piece = Read(NumBits);
     }
@@ -224,7 +224,7 @@
     CurWord = 0;
   }
 
-  
+
   unsigned ReadCode() {
     return Read(CurCodeSize);
   }
@@ -232,7 +232,7 @@
   //===--------------------------------------------------------------------===//
   // Block Manipulation
   //===--------------------------------------------------------------------===//
-  
+
 private:
   /// getBlockInfo - If there is block info for the specified ID, return it,
   /// otherwise return null.
@@ -240,7 +240,7 @@
     // Common case, the most recent entry matches BlockID.
     if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID)
       return &BlockInfoRecords.back();
-    
+
     for (unsigned i = 0, e = static_cast<unsigned>(BlockInfoRecords.size());
          i != e; ++i)
       if (BlockInfoRecords[i].BlockID == BlockID)
@@ -248,8 +248,8 @@
     return 0;
   }
 public:
-  
-  
+
+
   // Block header:
   //    [ENTER_SUBBLOCK, blockid, newcodelen, <align4bytes>, blocklen]
 
@@ -258,7 +258,7 @@
   unsigned ReadSubBlockID() {
     return ReadVBR(bitc::BlockIDWidth);
   }
-  
+
   /// SkipBlock - Having read the ENTER_SUBBLOCK abbrevid and a BlockID, skip
   /// over the body of this block.  If the block record is malformed, return
   /// true.
@@ -268,23 +268,23 @@
     ReadVBR(bitc::CodeLenWidth);
     SkipToWord();
     unsigned NumWords = Read(bitc::BlockSizeWidth);
-    
+
     // Check that the block wasn't partially defined, and that the offset isn't
     // bogus.
     if (AtEndOfStream() || NextChar+NumWords*4 > LastChar)
       return true;
-    
+
     NextChar += NumWords*4;
     return false;
   }
-  
+
   /// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, enter
   /// the block, and return true if the block is valid.
   bool EnterSubBlock(unsigned BlockID, unsigned *NumWordsP = 0) {
     // Save the current block's state on BlockScope.
     BlockScope.push_back(Block(CurCodeSize));
     BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
-    
+
     // Add the abbrevs specific to this block to the CurAbbrevs list.
     if (BlockInfo *Info = getBlockInfo(BlockID)) {
       for (unsigned i = 0, e = static_cast<unsigned>(Info->Abbrevs.size());
@@ -293,50 +293,50 @@
         CurAbbrevs.back()->addRef();
       }
     }
-    
+
     // Get the codesize of this block.
     CurCodeSize = ReadVBR(bitc::CodeLenWidth);
     SkipToWord();
     unsigned NumWords = Read(bitc::BlockSizeWidth);
     if (NumWordsP) *NumWordsP = NumWords;
-    
+
     // Validate that this block is sane.
     if (CurCodeSize == 0 || AtEndOfStream() || NextChar+NumWords*4 > LastChar)
       return true;
-    
+
     return false;
   }
-  
+
   bool ReadBlockEnd() {
     if (BlockScope.empty()) return true;
-    
+
     // Block tail:
     //    [END_BLOCK, <align4bytes>]
     SkipToWord();
-    
+
     PopBlockScope();
     return false;
   }
-  
+
 private:
   void PopBlockScope() {
     CurCodeSize = BlockScope.back().PrevCodeSize;
-    
+
     // Delete abbrevs from popped scope.
     for (unsigned i = 0, e = static_cast<unsigned>(CurAbbrevs.size());
          i != e; ++i)
       CurAbbrevs[i]->dropRef();
-    
+
     BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
     BlockScope.pop_back();
-  }  
-    
+  }
+
   //===--------------------------------------------------------------------===//
   // Record Processing
   //===--------------------------------------------------------------------===//
-  
+
 private:
-  void ReadAbbreviatedField(const BitCodeAbbrevOp &Op, 
+  void ReadAbbreviatedField(const BitCodeAbbrevOp &Op,
                             SmallVectorImpl<uint64_t> &Vals) {
     if (Op.isLiteral()) {
       // If the abbrev specifies the literal value to use, use it.
@@ -366,7 +366,7 @@
         Vals.push_back(ReadVBR64(6));
       return Code;
     }
-    
+
     unsigned AbbrevNo = AbbrevID-bitc::FIRST_APPLICATION_ABBREV;
     assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!");
     BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo];
@@ -388,16 +388,16 @@
           ReadAbbreviatedField(EltEnc, Vals);
       }
     }
-    
+
     unsigned Code = (unsigned)Vals[0];
     Vals.erase(Vals.begin());
     return Code;
   }
-  
+
   //===--------------------------------------------------------------------===//
   // Abbrev Processing
   //===--------------------------------------------------------------------===//
-  
+
   void ReadAbbrevRecord() {
     BitCodeAbbrev *Abbv = new BitCodeAbbrev();
     unsigned NumOpInfo = ReadVBR(5);
@@ -416,30 +416,30 @@
     }
     CurAbbrevs.push_back(Abbv);
   }
-  
+
   //===--------------------------------------------------------------------===//
   // BlockInfo Block Reading
   //===--------------------------------------------------------------------===//
-  
-private:  
+
+private:
   BlockInfo &getOrCreateBlockInfo(unsigned BlockID) {
     if (BlockInfo *BI = getBlockInfo(BlockID))
       return *BI;
-    
+
     // Otherwise, add a new record.
     BlockInfoRecords.push_back(BlockInfo());
     BlockInfoRecords.back().BlockID = BlockID;
     return BlockInfoRecords.back();
   }
-  
+
 public:
-    
+
   bool ReadBlockInfoBlock() {
     if (EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID)) return true;
 
     SmallVector<uint64_t, 64> Record;
     BlockInfo *CurBlockInfo = 0;
-    
+
     // Read all the records for this module.
     while (1) {
       unsigned Code = ReadCode();
@@ -455,7 +455,7 @@
       if (Code == bitc::DEFINE_ABBREV) {
         if (!CurBlockInfo) return true;
         ReadAbbrevRecord();
-        
+
         // ReadAbbrevRecord installs the abbrev in CurAbbrevs.  Move it to the
         // appropriate BlockInfo.
         BitCodeAbbrev *Abbv = CurAbbrevs.back();
@@ -473,7 +473,7 @@
         CurBlockInfo = &getOrCreateBlockInfo((unsigned)Record[0]);
         break;
       }
-    }      
+    }
   }
 };
 

Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Fri Feb 20 17:04:06 2009
@@ -25,10 +25,10 @@
 
   /// CurBit - Always between 0 and 31 inclusive, specifies the next bit to use.
   unsigned CurBit;
-  
+
   /// CurValue - The current value.  Only bits < CurBit are valid.
   uint32_t CurValue;
-  
+
   /// CurCodeSize - This is the declared size of code values used for the
   /// current block, in bits.
   unsigned CurCodeSize;
@@ -36,7 +36,7 @@
   /// BlockInfoCurBID - When emitting a BLOCKINFO_BLOCK, this is the currently
   /// selected BLOCK ID.
   unsigned BlockInfoCurBID;
-  
+
   /// CurAbbrevs - Abbrevs installed at in this block.
   std::vector<BitCodeAbbrev*> CurAbbrevs;
 
@@ -46,10 +46,10 @@
     std::vector<BitCodeAbbrev*> PrevAbbrevs;
     Block(unsigned PCS, unsigned SSW) : PrevCodeSize(PCS), StartSizeWord(SSW) {}
   };
-  
+
   /// BlockScope - This tracks the current blocks that we have entered.
   std::vector<Block> BlockScope;
-  
+
   /// BlockInfo - This contains information emitted to BLOCKINFO_BLOCK blocks.
   /// These describe abbreviations that all blocks of the specified ID inherit.
   struct BlockInfo {
@@ -57,15 +57,15 @@
     std::vector<BitCodeAbbrev*> Abbrevs;
   };
   std::vector<BlockInfo> BlockInfoRecords;
-  
+
 public:
-  explicit BitstreamWriter(std::vector<unsigned char> &O) 
+  explicit BitstreamWriter(std::vector<unsigned char> &O)
     : Out(O), CurBit(0), CurValue(0), CurCodeSize(2) {}
 
   ~BitstreamWriter() {
     assert(CurBit == 0 && "Unflused data remaining");
     assert(BlockScope.empty() && CurAbbrevs.empty() && "Block imbalance");
-    
+
     // Free the BlockInfoRecords.
     while (!BlockInfoRecords.empty()) {
       BlockInfo &Info = BlockInfoRecords.back();
@@ -82,7 +82,7 @@
   //===--------------------------------------------------------------------===//
   // Basic Primitives for emitting bits to the stream.
   //===--------------------------------------------------------------------===//
-  
+
   void Emit(uint32_t Val, unsigned NumBits) {
     assert(NumBits <= 32 && "Invalid value size!");
     assert((Val & ~(~0U >> (32-NumBits))) == 0 && "High bits set!");
@@ -91,21 +91,21 @@
       CurBit += NumBits;
       return;
     }
-    
+
     // Add the current word.
     unsigned V = CurValue;
     Out.push_back((unsigned char)(V >>  0));
     Out.push_back((unsigned char)(V >>  8));
     Out.push_back((unsigned char)(V >> 16));
     Out.push_back((unsigned char)(V >> 24));
-    
+
     if (CurBit)
       CurValue = Val >> (32-CurBit);
     else
       CurValue = 0;
     CurBit = (CurBit+NumBits) & 31;
   }
-  
+
   void Emit64(uint64_t Val, unsigned NumBits) {
     if (NumBits <= 32)
       Emit((uint32_t)Val, NumBits);
@@ -114,7 +114,7 @@
       Emit((uint32_t)(Val >> 32), NumBits-32);
     }
   }
-  
+
   void FlushToWord() {
     if (CurBit) {
       unsigned V = CurValue;
@@ -126,40 +126,40 @@
       CurValue = 0;
     }
   }
-  
+
   void EmitVBR(uint32_t Val, unsigned NumBits) {
     uint32_t Threshold = 1U << (NumBits-1);
-    
+
     // Emit the bits with VBR encoding, NumBits-1 bits at a time.
     while (Val >= Threshold) {
       Emit((Val & ((1 << (NumBits-1))-1)) | (1 << (NumBits-1)), NumBits);
       Val >>= NumBits-1;
     }
-    
+
     Emit(Val, NumBits);
   }
-  
+
   void EmitVBR64(uint64_t Val, unsigned NumBits) {
     if ((uint32_t)Val == Val)
       return EmitVBR((uint32_t)Val, NumBits);
-    
+
     uint64_t Threshold = 1U << (NumBits-1);
-    
+
     // Emit the bits with VBR encoding, NumBits-1 bits at a time.
     while (Val >= Threshold) {
       Emit(((uint32_t)Val & ((1 << (NumBits-1))-1)) |
            (1 << (NumBits-1)), NumBits);
       Val >>= NumBits-1;
     }
-    
+
     Emit((uint32_t)Val, NumBits);
   }
-  
+
   /// EmitCode - Emit the specified code.
   void EmitCode(unsigned Val) {
     Emit(Val, CurCodeSize);
   }
-  
+
   // BackpatchWord - Backpatch a 32-bit word in the output with the specified
   // value.
   void BackpatchWord(unsigned ByteNo, unsigned NewWord) {
@@ -168,25 +168,25 @@
     Out[ByteNo++] = (unsigned char)(NewWord >> 16);
     Out[ByteNo  ] = (unsigned char)(NewWord >> 24);
   }
-  
+
   //===--------------------------------------------------------------------===//
   // Block Manipulation
   //===--------------------------------------------------------------------===//
-  
+
   /// getBlockInfo - If there is block info for the specified ID, return it,
   /// otherwise return null.
   BlockInfo *getBlockInfo(unsigned BlockID) {
     // Common case, the most recent entry matches BlockID.
     if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID)
       return &BlockInfoRecords.back();
-    
+
     for (unsigned i = 0, e = static_cast<unsigned>(BlockInfoRecords.size());
          i != e; ++i)
       if (BlockInfoRecords[i].BlockID == BlockID)
         return &BlockInfoRecords[i];
     return 0;
   }
-  
+
   void EnterSubblock(unsigned BlockID, unsigned CodeLen) {
     // Block header:
     //    [ENTER_SUBBLOCK, blockid, newcodelen, <align4bytes>, blocklen]
@@ -194,15 +194,15 @@
     EmitVBR(BlockID, bitc::BlockIDWidth);
     EmitVBR(CodeLen, bitc::CodeLenWidth);
     FlushToWord();
-    
+
     unsigned BlockSizeWordLoc = static_cast<unsigned>(Out.size());
     unsigned OldCodeSize = CurCodeSize;
-    
+
     // Emit a placeholder, which will be replaced when the block is popped.
     Emit(0, bitc::BlockSizeWidth);
-    
+
     CurCodeSize = CodeLen;
-    
+
     // Push the outer block's abbrev set onto the stack, start out with an
     // empty abbrev set.
     BlockScope.push_back(Block(OldCodeSize, BlockSizeWordLoc/4));
@@ -218,17 +218,17 @@
       }
     }
   }
-  
+
   void ExitBlock() {
     assert(!BlockScope.empty() && "Block scope imbalance!");
-    
+
     // Delete all abbrevs.
     for (unsigned i = 0, e = static_cast<unsigned>(CurAbbrevs.size());
          i != e; ++i)
       CurAbbrevs[i]->dropRef();
-    
+
     const Block &B = BlockScope.back();
-    
+
     // Block tail:
     //    [END_BLOCK, <align4bytes>]
     EmitCode(bitc::END_BLOCK);
@@ -237,20 +237,20 @@
     // Compute the size of the block, in words, not counting the size field.
     unsigned SizeInWords= static_cast<unsigned>(Out.size())/4-B.StartSizeWord-1;
     unsigned ByteNo = B.StartSizeWord*4;
-    
+
     // Update the block size field in the header of this sub-block.
     BackpatchWord(ByteNo, SizeInWords);
-    
+
     // Restore the inner block's code size and abbrev table.
     CurCodeSize = B.PrevCodeSize;
     BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
     BlockScope.pop_back();
   }
-  
+
   //===--------------------------------------------------------------------===//
   // Record Emission
   //===--------------------------------------------------------------------===//
-  
+
 private:
   /// EmitAbbreviatedField - Emit a single scalar field value with the specified
   /// encoding.
@@ -263,7 +263,7 @@
              "Invalid abbrev for record!");
       return;
     }
-    
+
     // Encode the value as we are commanded.
     switch (Op.getEncoding()) {
     default: assert(0 && "Unknown encoding!");
@@ -276,10 +276,10 @@
     case BitCodeAbbrevOp::Char6:
       Emit(BitCodeAbbrevOp::EncodeChar6((char)V), 6);
       break;
-    }        
+    }
   }
 public:
-    
+
   /// EmitRecord - Emit the specified record to the stream, using an abbrev if
   /// we have one to compress the output.
   template<typename uintty>
@@ -289,12 +289,12 @@
       unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
       assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!");
       BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo];
-      
+
       EmitCode(Abbrev);
-      
+
       // Insert the code into Vals to treat it uniformly.
       Vals.insert(Vals.begin(), Code);
-      
+
       unsigned RecordIdx = 0;
       for (unsigned i = 0, e = static_cast<unsigned>(Abbv->getNumOperandInfos());
            i != e; ++i) {
@@ -307,10 +307,10 @@
           // Array case.
           assert(i+2 == e && "array op not second to last?");
           const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i);
-          
+
           // Emit a vbr6 to indicate the number of elements present.
           EmitVBR(static_cast<uint32_t>(Vals.size()-RecordIdx), 6);
-          
+
           // Emit each field.
           for (; RecordIdx != Vals.size(); ++RecordIdx)
             EmitAbbreviatedField(EltEnc, Vals[RecordIdx]);
@@ -331,7 +331,7 @@
   //===--------------------------------------------------------------------===//
   // Abbrev Emission
   //===--------------------------------------------------------------------===//
-  
+
 private:
   // Emit the abbreviation as a DEFINE_ABBREV record.
   void EncodeAbbrev(BitCodeAbbrev *Abbv) {
@@ -351,7 +351,7 @@
     }
   }
 public:
-    
+
   /// EmitAbbrev - This emits an abbreviation to the stream.  Note that this
   /// method takes ownership of the specified abbrev.
   unsigned EmitAbbrev(BitCodeAbbrev *Abbv) {
@@ -361,17 +361,17 @@
     return static_cast<unsigned>(CurAbbrevs.size())-1 +
       bitc::FIRST_APPLICATION_ABBREV;
   }
-  
+
   //===--------------------------------------------------------------------===//
   // BlockInfo Block Emission
   //===--------------------------------------------------------------------===//
-  
+
   /// EnterBlockInfoBlock - Start emitting the BLOCKINFO_BLOCK.
   void EnterBlockInfoBlock(unsigned CodeWidth) {
     EnterSubblock(bitc::BLOCKINFO_BLOCK_ID, CodeWidth);
     BlockInfoCurBID = -1U;
   }
-private:  
+private:
   /// SwitchToBlockID - If we aren't already talking about the specified block
   /// ID, emit a BLOCKINFO_CODE_SETBID record.
   void SwitchToBlockID(unsigned BlockID) {
@@ -385,25 +385,25 @@
   BlockInfo &getOrCreateBlockInfo(unsigned BlockID) {
     if (BlockInfo *BI = getBlockInfo(BlockID))
       return *BI;
-    
+
     // Otherwise, add a new record.
     BlockInfoRecords.push_back(BlockInfo());
     BlockInfoRecords.back().BlockID = BlockID;
     return BlockInfoRecords.back();
   }
-  
+
 public:
-  
+
   /// EmitBlockInfoAbbrev - Emit a DEFINE_ABBREV record for the specified
   /// BlockID.
   unsigned EmitBlockInfoAbbrev(unsigned BlockID, BitCodeAbbrev *Abbv) {
     SwitchToBlockID(BlockID);
     EncodeAbbrev(Abbv);
-    
+
     // Add the abbrev to the specified block record.
     BlockInfo &Info = getOrCreateBlockInfo(BlockID);
     Info.Abbrevs.push_back(Abbv);
-    
+
     return Info.Abbrevs.size()-1+bitc::FIRST_APPLICATION_ABBREV;
   }
 };

Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Fri Feb 20 17:04:06 2009
@@ -24,44 +24,44 @@
 #include <vector>
 
 namespace llvm {
-  
-class Deserializer {  
+
+class Deserializer {
 
   //===----------------------------------------------------------===//
   // Internal type definitions.
   //===----------------------------------------------------------===//
-  
+
   struct BPNode {
     BPNode* Next;
     uintptr_t& PtrRef;
-    
-    BPNode(BPNode* n, uintptr_t& pref) 
+
+    BPNode(BPNode* n, uintptr_t& pref)
       : Next(n), PtrRef(pref) {
         PtrRef = 0;
       }
   };
-  
-  struct BPEntry { 
+
+  struct BPEntry {
     union { BPNode* Head; void* Ptr; };
-    
+
     BPEntry() : Head(NULL) {}
-    
+
     static inline bool isPod() { return true; }
-    
-    void SetPtr(BPNode*& FreeList, void* P);    
-  };  
-  
+
+    void SetPtr(BPNode*& FreeList, void* P);
+  };
+
   class BPKey {
     unsigned Raw;
-    
+
   public:
     BPKey(SerializedPtrID PtrId) : Raw(PtrId << 1) { assert (PtrId > 0); }
     BPKey(unsigned code, unsigned) : Raw(code) {}
-    
+
     void MarkFinal() { Raw |= 0x1; }
     bool hasFinalPtr() const { return Raw & 0x1 ? true : false; }
     SerializedPtrID getID() const { return Raw >> 1; }
-    
+
     static inline BPKey getEmptyKey() { return BPKey(0,0); }
     static inline BPKey getTombstoneKey() { return BPKey(1,0); }
     static inline unsigned getHashValue(const BPKey& K) { return K.Raw & ~0x1; }
@@ -69,25 +69,25 @@
     static bool isEqual(const BPKey& K1, const BPKey& K2) {
       return (K1.Raw ^ K2.Raw) & ~0x1 ? false : true;
     }
-    
+
     static bool isPod() { return true; }
   };
-  
+
   typedef llvm::DenseMap<BPKey,BPEntry,BPKey,BPEntry> MapTy;
 
   //===----------------------------------------------------------===//
   // Publicly visible types.
   //===----------------------------------------------------------===//
-  
-public:  
+
+public:
   struct Location {
     uint64_t BitNo;
     unsigned BlockID;
     unsigned NumWords;
-    
-    Location(uint64_t bit, unsigned bid, unsigned words) 
+
+    Location(uint64_t bit, unsigned bid, unsigned words)
     : BitNo(bit), BlockID(bid), NumWords(words) {}
-    
+
     Location() : BitNo(0), BlockID(0), NumWords(0) {}
 
     Location& operator=(Location& RHS) {
@@ -96,21 +96,21 @@
       NumWords = RHS.NumWords;
       return *this;
     }
-    
-    bool operator==(const Location& RHS) const { return BitNo == RHS.BitNo; }    
+
+    bool operator==(const Location& RHS) const { return BitNo == RHS.BitNo; }
     bool operator!=(const Location& RHS) const { return BitNo != RHS.BitNo; }
-    
+
     bool contains(const Location& RHS) const {
       if (RHS.BitNo < BitNo)
         return false;
 
       if ((RHS.BitNo - BitNo) >> 5 < NumWords)
         return true;
-      
+
       return false;
     }
   };
-  
+
   //===----------------------------------------------------------===//
   // Internal data members.
   //===----------------------------------------------------------===//
@@ -126,20 +126,20 @@
   unsigned AbbrevNo;
   unsigned RecordCode;
   uint64_t StreamStart;
-  
+
   //===----------------------------------------------------------===//
   // Public Interface.
   //===----------------------------------------------------------===//
-  
-public:  
+
+public:
   Deserializer(BitstreamReader& stream);
   ~Deserializer();
 
   uint64_t ReadInt();
   int64_t ReadSInt();
   SerializedPtrID ReadPtrID() { return (SerializedPtrID) ReadInt(); }
-  
-  
+
+
   bool ReadBool() {
     return ReadInt() ? true : false;
   }
@@ -154,22 +154,22 @@
   inline T* Create() {
     return SerializeTrait<T>::Create(*this);
   }
-  
+
   char* ReadCStr(char* cstr = NULL, unsigned MaxLen=0, bool isNullTerm=true);
   void ReadCStr(std::vector<char>& buff, bool isNullTerm=false, unsigned Idx=0);
 
   template <typename T>
   inline T* ReadOwnedPtr(bool AutoRegister = true) {
-    SerializedPtrID PtrID = ReadPtrID();    
+    SerializedPtrID PtrID = ReadPtrID();
 
     if (!PtrID)
       return NULL;
-    
+
     T* x = SerializeTrait<T>::Create(*this);
 
     if (AutoRegister)
       RegisterPtr(PtrID,x);
-    
+
     return x;
   }
 
@@ -192,7 +192,7 @@
   inline void ReadOwnedPtr(T*& Ptr, bool AutoRegister = true) {
     Ptr = ReadOwnedPtr<T>(AutoRegister);
   }
-  
+
   template <typename T1, typename T2>
   void BatchReadOwnedPtrs(T1*& P1, T2*& P2,
                           bool A1=true, bool A2=true) {
@@ -224,17 +224,17 @@
   template <typename T1, typename T2, typename T3>
   void BatchReadOwnedPtrs(T1*& P1, T2*& P2, T3*& P3,
                           bool A1=true, bool A2=true, bool A3=true) {
-    
+
     SerializedPtrID ID1 = ReadPtrID();
     SerializedPtrID ID2 = ReadPtrID();
     SerializedPtrID ID3 = ReadPtrID();
-    
+
     P1 = (ID1) ? SerializeTrait<T1>::Create(*this) : NULL;
-    if (ID1 && A1) RegisterPtr(ID1,P1);    
-    
+    if (ID1 && A1) RegisterPtr(ID1,P1);
+
     P2 = (ID2) ? SerializeTrait<T2>::Create(*this) : NULL;
     if (ID2 && A2) RegisterPtr(ID2,P2);
-    
+
     P3 = (ID3) ? SerializeTrait<T3>::Create(*this) : NULL;
     if (ID3 && A3) RegisterPtr(ID3,P3);
   }
@@ -260,22 +260,22 @@
   template <typename T>
   void BatchReadOwnedPtrs(unsigned NumPtrs, T** Ptrs, bool AutoRegister=true) {
     llvm::SmallVector<SerializedPtrID,10> BatchIDVec;
-    
+
     for (unsigned i = 0; i < NumPtrs; ++i)
       BatchIDVec.push_back(ReadPtrID());
-    
+
     for (unsigned i = 0; i < NumPtrs; ++i) {
       SerializedPtrID& PtrID = BatchIDVec[i];
-      
+
       T* p = PtrID ? SerializeTrait<T>::Create(*this) : NULL;
-      
+
       if (PtrID && AutoRegister)
         RegisterPtr(PtrID,p);
-      
+
       Ptrs[i] = p;
     }
   }
-  
+
   template <typename T, typename Arg1>
   void BatchReadOwnedPtrs(unsigned NumPtrs, T** Ptrs, Arg1& arg1,
                           bool AutoRegister=true) {
@@ -300,29 +300,29 @@
   template <typename T1, typename T2>
   void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs, T2*& P2,
                           bool A1=true, bool A2=true) {
-    
+
     llvm::SmallVector<SerializedPtrID,10> BatchIDVec;
 
     for (unsigned i = 0; i < NumT1Ptrs; ++i)
       BatchIDVec.push_back(ReadPtrID());
-    
+
     SerializedPtrID ID2 = ReadPtrID();
-    
+
     for (unsigned i = 0; i < NumT1Ptrs; ++i) {
       SerializedPtrID& PtrID = BatchIDVec[i];
-      
+
       T1* p = PtrID ? SerializeTrait<T1>::Create(*this) : NULL;
-      
+
       if (PtrID && A1)
         RegisterPtr(PtrID,p);
-      
+
       Ptrs[i] = p;
     }
-    
+
     P2 = (ID2) ? SerializeTrait<T2>::Create(*this) : NULL;
-    if (ID2 && A2) RegisterPtr(ID2,P2);    
-  }    
-  
+    if (ID2 && A2) RegisterPtr(ID2,P2);
+  }
+
   template <typename T1, typename T2, typename Arg1>
   void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs, T2*& P2, Arg1& arg1,
                           bool A1=true, bool A2=true) {
@@ -350,35 +350,35 @@
   }
 
   template <typename T1, typename T2, typename T3>
-  void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs, 
+  void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs,
                           T2*& P2, T3*& P3,
                           bool A1=true, bool A2=true, bool A3=true) {
-    
+
     llvm::SmallVector<SerializedPtrID,10> BatchIDVec;
-    
+
     for (unsigned i = 0; i < NumT1Ptrs; ++i)
       BatchIDVec.push_back(ReadPtrID());
-    
+
     SerializedPtrID ID2 = ReadPtrID();
-    SerializedPtrID ID3 = ReadPtrID();    
-    
+    SerializedPtrID ID3 = ReadPtrID();
+
     for (unsigned i = 0; i < NumT1Ptrs; ++i) {
       SerializedPtrID& PtrID = BatchIDVec[i];
-      
+
       T1* p = PtrID ? SerializeTrait<T1>::Create(*this) : NULL;
-      
+
       if (PtrID && A1)
         RegisterPtr(PtrID,p);
-      
+
       Ptrs[i] = p;
     }
-    
+
     P2 = (ID2) ? SerializeTrait<T2>::Create(*this) : NULL;
     if (ID2 && A2) RegisterPtr(ID2,P2);
-    
+
     P3 = (ID3) ? SerializeTrait<T3>::Create(*this) : NULL;
-    if (ID3 && A3) RegisterPtr(ID3,P3);    
-  }    
+    if (ID3 && A3) RegisterPtr(ID3,P3);
+  }
 
   template <typename T1, typename T2, typename T3, typename Arg1>
   void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs,
@@ -415,36 +415,36 @@
   void ReadPtr(T*& PtrRef, bool AllowBackpatch = true) {
     ReadUIntPtr(reinterpret_cast<uintptr_t&>(PtrRef), AllowBackpatch);
   }
-  
+
   template <typename T>
   void ReadPtr(const T*& PtrRef, bool AllowBackpatch = true) {
     ReadPtr(const_cast<T*&>(PtrRef), AllowBackpatch);
   }
-  
-  
+
+
   template <typename T>
-  void ReadPtr(T*& PtrRef, const SerializedPtrID& PtrID, 
+  void ReadPtr(T*& PtrRef, const SerializedPtrID& PtrID,
                bool AllowBackpatch = true) {
     ReadUIntPtr(reinterpret_cast<uintptr_t&>(PtrRef), PtrID, AllowBackpatch);
   }
-  
+
   template <typename T>
-  void ReadPtr(const T*& PtrRef, const SerializedPtrID& PtrID, 
+  void ReadPtr(const T*& PtrRef, const SerializedPtrID& PtrID,
                bool AllowBackpatch = true) {
-    
+
     ReadPtr(const_cast<T*&>(PtrRef), PtrID, AllowBackpatch);
   }
-  
+
   template <typename T>
   T* ReadPtr() { T* x = 0; ReadPtr<T>(x,false); return x; }
 
-  void ReadUIntPtr(uintptr_t& PtrRef, const SerializedPtrID& PtrID, 
+  void ReadUIntPtr(uintptr_t& PtrRef, const SerializedPtrID& PtrID,
                    bool AllowBackpatch = true);
-  
+
   void ReadUIntPtr(uintptr_t& PtrRef, bool AllowBackpatch = true) {
     ReadUIntPtr(PtrRef,ReadPtrID(),AllowBackpatch);
   }
-  
+
   template <typename T>
   T& ReadRef() {
     T* p = reinterpret_cast<T*>(ReadInternalRefPtr());
@@ -452,66 +452,66 @@
   }
 
   void RegisterPtr(const SerializedPtrID& PtrID, const void* Ptr);
-  
+
   void RegisterPtr(const void* Ptr) {
     RegisterPtr(ReadPtrID(),Ptr);
   }
-  
+
   template<typename T>
   void RegisterRef(const T& x) {
     RegisterPtr(&x);
   }
-  
+
   template<typename T>
   void RegisterRef(const SerializedPtrID& PtrID, const T& x) {
     RegisterPtr(PtrID,&x);
-  }  
-  
+  }
+
   Location getCurrentBlockLocation();
   unsigned getCurrentBlockID();
   unsigned getAbbrevNo();
-  
+
   bool FinishedBlock(Location BlockLoc);
   bool JumpTo(const Location& BlockLoc);
   void Rewind();
-  
+
   bool AtEnd();
   bool inRecord();
   void SkipBlock();
   bool SkipToBlock(unsigned BlockID);
-  
+
   unsigned getRecordCode();
-  
+
   BitstreamReader& getStream() { return Stream; }
-  
+
 private:
-  bool AdvanceStream();  
+  bool AdvanceStream();
   void ReadRecord();
-  
+
   uintptr_t ReadInternalRefPtr();
-  
+
   static inline bool HasFinalPtr(MapTy::value_type& V) {
     return V.first.hasFinalPtr();
   }
-  
+
   static inline uintptr_t GetFinalPtr(MapTy::value_type& V) {
     return reinterpret_cast<uintptr_t>(V.second.Ptr);
   }
-  
+
   static inline BPNode* GetBPNode(MapTy::value_type& V) {
     return V.second.Head;
   }
-    
+
   static inline void SetBPNode(MapTy::value_type& V, BPNode* N) {
     V.second.Head = N;
   }
-  
+
   void SetPtr(MapTy::value_type& V, const void* P) {
     V.first.MarkFinal();
     V.second.SetPtr(FreeList,const_cast<void*>(P));
   }
 };
-    
+
 } // end namespace llvm
 
 #endif

Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
+++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Fri Feb 20 17:04:06 2009
@@ -26,7 +26,7 @@
   enum BlockIDs {
     // Blocks
     MODULE_BLOCK_ID          = FIRST_APPLICATION_BLOCKID,
-  
+
     // Module sub-block id's.
     PARAMATTR_BLOCK_ID,
     TYPE_BLOCK_ID,
@@ -35,8 +35,8 @@
     TYPE_SYMTAB_BLOCK_ID,
     VALUE_SYMTAB_BLOCK_ID
   };
-  
-  
+
+
   /// MODULE blocks have a number of optional fields and subblocks.
   enum ModuleCodes {
     MODULE_CODE_VERSION     = 1,    // VERSION:     [version#]
@@ -46,32 +46,32 @@
     MODULE_CODE_SECTIONNAME = 5,    // SECTIONNAME: [strchr x N]
     MODULE_CODE_DEPLIB      = 6,    // DEPLIB:      [strchr x N]
 
-    // GLOBALVAR: [pointer type, isconst, initid, 
+    // GLOBALVAR: [pointer type, isconst, initid,
     //             linkage, alignment, section, visibility, threadlocal]
     MODULE_CODE_GLOBALVAR   = 7,
 
     // FUNCTION:  [type, callingconv, isproto, linkage, paramattrs, alignment,
     //             section, visibility]
     MODULE_CODE_FUNCTION    = 8,
-    
+
     // ALIAS: [alias type, aliasee val#, linkage]
     MODULE_CODE_ALIAS       = 9,
-    
+
     /// MODULE_CODE_PURGEVALS: [numvals]
     MODULE_CODE_PURGEVALS   = 10,
-    
+
     MODULE_CODE_GCNAME      = 11   // GCNAME: [strchr x N]
   };
-  
+
   /// PARAMATTR blocks have code for defining a parameter attribute set.
   enum AttributeCodes {
     PARAMATTR_CODE_ENTRY = 1   // ENTRY: [paramidx0, attr0, paramidx1, attr1...]
   };
-  
+
   /// TYPE blocks have codes for each type primitive they use.
   enum TypeCodes {
     TYPE_CODE_NUMENTRY =  1,   // NUMENTRY: [numentries]
-    
+
     // Type Codes
     TYPE_CODE_VOID     =  2,   // VOID
     TYPE_CODE_FLOAT    =  3,   // FLOAT
@@ -93,18 +93,18 @@
     TYPE_CODE_PPC_FP128= 15    // PPC LONG DOUBLE (2 doubles)
     // Any other type code is assumed to be an unknown type.
   };
-  
+
   // The type symbol table only has one code (TST_ENTRY_CODE).
   enum TypeSymtabCodes {
     TST_CODE_ENTRY = 1     // TST_ENTRY: [typeid, namechar x N]
   };
-  
+
   // The value symbol table only has one code (VST_ENTRY_CODE).
   enum ValueSymtabCodes {
     VST_CODE_ENTRY   = 1,  // VST_ENTRY: [valid, namechar x N]
     VST_CODE_BBENTRY = 2   // VST_BBENTRY: [bbid, namechar x N]
   };
-  
+
   // The constants block (CONSTANTS_BLOCK_ID) describes emission for each
   // constant and maintains an implicit current type value.
   enum ConstantsCodes {
@@ -128,7 +128,7 @@
     CST_CODE_INLINEASM     = 18,  // INLINEASM:     [sideeffect,asmstr,conststr]
     CST_CODE_CE_SHUFVEC_EX = 19   // SHUFVEC_EX:    [opty, opval, opval, opval]
   };
-  
+
   /// CastOpcodes - These are values used in the bitcode files to encode which
   /// cast a CST_CODE_CE_CAST or a XXX refers to.  The values of these enums
   /// have no fixed relation to the LLVM IR enum values.  Changing these will
@@ -147,7 +147,7 @@
     CAST_INTTOPTR = 10,
     CAST_BITCAST  = 11
   };
-  
+
   /// BinaryOpcodes - These are values used in the bitcode files to encode which
   /// binop a CST_CODE_CE_BINOP or a XXX refers to.  The values of these enums
   /// have no fixed relation to the LLVM IR enum values.  Changing these will
@@ -167,13 +167,13 @@
     BINOP_OR   = 11,
     BINOP_XOR  = 12
   };
-  
-  
+
+
   // The function body block (FUNCTION_BLOCK_ID) describes function bodies.  It
   // can contain a constant block (CONSTANTS_BLOCK_ID).
   enum FunctionCodes {
     FUNC_CODE_DECLAREBLOCKS    =  1, // DECLAREBLOCKS: [n]
-    
+
     FUNC_CODE_INST_BINOP       =  2, // BINOP:      [opcode, ty, opval, opval]
     FUNC_CODE_INST_CAST        =  3, // CAST:       [opcode, ty, opty, opval]
     FUNC_CODE_INST_GEP         =  4, // GEP:        [n x operands]
@@ -182,14 +182,14 @@
     FUNC_CODE_INST_INSERTELT   =  7, // INSERTELT:  [ty, opval, opval, opval]
     FUNC_CODE_INST_SHUFFLEVEC  =  8, // SHUFFLEVEC: [ty, opval, opval, opval]
     FUNC_CODE_INST_CMP         =  9, // CMP:        [opty, opval, opval, pred]
-    
+
     FUNC_CODE_INST_RET         = 10, // RET:        [opty,opval<both optional>]
     FUNC_CODE_INST_BR          = 11, // BR:         [bb#, bb#, cond] or [bb#]
     FUNC_CODE_INST_SWITCH      = 12, // SWITCH:     [opty, opval, n, n x ops]
     FUNC_CODE_INST_INVOKE      = 13, // INVOKE:     [attr, fnty, op0,op1, ...]
     FUNC_CODE_INST_UNWIND      = 14, // UNWIND
     FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE
-    
+
     FUNC_CODE_INST_PHI         = 16, // PHI:        [ty, val0,bb0, ...]
     FUNC_CODE_INST_MALLOC      = 17, // MALLOC:     [instty, op, align]
     FUNC_CODE_INST_FREE        = 18, // FREE:       [opty, op]

Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original)
+++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Fri Feb 20 17:04:06 2009
@@ -24,7 +24,7 @@
   class ModulePass;
   class BitstreamWriter;
   class raw_ostream;
-  
+
   /// getBitcodeModuleProvider - Read the header of the specified bitcode buffer
   /// and prepare for lazy deserialization of function bodies.  If successful,
   /// this takes ownership of 'buffer' and returns a non-null pointer.  On
@@ -37,11 +37,11 @@
   /// If an error occurs, this returns null and fills in *ErrMsg if it is
   /// non-null.  This method *never* takes ownership of Buffer.
   Module *ParseBitcodeFile(MemoryBuffer *Buffer, std::string *ErrMsg = 0);
-  
+
   /// WriteBitcodeToFile - Write the specified module to the specified output
   /// stream.
   void WriteBitcodeToFile(const Module *M, std::ostream &Out);
-  
+
   /// WriteBitcodeToFile - Write the specified module to the specified
   /// raw output stream.
   void WriteBitcodeToFile(const Module *M, raw_ostream &Out);

Modified: llvm/trunk/include/llvm/Bitcode/Serialization.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialization.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Serialization.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialization.h Fri Feb 20 17:04:06 2009
@@ -18,7 +18,7 @@
 #include "llvm/Bitcode/SerializationFwd.h"
 
 namespace llvm {
-  
+
 /// SerializeTrait - SerializeTrait bridges between the Serializer/Deserializer
 ///  and the functions that serialize objects of specific types.  The default
 ///  behavior is to call static methods of the class for the object being
@@ -38,7 +38,7 @@
   static inline void Emit(Serializer& S, const T& X) { X.Emit(S); }
   static inline void Read(Deserializer& D, T& X) { X.Read(D); }
   static inline T* Create(Deserializer& D) { return T::Create(D); }
-  
+
   template <typename Arg1>
   static inline T* Create(Deserializer& D, Arg1& arg1) {
     return T::Create(D, arg1);
@@ -55,14 +55,14 @@
 SERIALIZE_INT_TRAIT(unsigned short)
 SERIALIZE_INT_TRAIT(unsigned int)
 SERIALIZE_INT_TRAIT(unsigned long)
-  
+
 SERIALIZE_INT_TRAIT(signed char)
 SERIALIZE_INT_TRAIT(signed short)
 SERIALIZE_INT_TRAIT(signed int)
 SERIALIZE_INT_TRAIT(signed long)
 
 #undef SERIALIZE_INT_TRAIT
-  
+
 } // end namespace llvm
 
 #endif

Modified: llvm/trunk/include/llvm/Bitcode/SerializationFwd.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/SerializationFwd.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/SerializationFwd.h (original)
+++ llvm/trunk/include/llvm/Bitcode/SerializationFwd.h Fri Feb 20 17:04:06 2009
@@ -17,8 +17,8 @@
 namespace llvm {
 
 class Serializer;
-class Deserializer;  
-template <typename T> struct SerializeTrait;  
+class Deserializer;
+template <typename T> struct SerializeTrait;
 
 typedef unsigned SerializedPtrID;
 

Modified: llvm/trunk/include/llvm/Bitcode/Serialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialize.h?rev=65199&r1=65198&r2=65199&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Serialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialize.h Fri Feb 20 17:04:06 2009
@@ -26,10 +26,10 @@
   BitstreamWriter& Stream;
   SmallVector<uint64_t,10> Record;
   unsigned BlockLevel;
-  
+
   typedef DenseMap<const void*,unsigned> MapTy;
   MapTy PtrMap;
-  
+
 public:
   explicit Serializer(BitstreamWriter& stream);
   ~Serializer();
@@ -37,26 +37,26 @@
   //==------------------------------------------------==//
   // Template-based dispatch to emit arbitrary types.
   //==------------------------------------------------==//
-  
-  template <typename T> 
+
+  template <typename T>
   inline void Emit(const T& X) { SerializeTrait<T>::Emit(*this,X); }
-  
+
   //==------------------------------------------------==//
   // Methods to emit primitive types.
-  //==------------------------------------------------==//  
-  
+  //==------------------------------------------------==//
+
   void EmitInt(uint64_t X);
   void EmitSInt(int64_t X);
-  
+
   inline void EmitBool(bool X) { EmitInt(X); }
   void EmitCStr(const char* beg, const char* end);
   void EmitCStr(const char* cstr);
-  
+
   void EmitPtr(const void* ptr) { EmitInt(getPtrId(ptr)); }
-  
+
   template <typename T>
   inline void EmitRef(const T& ref) { EmitPtr(&ref); }
-  
+
   // Emit a pointer and the object pointed to.  (This has no relation to the
   // OwningPtr<> class.)
   template <typename T>
@@ -64,18 +64,18 @@
     EmitPtr(ptr);
     if (ptr) SerializeTrait<T>::Emit(*this,*ptr);
   }
-  
-  
+
+
   //==------------------------------------------------==//
   // Batch emission of pointers.
   //==------------------------------------------------==//
-    
+
   template <typename T1, typename T2>
   void BatchEmitOwnedPtrs(T1* p1, T2* p2) {
     EmitPtr(p1);
     EmitPtr(p2);
     if (p1) SerializeTrait<T1>::Emit(*this,*p1);
-    if (p2) SerializeTrait<T2>::Emit(*this,*p2);    
+    if (p2) SerializeTrait<T2>::Emit(*this,*p2);
   }
 
   template <typename T1, typename T2, typename T3>
@@ -87,7 +87,7 @@
     if (p2) SerializeTrait<T2>::Emit(*this,*p2);
     if (p3) SerializeTrait<T3>::Emit(*this,*p3);
   }
-  
+
   template <typename T1, typename T2, typename T3, typename T4>
   void BatchEmitOwnedPtrs(T1* p1, T2* p2, T3* p3, T4& p4) {
     EmitPtr(p1);
@@ -108,99 +108,99 @@
     for (unsigned i = 0; i < NumPtrs; ++i)
       if (Ptrs[i]) SerializeTrait<T>::Emit(*this,*Ptrs[i]);
   }
-  
+
   template <typename T1, typename T2>
   void BatchEmitOwnedPtrs(unsigned NumT1Ptrs, T1* const * Ptrs, T2* p2) {
-    
+
     for (unsigned i = 0; i < NumT1Ptrs; ++i)
       EmitPtr(Ptrs[i]);
-    
+
     EmitPtr(p2);
-    
+
     for (unsigned i = 0; i < NumT1Ptrs; ++i)
       if (Ptrs[i]) SerializeTrait<T1>::Emit(*this,*Ptrs[i]);
-    
+
     if (p2) SerializeTrait<T2>::Emit(*this,*p2);
   }
-  
+
   template <typename T1, typename T2, typename T3>
   void BatchEmitOwnedPtrs(unsigned NumT1Ptrs, T1* const * Ptrs,
                           T2* p2, T3* p3) {
-    
+
     for (unsigned i = 0; i < NumT1Ptrs; ++i)
       EmitPtr(Ptrs[i]);
-    
+
     EmitPtr(p2);
     EmitPtr(p3);
-    
+
     for (unsigned i = 0; i < NumT1Ptrs; ++i)
       if (Ptrs[i]) SerializeTrait<T1>::Emit(*this,*Ptrs[i]);
-    
+
     if (p2) SerializeTrait<T2>::Emit(*this,*p2);
     if (p3) SerializeTrait<T3>::Emit(*this,*p3);
   }
-  
+
   //==------------------------------------------------==//
   // Emitter Functors
   //==------------------------------------------------==//
-  
+
   template <typename T>
   struct Emitter0 {
-    Serializer& S;    
+    Serializer& S;
     Emitter0(Serializer& s) : S(s) {}
     void operator()(const T& x) const {
       SerializeTrait<T>::Emit(S,x);
     }
   };
-  
+
   template <typename T, typename Arg1>
   struct Emitter1 {
     Serializer& S;
     Arg1 A1;
-    
+
     Emitter1(Serializer& s, Arg1 a1) : S(s), A1(a1) {}
     void operator()(const T& x) const {
       SerializeTrait<T>::Emit(S,x,A1);
     }
   };
-  
+
   template <typename T, typename Arg1, typename Arg2>
   struct Emitter2 {
     Serializer& S;
     Arg1 A1;
     Arg2 A2;
-    
+
     Emitter2(Serializer& s, Arg1 a1, Arg2 a2) : S(s), A1(a1), A2(a2) {}
     void operator()(const T& x) const {
       SerializeTrait<T>::Emit(S,x,A1,A2);
     }
   };
-  
+
   template <typename T>
   Emitter0<T> MakeEmitter() {
     return Emitter0<T>(*this);
   }
-  
+
   template <typename T, typename Arg1>
   Emitter1<T,Arg1> MakeEmitter(Arg1 a1) {
     return Emitter1<T,Arg1>(*this,a1);
   }
-  
+
   template <typename T, typename Arg1, typename Arg2>
   Emitter2<T,Arg1,Arg2> MakeEmitter(Arg1 a1, Arg2 a2) {
     return Emitter2<T,Arg1,Arg2>(*this,a1,a2);
   }
-  
+
   //==------------------------------------------------==//
   // Misc. query and block/record manipulation methods.
-  //==------------------------------------------------==//  
-    
+  //==------------------------------------------------==//
+
   bool isRegistered(const void* p) const;
-  
-  void FlushRecord() { if (inRecord()) EmitRecord(); }  
+
+  void FlushRecord() { if (inRecord()) EmitRecord(); }
   void EnterBlock(unsigned BlockID = 8, unsigned CodeLen = 3);
-  void ExitBlock();    
-  
+  void ExitBlock();
+
 private:
   void EmitRecord();
   inline bool inRecord() { return Record.size() > 0; }





More information about the llvm-commits mailing list