void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) { assert(!getFlag()); GroupStorage &Storage = reinterpret_cast<GroupStorage&>(P); if (Storage.isNull()) { Storage = N; assert(Storage.is<ExplodedNode *>()); return; } ExplodedNodeVector *V = Storage.dyn_cast<ExplodedNodeVector *>(); if (!V) { // Switch from single-node to multi-node representation. ExplodedNode *Old = Storage.get<ExplodedNode *>(); BumpVectorContext &Ctx = G.getNodeAllocator(); V = G.getAllocator().Allocate<ExplodedNodeVector>(); new (V) ExplodedNodeVector(Ctx, 4); V->push_back(Old, Ctx); Storage = V; assert(!getFlag()); assert(Storage.is<ExplodedNodeVector *>()); } V->push_back(N, G.getNodeAllocator()); }
void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) { assert((reinterpret_cast<uintptr_t>(N) & Mask) == 0x0); assert(!getFlag()); if (getKind() == Size1) { if (ExplodedNode *NOld = getNode()) { BumpVectorContext &Ctx = G.getNodeAllocator(); BumpVector<ExplodedNode*> *V = G.getAllocator().Allocate<BumpVector<ExplodedNode*> >(); new (V) BumpVector<ExplodedNode*>(Ctx, 4); assert((reinterpret_cast<uintptr_t>(V) & Mask) == 0x0); V->push_back(NOld, Ctx); V->push_back(N, Ctx); P = reinterpret_cast<uintptr_t>(V) | SizeOther; assert(getPtr() == (void*) V); assert(getKind() == SizeOther); } else { P = reinterpret_cast<uintptr_t>(N); assert(getKind() == Size1); } } else { assert(getKind() == SizeOther); getVector(getPtr()).push_back(N, G.getNodeAllocator()); } }