Static Value-Flow Analysis
CFLBase.h
Go to the documentation of this file.
1 //===----- CFLBase.h -- CFL Analysis Client Base--------------//
2 //
3 // SVF: Static Value-Flow Analysis
4 //
5 // Copyright (C) <2013-> <Yulei Sui>
6 //
7 
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
17 
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //
21 //===----------------------------------------------------------------------===//
22 
23 /*
24  * CFLBase.h
25  *
26  * Created on: Oct 12, 2022
27  * Author: Pei Xu
28  */
29 
30 #ifndef INCLUDE_CFL_CFLBASE_H_
31 #define INCLUDE_CFL_CFLBASE_H_
32 
33 #include "CFL/CFLSolver.h"
34 #include "CFL/CFGNormalizer.h"
35 #include "CFL/GrammarBuilder.h"
36 #include "CFL/CFLGraphBuilder.h"
39 #include "Graphs/ConsG.h"
40 #include "Util/Options.h"
41 #include "SVFIR/SVFType.h"
42 
43 namespace SVF
44 {
45 
46 class CFLStat;
47 
49 class CFLBase : public BVDataPTAImpl
50 {
51 
52 public:
53  CFLBase(SVFIR* ir, PointerAnalysis::PTATY pty) : BVDataPTAImpl(ir, pty), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
54  {
55  }
56 
58  virtual ~CFLBase()
59  {
60  delete solver;
61  delete grammarBase;
62  }
63 
65  virtual void checkParameter();
66 
68  virtual void buildCFLGrammar();
69 
71  virtual void buildCFLGraph();
72 
74  virtual void normalizeCFLGrammar();
75 
78 
80  virtual void countSumEdges();
81 
83  virtual void solve();
84 
86  virtual void finalize();
87 
89  virtual void analyze();
90 
92 
93  // Grammar
94  static double timeOfBuildCFLGrammar; // Time of building grammarBase from text file
95  static double timeOfNormalizeGrammar; // Time of normalizing grammarBase to CFGrammar
96  // Graph
97  static double timeOfBuildCFLGraph; // Time of building CFLGraph
98  static double numOfTerminalEdges; // Number of terminal labeled edges
99  static double numOfTemporaryNonterminalEdges; // Number of temporary (ie. X0, X1..) nonterminal labeled edges
100  static double numOfNonterminalEdges; // Number of nonterminal labeled edges
101  static double numOfStartEdges; // Number of start nonterminal labeled edges
102  // Solver
103  static double numOfIteration; // Number solving Iteration
104  static double numOfChecks; // Number of checks
105  static double timeOfSolving; // time of solving CFL Reachability
107 
108 protected:
114 };
115 
116 } // End namespace SVF
117 
118 #endif /* INCLUDE_CFL_CFLBASE_H_*/
CFL Client Base Class.
Definition: CFLBase.h:50
static double timeOfBuildCFLGrammar
Statistics.
Definition: CFLBase.h:94
virtual void buildCFLGraph()
Build CFLGraph based on Option.
Definition: CFLBase.cpp:78
CFLGraph * getCFLGraph()
Get CFL graph.
Definition: CFLBase.cpp:145
static double numOfStartEdges
Definition: CFLBase.h:101
virtual void analyze()
Perform analyze (main part of CFLR Analysis)
Definition: CFLBase.cpp:136
virtual void solve()
Solving CFL Reachability.
Definition: CFLBase.cpp:118
CFLSolver * solver
Definition: CFLBase.h:113
virtual void normalizeCFLGrammar()
Normalize grammar.
Definition: CFLBase.cpp:105
static double numOfChecks
Definition: CFLBase.h:104
static double numOfNonterminalEdges
Definition: CFLBase.h:100
CFLBase(SVFIR *ir, PointerAnalysis::PTATY pty)
Definition: CFLBase.h:53
virtual void checkParameter()
Parameter Checking.
Definition: CFLBase.cpp:49
virtual void buildCFLGrammar()
Build Grammar from text file.
Definition: CFLBase.cpp:65
virtual void finalize()
Finalize extra stat info passing.
Definition: CFLBase.cpp:129
CFLGraph * graph
Definition: CFLBase.h:110
virtual void countSumEdges()
Count the num of Nonterminal Edges.
Definition: CFLBase.cpp:150
static double timeOfSolving
Definition: CFLBase.h:105
CFGrammar * grammar
Definition: CFLBase.h:112
static double timeOfBuildCFLGraph
Definition: CFLBase.h:97
virtual ~CFLBase()
Destructor.
Definition: CFLBase.h:58
SVFIR * svfir
Definition: CFLBase.h:109
static double numOfIteration
Definition: CFLBase.h:103
static double numOfTerminalEdges
Definition: CFLBase.h:98
static double numOfTemporaryNonterminalEdges
Definition: CFLBase.h:99
static double timeOfNormalizeGrammar
Definition: CFLBase.h:95
GrammarBase * grammarBase
Definition: CFLBase.h:111
PTATY
Pointer analysis type list.
for isBitcode
Definition: BasicTypes.h:68