From: Ted Kremenek Date: Sat, 17 Nov 2007 00:45:37 +0000 (+0000) Subject: Changed implementation of Serialize::EmitDiffPtrID and X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=07cad1c6ceebd108db87309814c8dc47041c58c3;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44200 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Bitcode/Deserialize.h b/include/llvm/Bitcode/Deserialize.h index 46b111f8929..ef25da71409 100644 --- a/include/llvm/Bitcode/Deserialize.h +++ b/include/llvm/Bitcode/Deserialize.h @@ -141,8 +141,8 @@ public: 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); } diff --git a/include/llvm/Bitcode/Serialize.h b/include/llvm/Bitcode/Serialize.h index 8db377946c4..9430bb10a42 100644 --- a/include/llvm/Bitcode/Serialize.h +++ b/include/llvm/Bitcode/Serialize.h @@ -57,10 +57,11 @@ public: 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;