Static Value-Flow Analysis
WPAPass.h
Go to the documentation of this file.
1 //===- WPAPass.h -- Whole program 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 /*
25  * @file: WPA.h
26  * @author: yesen
27  * @date: 10/06/2014
28  * @version: 1.0
29  *
30  * @section LICENSE
31  *
32  * @section DESCRIPTION
33  *
34  */
35 
36 
37 #ifndef WPA_H_
38 #define WPA_H_
39 
41 
42 namespace SVF
43 {
44 
45 class SVFModule;
46 class SVFG;
47 
52 // excised ", public llvm::AliasAnalysis" as that has a very light interface
53 // and I want to see what breaks.
54 class WPAPass
55 {
56  typedef std::vector<PointerAnalysis*> PTAVector;
57 
58 public:
60  static char ID;
61 
63  {
65  Veto,
66  Precise
67  };
68 
71  {
72 
73  }
74 
76  virtual ~WPAPass();
77 
79  virtual AliasResult alias(const SVFValue* V1, const SVFValue* V2);
80 
82  virtual const PointsTo& getPts(const SVFValue* value);
83  virtual const PointsTo& getPts(NodeID var);
84 
86  virtual void PrintAliasPairs(PointerAnalysis* pta);
87 
89  virtual ModRefInfo getModRefInfo(const CallICFGNode* callInst);
90 
92  // virtual inline ModRefInfo getModRefInfo(const CallSite callInst, const MemoryLocation& Loc)
93  // {
94  // return getModRefInfo(callInst, Loc.Ptr);
95  // }
96 
98  virtual ModRefInfo getModRefInfo(const CallICFGNode* callInst, const SVFValue* V);
99 
101  virtual ModRefInfo getModRefInfo(const CallICFGNode* callInst1, const CallICFGNode* callInst2);
102 
104  virtual void runOnModule(SVFIR* svfModule);
105 
107  virtual inline std::string getPassName() const
108  {
109  return "WPAPass";
110  }
111 
112 private:
114  void runPointerAnalysis(SVFIR* pag, u32_t kind);
115 
119 };
120 
121 } // End namespace SVF
122 
123 #endif /* WPA_H_ */
const char *const string
Definition: cJSON.h:172
Definition: SVFG.h:66
PointerAnalysis * _pta
pointer analysis to be executed.
Definition: WPAPass.h:117
static char ID
Pass ID.
Definition: WPAPass.h:60
WPAPass()
Constructor needs TargetLibraryInfo to be passed to the AliasAnalysis.
Definition: WPAPass.h:70
@ Conservative
return MayAlias if any pta says alias
Definition: WPAPass.h:64
@ Precise
return alias result by the most precise pta
Definition: WPAPass.h:66
@ Veto
return NoAlias if any pta says no alias
Definition: WPAPass.h:65
virtual const PointsTo & getPts(const SVFValue *value)
Retrieve points-to set information.
Definition: WPAPass.cpp:157
PTAVector ptaVector
all pointer analysis to be executed.
Definition: WPAPass.h:116
virtual ~WPAPass()
Destructor.
Definition: WPAPass.cpp:54
virtual ModRefInfo getModRefInfo(const CallICFGNode *callInst)
Interface of mod-ref analysis to determine whether a CallSite instruction can mod or ref any memory l...
Definition: WPAPass.cpp:221
virtual std::string getPassName() const
PTA name.
Definition: WPAPass.h:107
virtual AliasResult alias(const SVFValue *V1, const SVFValue *V2)
Interface expose to users of our pointer analysis, given Value infos.
Definition: WPAPass.cpp:174
virtual void PrintAliasPairs(PointerAnalysis *pta)
Print all alias pairs.
Definition: WPAPass.cpp:133
SVFG * _svfg
svfg generated through -ander pointer analysis
Definition: WPAPass.h:118
void runPointerAnalysis(SVFIR *pag, u32_t kind)
Create pointer analysis according to specified kind and analyze the module.
Definition: WPAPass.cpp:83
std::vector< PointerAnalysis * > PTAVector
Definition: WPAPass.h:56
virtual void runOnModule(SVFIR *svfModule)
Run pointer analysis on SVFModule.
Definition: WPAPass.cpp:69
for isBitcode
Definition: BasicTypes.h:68
ModRefInfo
Definition: SVFType.h:519
u32_t NodeID
Definition: GeneralType.h:55
AliasResult
Definition: SVFType.h:527
unsigned u32_t
Definition: GeneralType.h:46