aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Bitcode
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-11-17 00:45:37 +0000
committerTed Kremenek <kremenek@apple.com>2007-11-17 00:45:37 +0000
commitd980df2addafcc72cefa70a791a7af3b46b59e7e (patch)
treed4785a39cce3f11ee3616f031fca116ab7e57d14 /include/llvm/Bitcode
parent8ad74f881a33b9a883c1facd529c00d772c66f84 (diff)
downloadexternal_llvm-d980df2addafcc72cefa70a791a7af3b46b59e7e.zip
external_llvm-d980df2addafcc72cefa70a791a7af3b46b59e7e.tar.gz
external_llvm-d980df2addafcc72cefa70a791a7af3b46b59e7e.tar.bz2
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
Diffstat (limited to 'include/llvm/Bitcode')
-rw-r--r--include/llvm/Bitcode/Deserialize.h4
-rw-r--r--include/llvm/Bitcode/Serialize.h5
2 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/Bitcode/Deserialize.h b/include/llvm/Bitcode/Deserialize.h
index 46b111f..ef25da7 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 8db3779..9430bb1 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;