llvm.org GIT mirror llvm / 38afd9e
Added two new overloaded versions of BatchEmitOwnedPtrs and BatchReadOwnedPtrs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44105 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 12 years ago
3 changed file(s) with 55 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
229229 }
230230 }
231231
232 template
233 void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs, T2*& P2,
234 bool A1=true, bool A2=true) {
235
236 BatchIDVec.clear();
237
238 for (unsigned i = 0; i < NumT1Ptrs; ++i)
239 BatchIDVec.push_back(ReadPtrID());
240
241 SerializedPtrID ID2 = ReadPtrID();
242
243 for (unsigned i = 0; i < NumT1Ptrs; ++i) {
244 SerializedPtrID& PtrID = BatchIDVec[i];
245
246 T1* p = PtrID ? SerializeTrait::Create(*this) : NULL;
247
248 if (PtrID && A1)
249 RegisterPtr(PtrID,p);
250
251 Ptrs[i] = p;
252 }
253
254 P2 = (ID2) ? SerializeTrait::Create(*this) : NULL;
255 if (ID2 && A2) RegisterPtr(ID2,P2);
256 }
257
232258 template
233259 void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs,
234260 T2*& P2, T3*& P3,
9393 if (Ptrs[i]) SerializeTrait::Emit(*this,*Ptrs[i]);
9494 }
9595
96 template
97 void BatchEmitOwnedPtrs(unsigned NumT1Ptrs, T1* const * Ptrs, T2* p2) {
98
99 for (unsigned i = 0; i < NumT1Ptrs; ++i)
100 EmitPtr(Ptrs[i]);
101
102 EmitPtr(p2);
103
104 for (unsigned i = 0; i < NumT1Ptrs; ++i)
105 if (Ptrs[i]) SerializeTrait::Emit(*this,*Ptrs[i]);
106
107 if (p2) SerializeTrait::Emit(*this,*p2);
108 }
109
96110 template
97111 void BatchEmitOwnedPtrs(unsigned NumT1Ptrs, T1* const * Ptrs,
98112 T2* p2, T3* p3) {
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "llvm/Bitcode/Deserialize.h"
14
15 #define DEBUG_BACKPATCH
1416
1517 #ifdef DEBUG_BACKPATCH
1618 #include "llvm/Support/Streams.h"
345347 return;
346348 }
347349
350 MapTy::value_type& E = BPatchMap.FindAndConstruct(BPKey(PtrId));
351
352 if (HasFinalPtr(E)) {
353 PtrRef = GetFinalPtr(E);
354
348355 #ifdef DEBUG_BACKPATCH
349 llvm::cerr << "ReadUintPtr: " << PtrId << "\n";
350 #endif
351
352 MapTy::value_type& E = BPatchMap.FindAndConstruct(BPKey(PtrId));
353
354 if (HasFinalPtr(E))
355 PtrRef = GetFinalPtr(E);
356 llvm::cerr << "ReadUintPtr: " << PtrId
357 << " <-- " << (void*) GetFinalPtr(E) << '\n';
358 #endif
359 }
356360 else {
357361 assert (AllowBackpatch &&
358362 "Client forbids backpatching for this pointer.");
363
364 #ifdef DEBUG_BACKPATCH
365 llvm::cerr << "ReadUintPtr: " << PtrId << " (NO PTR YET)\n";
366 #endif
359367
360368 // Register backpatch. Check the freelist for a BPNode.
361369 BPNode* N;