Static Value-Flow Analysis
TypeAnalysis.h
Go to the documentation of this file.
1 //===- TypeAnalysis.h -- Fast type-based analysis without pointer analysis---------//
2 //
3 // SVF: Static Value-Flow Analysis
4 //
5 // Copyright (C) <2013-2017> <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  * TypeAnalysis.h
25  *
26  * Created on: 7 Sep. 2018
27  * Author: Yulei Sui
28  */
29 
30 #ifndef INCLUDE_WPA_TYPEANALYSIS_H_
31 #define INCLUDE_WPA_TYPEANALYSIS_H_
32 
33 #include "WPA/Andersen.h"
34 
35 namespace SVF
36 {
37 
39 {
40 
41 public:
45  {
46  }
47 
49  virtual ~TypeAnalysis()
50  {
51  }
52 
54  void analyze() override;
55 
57  void initialize() override;
58 
60  virtual inline void finalize() override;
61 
63  inline bool addCopyEdge(NodeID src, NodeID dst) override
64  {
65  assert(false && "this function should never be executed!");
66  return false;
67  }
68 
70  void callGraphSolveBasedOnCHA(const CallSiteToFunPtrMap& callsites, CallEdgeMap& newEdges);
71 
73  void dumpCHAStats();
74 
76 
77  static inline bool classof(const TypeAnalysis *)
78  {
79  return true;
80  }
81  static inline bool classof(const PointerAnalysis *pta)
82  {
83  return (pta->getAnalysisTy() == TypeCPP_WPA);
84  }
86 };
87 
88 } // End namespace SVF
89 
90 #endif /* INCLUDE_WPA_TYPEANALYSIS_H_ */
@ TypeCPP_WPA
Type-based analysis for C++.
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
PTATY getAnalysisTy() const
Type of pointer analysis.
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
static SVFIR * pag
SVFIR.
void dumpCHAStats()
Statistics of CHA and callgraph.
virtual void finalize() override
Finalize analysis.
bool addCopyEdge(NodeID src, NodeID dst) override
Add copy edge on constraint graph.
Definition: TypeAnalysis.h:63
static bool classof(const PointerAnalysis *pta)
Definition: TypeAnalysis.h:81
virtual ~TypeAnalysis()
Destructor.
Definition: TypeAnalysis.h:49
void initialize() override
Initialize analysis.
TypeAnalysis(SVFIR *pag)
Constructor.
Definition: TypeAnalysis.h:43
void analyze() override
Type analysis.
static bool classof(const TypeAnalysis *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: TypeAnalysis.h:77
void callGraphSolveBasedOnCHA(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
Resolve callgraph based on CHA.
for isBitcode
Definition: BasicTypes.h:68
u32_t NodeID
Definition: GeneralType.h:55