diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-09-16 18:44:52 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-09-16 18:44:52 +0000 |
commit | 0ecb53a421da0750ad289674812ac676fc7664bc (patch) | |
tree | 825516f5986af87de4492b923a39e91a53c8fb4e /clang/lib/AST/CFG.cpp | |
parent | 7c5dbd95e21b406ee08b41356d53b939e3360464 (diff) | |
download | bcm5719-llvm-0ecb53a421da0750ad289674812ac676fc7664bc.tar.gz bcm5719-llvm-0ecb53a421da0750ad289674812ac676fc7664bc.zip |
ProgramPoint now takes the space of two pointers instead of one. This change was
motivated because it became clear that the number of subclasses of ProgramPoint
would expand and we ran out of bits to represent a pointer variant. As a plus of
this change, BlockEdge program points can now be represented explicitly without
using a cache of CFGBlock* pairs in CFG.
llvm-svn: 56245
Diffstat (limited to 'clang/lib/AST/CFG.cpp')
-rw-r--r-- | clang/lib/AST/CFG.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/clang/lib/AST/CFG.cpp b/clang/lib/AST/CFG.cpp index 78c8dca423d..b18f90497f0 100644 --- a/clang/lib/AST/CFG.cpp +++ b/clang/lib/AST/CFG.cpp @@ -1213,69 +1213,11 @@ unsigned CFG::getNumBlkExprs() { } //===----------------------------------------------------------------------===// -// Internal Block-Edge Set; used for modeling persistent <CFGBlock*,CFGBlock*> -// pairs for use with ProgramPoint. -//===----------------------------------------------------------------------===// - -typedef std::pair<CFGBlock*,CFGBlock*> BPairTy; - -namespace llvm { - template<> struct FoldingSetTrait<BPairTy*> { - static void Profile(const BPairTy* X, FoldingSetNodeID& profile) { - profile.AddPointer(X->first); - profile.AddPointer(X->second); - } - }; -} - -typedef llvm::FoldingSetNodeWrapper<BPairTy*> PersistPairTy; -typedef llvm::FoldingSet<PersistPairTy> BlkEdgeSetTy; - -const std::pair<CFGBlock*,CFGBlock*>* -CFG::getBlockEdgeImpl(const CFGBlock* B1, const CFGBlock* B2) { - - if (!BlkEdgeSet) - BlkEdgeSet = new BlkEdgeSetTy(); - - BlkEdgeSetTy* p = static_cast<BlkEdgeSetTy*>(BlkEdgeSet); - - // Profile the edges. - llvm::FoldingSetNodeID profile; - void* InsertPos; - - profile.AddPointer(B1); - profile.AddPointer(B2); - - PersistPairTy* V = p->FindNodeOrInsertPos(profile, InsertPos); - - if (!V) { - assert (llvm::AlignOf<BPairTy>::Alignment_LessEqual_8Bytes); - - // Allocate the pair, forcing an 8-byte alignment. - BPairTy* pair = (BPairTy*) Alloc.Allocate(sizeof(*pair), 8); - - new (pair) BPairTy(const_cast<CFGBlock*>(B1), - const_cast<CFGBlock*>(B2)); - - // Allocate the meta data to store the pair in the FoldingSet. - PersistPairTy* ppair = (PersistPairTy*) Alloc.Allocate<PersistPairTy>(); - new (ppair) PersistPairTy(pair); - - p->InsertNode(ppair, InsertPos); - - return pair; - } - - return V->getValue(); -} - -//===----------------------------------------------------------------------===// // Cleanup: CFG dstor. //===----------------------------------------------------------------------===// CFG::~CFG() { delete reinterpret_cast<const BlkExprMapTy*>(BlkExprMap); - delete reinterpret_cast<BlkEdgeSetTy*>(BlkEdgeSet); } //===----------------------------------------------------------------------===// |