[llvm-commits] [llvm] r68472 - /llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp

Chris Lattner sabre at nondot.org
Mon Apr 6 15:44:40 PDT 2009


Author: lattner
Date: Mon Apr  6 17:44:40 2009
New Revision: 68472

URL: http://llvm.org/viewvc/llvm-project?rev=68472&view=rev
Log:
stub out code for reading record with blobs as blobs.  Not active yet.

Modified:
    llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp

Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=68472&r1=68471&r2=68472&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original)
+++ llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Mon Apr  6 17:44:40 2009
@@ -341,12 +341,33 @@
       ++BlockStats.NumAbbrevs;
       break;
     default:
+      Record.clear();
+      bool HasBlob = false;
+
       ++BlockStats.NumRecords;
-      if (AbbrevID != bitc::UNABBREV_RECORD)
+      if (AbbrevID != bitc::UNABBREV_RECORD) {
         ++BlockStats.NumAbbreviatedRecords;
-      
-      Record.clear();
-      unsigned Code = Stream.ReadRecord(AbbrevID, Record);
+        const BitCodeAbbrev *Abbv = Stream.getAbbrev(AbbrevID);
+        if (Abbv->getNumOperandInfos() != 0) {
+          const BitCodeAbbrevOp &LastOp =  
+            Abbv->getOperandInfo(Abbv->getNumOperandInfos()-1);
+          // If the last operand is a blob, then this record has blob data.
+          if (LastOp.isEncoding() && 
+              LastOp.getEncoding() == BitCodeAbbrevOp::Blob)
+            HasBlob = true;
+        }
+      }
+        
+      unsigned Code;
+      const char *BlobStart = 0;
+      unsigned BlobLen = 0;
+      if (!HasBlob)
+        Code = Stream.ReadRecord(AbbrevID, Record);
+      else {
+        Code = Stream.ReadRecord(AbbrevID, Record);
+        BlobStart = BlobStart;
+        BlobLen = BlobLen;
+      }
 
       // Increment the # occurrences of this code.
       if (BlockStats.CodeFreq.size() <= Code)





More information about the llvm-commits mailing list