diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-09-18 18:17:19 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-09-18 18:17:19 +0000 |
commit | 8e2806573e74465c887a23b1bb4a05769a59b564 (patch) | |
tree | e0bcda7cede4c33f8d24fdb2818fe7604a74d405 | |
parent | 105bfee9d691b56bfa75a7c44b411533c5a369f0 (diff) |
Moved TransferFunction object within DataflowSolver to be a instance
variable instead of a temporary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42102 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Analysis/DataflowSolver.h | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/Analysis/DataflowSolver.h b/Analysis/DataflowSolver.h index e2c4f16a51..724b4a4fbb 100644 --- a/Analysis/DataflowSolver.h +++ b/Analysis/DataflowSolver.h @@ -68,7 +68,7 @@ public: //===--------------------------------------------------------------------===// public: - DataflowSolver(DFValuesTy& d) : D(d) {} + DataflowSolver(DFValuesTy& d) : D(d), TF(d.getAnalysisData()) {} ~DataflowSolver() {} /// runOnCFG - Computes dataflow values for all blocks in a CFG. @@ -86,11 +86,8 @@ public: /// only be used for querying the dataflow values within a block with /// and Observer object. void runOnBlock(const CFGBlock* B) { - if (!hasData(B,AnalysisDirTag())) - return; - - TransferFuncsTy TF (D.getAnalysisData()); - ProcessBlock(B,TF,AnalysisDirTag()); + if (hasData(B,AnalysisDirTag())) + ProcessBlock(B,AnalysisDirTag()); } //===--------------------------------------------------------------------===// @@ -105,16 +102,13 @@ private: EnqueueFirstBlock(cfg,AnalysisDirTag()); - // Create the state for transfer functions. - TransferFuncsTy TF(D.getAnalysisData()); - // Process the worklist until it is empty. while (!WorkList.isEmpty()) { const CFGBlock* B = WorkList.dequeue(); // If the dataflow values at the block's entry have changed, // enqueue all predecessor blocks onto the worklist to have // their values updated. - ProcessBlock(B,TF,AnalysisDirTag()); + ProcessBlock(B,AnalysisDirTag()); UpdateEdges(B,TF.getVal(),AnalysisDirTag()); } } @@ -129,12 +123,10 @@ private: /// ProcessBlock (FORWARD ANALYSIS) - Process the transfer functions /// for a given block based on a forward analysis. - void ProcessBlock(const CFGBlock* B, TransferFuncsTy& TF, - dataflow::forward_analysis_tag) { - - ValTy& V = TF.getVal(); - + void ProcessBlock(const CFGBlock* B, dataflow::forward_analysis_tag) { + // Merge dataflow values from all predecessors of this block. + ValTy& V = TF.getVal(); V.resetValues(D.getAnalysisData()); MergeOperatorTy Merge; @@ -163,10 +155,9 @@ private: /// for a given block based on a forward analysis. void ProcessBlock(const CFGBlock* B, TransferFuncsTy& TF, dataflow::backward_analysis_tag) { - - ValTy& V = TF.getVal(); - + // Merge dataflow values from all predecessors of this block. + ValTy& V = TF.getVal(); V.resetValues(D.getAnalysisData()); MergeOperatorTy Merge; @@ -263,6 +254,7 @@ private: private: DFValuesTy& D; DataflowWorkListTy WorkList; + TransferFuncsTy TF; }; |