Added methods to batch emit and deserialize owned pointers. This allows

to group the pointer IDs together in the bitstream before their referenced
contents (which will lend itself to more efficient encoding).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43845 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ted Kremenek
2007-11-07 22:30:29 +00:00
parent 4542edcaa7
commit 6d8ab4ae81
2 changed files with 67 additions and 4 deletions

View File

@ -54,6 +54,36 @@ public:
EmitPtr(ptr);
if (ptr) SerializeTrait<T>::Emit(*this,*ptr);
}
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);
}
template <typename T1, typename T2, typename T3>
void BatchEmitOwnedPtrs(T1* p1, T2* p2, T3* p3) {
EmitPtr(p1);
EmitPtr(p2);
EmitPtr(p3);
if (p1) SerializeTrait<T1>::Emit(*this,*p1);
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);
EmitPtr(p2);
EmitPtr(p3);
EmitPtr(p4);
if (p1) SerializeTrait<T1>::Emit(*this,*p1);
if (p2) SerializeTrait<T2>::Emit(*this,*p2);
if (p3) SerializeTrait<T3>::Emit(*this,*p3);
if (p4) SerializeTrait<T4>::Emit(*this,*p4);
}
void FlushRecord() { if (inRecord()) EmitRecord(); }