[llvm-commits] [llvm] r44200 - in /llvm/trunk/include/llvm/Bitcode: Deserialize.h Serialize.h

Ted Kremenek kremenek at apple.com
Fri Nov 16 16:45:38 PST 2007


Author: kremenek
Date: Fri Nov 16 18:45:37 2007
New Revision: 44200

URL: http://llvm.org/viewvc/llvm-project?rev=44200&view=rev
Log:
Changed implementation of Serialize::EmitDiffPtrID and
Deserialize::ReadDiffPtrID to read and emit bools instead of unsigned
integers. This should result in a nice space optimization once we have
"auto-abbreviation" generation in place.

Modified:
    llvm/trunk/include/llvm/Bitcode/Deserialize.h
    llvm/trunk/include/llvm/Bitcode/Serialize.h

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

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Fri Nov 16 18:45:37 2007
@@ -141,8 +141,8 @@
   SerializedPtrID ReadPtrID() { return (SerializedPtrID) ReadInt(); }
 
   SerializedPtrID ReadDiffPtrID(SerializedPtrID& PrevID) {
-    unsigned x = ReadInt();    
-    return (SerializedPtrID) (x ? (PrevID+x) : 0);
+    bool x = ReadBool();    
+    return (SerializedPtrID) (x ? (PrevID+1) : 0);
   }
   
   

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

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Serialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialize.h Fri Nov 16 18:45:37 2007
@@ -57,10 +57,11 @@
     SerializedPtrID ptr_id = getPtrId(ptr);
 
     if (ptr_id == 0)
-      EmitInt(0);
+      EmitBool(false);
     else {
       assert (ptr_id > PrevID);
-      EmitInt(ptr_id-PrevID);
+      assert (PrevID == 0 || ptr_id - PrevID == 1);
+      EmitBool(true);
     }
     
     return ptr_id;    





More information about the llvm-commits mailing list