diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-02-12 18:08:17 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-02-12 18:08:17 +0000 |
commit | 8e49dd6e7e73b275a74338a5127a524f0765303c (patch) | |
tree | 6c5d8c1c49c477888197eea39fa32f6a29254278 /Analysis/GREngine.cpp | |
parent | bab96968886f4b77083f4e26a28986ddb1e42d67 (diff) |
Added GRBlockCounter class, which tracks the number of times blocks
have been visited in a path. Added GRBlockCounter as an item to be
enqueued to the worklist.
Modified "ProcessBranch" in GRConstants to prune branches with symbolic
conditions that have been already taken.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Analysis/GREngine.cpp')
-rw-r--r-- | Analysis/GREngine.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Analysis/GREngine.cpp b/Analysis/GREngine.cpp index e3b238aebe..9858f24784 100644 --- a/Analysis/GREngine.cpp +++ b/Analysis/GREngine.cpp @@ -71,6 +71,9 @@ bool GREngineImpl::ExecuteWorkList(unsigned Steps) { // starting location in the function. BlockEdge StartLoc(getCFG(), Entry, Succ); + // Set the current block counter to being empty. + WList->setBlockCounter(BCounterFactory.GetEmptyCounter()); + // Generate the root. GenerateNode(StartLoc, getInitialState()); } @@ -78,6 +81,11 @@ bool GREngineImpl::ExecuteWorkList(unsigned Steps) { while (Steps && WList->hasWork()) { --Steps; const GRWorkListUnit& WU = WList->Dequeue(); + + // Set the current block counter. + WList->setBlockCounter(WU.getBlockCounter()); + + // Retrieve the node. ExplodedNodeImpl* Node = WU.getNode(); // Dispatch on the location type. @@ -138,6 +146,12 @@ void GREngineImpl::HandleBlockEdge(const BlockEdge& L, ExplodedNodeImpl* Pred) { void GREngineImpl::HandleBlockEntrance(const BlockEntrance& L, ExplodedNodeImpl* Pred) { + // Increment the block counter. + GRBlockCounter Counter = WList->getBlockCounter(); + Counter = BCounterFactory.IncrementCount(Counter, L.getBlock()->getBlockID()); + WList->setBlockCounter(Counter); + + // Process the entrance of the block. if (Stmt* S = L.getFirstStmt()) { GRStmtNodeBuilderImpl Builder(L.getBlock(), 0, Pred, this); ProcessStmt(S, Builder); @@ -196,7 +210,7 @@ void GREngineImpl::HandleBranch(Expr* Cond, Stmt* Term, CFGBlock * B, ExplodedNodeImpl* Pred) { assert (B->succ_size() == 2); - GRBranchNodeBuilderImpl Builder(B, *(B->succ_begin()), *(B->succ_begin()+1), + GRBranchNodeBuilderImpl Builder(B, *(B->succ_begin()), *(B->succ_begin()+1), Pred, this); ProcessBranch(Cond, Term, Builder); @@ -244,7 +258,7 @@ void GREngineImpl::GenerateNode(const ProgramPoint& Loc, void* State, } // Only add 'Node' to the worklist if it was freshly generated. - if (IsNew) WList->Enqueue(GRWorkListUnit(Node)); + if (IsNew) WList->Enqueue(Node); } GRStmtNodeBuilderImpl::GRStmtNodeBuilderImpl(CFGBlock* b, unsigned idx, @@ -325,5 +339,5 @@ GRBranchNodeBuilderImpl::~GRBranchNodeBuilderImpl() { if (!GeneratedFalse) generateNodeImpl(Pred->State, false); for (DeferredTy::iterator I=Deferred.begin(), E=Deferred.end(); I!=E; ++I) - if (!(*I)->isSink()) Eng.WList->Enqueue(GRWorkListUnit(*I)); + if (!(*I)->isSink()) Eng.WList->Enqueue(*I); } |