Static Value-Flow Analysis
ConsGEdge.h
Go to the documentation of this file.
1 //===- ConsGEdge.h -- Constraint graph edge-----------------------------------//
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  * ConsGEdge.h
25  *
26  * Created on: Mar 19, 2014
27  * Author: Yulei Sui
28  */
29 
30 #ifndef CONSGEDGE_H_
31 #define CONSGEDGE_H_
32 
33 #include "SVFIR/SVFIR.h"
34 #include "Util/WorkList.h"
35 
36 #include <map>
37 #include <set>
38 
39 namespace SVF
40 {
41 
42 class ConstraintNode;
49 {
50 
51 public:
55  {
57  };
58 private:
60 public:
63  {
64  }
67  {
68  }
70  inline EdgeID getEdgeID() const
71  {
72  return edgeId;
73  }
75  static inline bool classof(const GenericConsEdgeTy *edge)
76  {
77  return edge->getEdgeKind() == Addr ||
78  edge->getEdgeKind() == Copy ||
79  edge->getEdgeKind() == Store ||
80  edge->getEdgeKind() == Load ||
81  edge->getEdgeKind() == NormalGep ||
82  edge->getEdgeKind() == VariantGep;
83  }
86 
87 };
88 
89 
94 {
95 private:
98  void operator=(const AddrCGEdge &);
99 public:
101 
102  static inline bool classof(const AddrCGEdge *)
103  {
104  return true;
105  }
106  static inline bool classof(const ConstraintEdge *edge)
107  {
108  return edge->getEdgeKind() == Addr;
109  }
110  static inline bool classof(const GenericConsEdgeTy *edge)
111  {
112  return edge->getEdgeKind() == Addr;
113  }
115 
118 };
119 
120 
125 {
126 private:
129  void operator=(const CopyCGEdge &);
130 public:
132 
133  static inline bool classof(const CopyCGEdge *)
134  {
135  return true;
136  }
137  static inline bool classof(const ConstraintEdge *edge)
138  {
139  return edge->getEdgeKind() == Copy;
140  }
141  static inline bool classof(const GenericConsEdgeTy *edge)
142  {
143  return edge->getEdgeKind() == Copy;
144  }
146 
149  {
150  }
151 };
152 
153 
158 {
159 private:
162  void operator=(const StoreCGEdge &);
163 
164 public:
166 
167  static inline bool classof(const StoreCGEdge *)
168  {
169  return true;
170  }
171  static inline bool classof(const ConstraintEdge *edge)
172  {
173  return edge->getEdgeKind() == Store;
174  }
175  static inline bool classof(const GenericConsEdgeTy *edge)
176  {
177  return edge->getEdgeKind() == Store;
178  }
180 
183  {
184  }
185 };
186 
187 
192 {
193 private:
196  void operator=(const LoadCGEdge &);
197 
198 public:
200 
201  static inline bool classof(const LoadCGEdge *)
202  {
203  return true;
204  }
205  static inline bool classof(const ConstraintEdge *edge)
206  {
207  return edge->getEdgeKind() == Load;
208  }
209  static inline bool classof(const GenericConsEdgeTy *edge)
210  {
211  return edge->getEdgeKind() == Load;
212  }
214 
217  {
218  }
219 };
220 
221 
226 {
227 private:
229  GepCGEdge(const GepCGEdge &);
230  void operator=(const GepCGEdge &);
231 
232 protected:
233 
236  : ConstraintEdge(s,d,k,id)
237  {
238 
239  }
240 
241 public:
243 
244  static inline bool classof(const GepCGEdge *)
245  {
246  return true;
247  }
248  static inline bool classof(const ConstraintEdge *edge)
249  {
250  return edge->getEdgeKind() == NormalGep ||
251  edge->getEdgeKind() == VariantGep;
252  }
253  static inline bool classof(const GenericConsEdgeTy *edge)
254  {
255  return edge->getEdgeKind() == NormalGep ||
256  edge->getEdgeKind() == VariantGep;
257  }
259 
260 };
261 
266 {
267 private:
270  void operator=(const NormalGepCGEdge &);
271 
273 
274 public:
276 
277  static inline bool classof(const NormalGepCGEdge *)
278  {
279  return true;
280  }
281  static inline bool classof(const GepCGEdge *edge)
282  {
283  return edge->getEdgeKind() == NormalGep;
284  }
285  static inline bool classof(const ConstraintEdge *edge)
286  {
287  return edge->getEdgeKind() == NormalGep;
288  }
289  static inline bool classof(const GenericConsEdgeTy *edge)
290  {
291  return edge->getEdgeKind() == NormalGep;
292  }
294 
297  EdgeID id)
298  : GepCGEdge(s, d, NormalGep, id), ap(ap)
299  {
300  }
301 
303  inline const AccessPath& getAccessPath() const
304  {
305  return ap;
306  }
307 
310  {
311  return ap.getConstantStructFldIdx();
312  }
313 
314 };
315 
320 {
321 private:
324  void operator=(const VariantGepCGEdge &);
325 
326 public:
328 
329  static inline bool classof(const VariantGepCGEdge *)
330  {
331  return true;
332  }
333  static inline bool classof(const GepCGEdge *edge)
334  {
335  return edge->getEdgeKind() == VariantGep;
336  }
337  static inline bool classof(const ConstraintEdge *edge)
338  {
339  return edge->getEdgeKind() == VariantGep;
340  }
341  static inline bool classof(const GenericConsEdgeTy *edge)
342  {
343  return edge->getEdgeKind() == VariantGep;
344  }
346 
349  : GepCGEdge(s,d,VariantGep,id)
350  {}
351 };
352 
353 } // End namespace SVF
354 
355 #endif /* CONSGEDGE_H_ */
APOffset getConstantStructFldIdx() const
Get methods.
Definition: AccessPath.h:100
static bool classof(const GenericConsEdgeTy *edge)
Definition: ConsGEdge.h:110
AddrCGEdge(const AddrCGEdge &)
place holder
static bool classof(const AddrCGEdge *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: ConsGEdge.h:102
void operator=(const AddrCGEdge &)
place holder
AddrCGEdge()
place holder
static bool classof(const ConstraintEdge *edge)
Definition: ConsGEdge.h:106
ConstraintEdge(ConstraintNode *s, ConstraintNode *d, ConstraintEdgeK k, EdgeID id=0)
Constructor.
Definition: ConsGEdge.h:62
static bool classof(const GenericConsEdgeTy *edge)
ClassOf.
Definition: ConsGEdge.h:75
~ConstraintEdge()
Destructor.
Definition: ConsGEdge.h:66
EdgeID getEdgeID() const
Return edge ID.
Definition: ConsGEdge.h:70
GenericNode< ConstraintNode, ConstraintEdge >::GEdgeSetTy ConstraintEdgeSetTy
Constraint edge type.
Definition: ConsGEdge.h:85
CopyCGEdge()
place holder
static bool classof(const CopyCGEdge *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: ConsGEdge.h:133
void operator=(const CopyCGEdge &)
place holder
static bool classof(const ConstraintEdge *edge)
Definition: ConsGEdge.h:137
CopyCGEdge(ConstraintNode *s, ConstraintNode *d, EdgeID id)
constructor
Definition: ConsGEdge.h:148
CopyCGEdge(const CopyCGEdge &)
place holder
static bool classof(const GenericConsEdgeTy *edge)
Definition: ConsGEdge.h:141
GEdgeKind getEdgeKind() const
Definition: GenericGraph.h:89
static bool classof(const ConstraintEdge *edge)
Definition: ConsGEdge.h:248
GepCGEdge()
place holder
GepCGEdge(ConstraintNode *s, ConstraintNode *d, ConstraintEdgeK k, EdgeID id)
Constructor.
Definition: ConsGEdge.h:235
void operator=(const GepCGEdge &)
place holder
GepCGEdge(const GepCGEdge &)
place holder
static bool classof(const GenericConsEdgeTy *edge)
Definition: ConsGEdge.h:253
static bool classof(const GepCGEdge *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: ConsGEdge.h:244
void operator=(const LoadCGEdge &)
place holder
static bool classof(const LoadCGEdge *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: ConsGEdge.h:201
LoadCGEdge(ConstraintNode *s, ConstraintNode *d, EdgeID id)
Constructor.
Definition: ConsGEdge.h:216
LoadCGEdge()
place holder
LoadCGEdge(const LoadCGEdge &)
place holder
static bool classof(const GenericConsEdgeTy *edge)
Definition: ConsGEdge.h:209
static bool classof(const ConstraintEdge *edge)
Definition: ConsGEdge.h:205
static bool classof(const GenericConsEdgeTy *edge)
Definition: ConsGEdge.h:289
AccessPath ap
Access path of the gep edge.
Definition: ConsGEdge.h:272
NormalGepCGEdge()
place holder
NormalGepCGEdge(const NormalGepCGEdge &)
place holder
static bool classof(const NormalGepCGEdge *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: ConsGEdge.h:277
void operator=(const NormalGepCGEdge &)
place holder
NormalGepCGEdge(ConstraintNode *s, ConstraintNode *d, const AccessPath &ap, EdgeID id)
Constructor.
Definition: ConsGEdge.h:296
const AccessPath & getAccessPath() const
Get location set of the gep edge.
Definition: ConsGEdge.h:303
static bool classof(const GepCGEdge *edge)
Definition: ConsGEdge.h:281
static bool classof(const ConstraintEdge *edge)
Definition: ConsGEdge.h:285
APOffset getConstantFieldIdx() const
Get location set of the gep edge.
Definition: ConsGEdge.h:309
StoreCGEdge(const StoreCGEdge &)
place holder
static bool classof(const GenericConsEdgeTy *edge)
Definition: ConsGEdge.h:175
static bool classof(const ConstraintEdge *edge)
Definition: ConsGEdge.h:171
void operator=(const StoreCGEdge &)
place holder
StoreCGEdge()
place holder
static bool classof(const StoreCGEdge *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: ConsGEdge.h:167
StoreCGEdge(ConstraintNode *s, ConstraintNode *d, EdgeID id)
constructor
Definition: ConsGEdge.h:182
static bool classof(const ConstraintEdge *edge)
Definition: ConsGEdge.h:337
void operator=(const VariantGepCGEdge &)
place holder
static bool classof(const VariantGepCGEdge *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: ConsGEdge.h:329
VariantGepCGEdge(const VariantGepCGEdge &)
place holder
static bool classof(const GenericConsEdgeTy *edge)
Definition: ConsGEdge.h:341
VariantGepCGEdge()
place holder
VariantGepCGEdge(ConstraintNode *s, ConstraintNode *d, EdgeID id)
Constructor.
Definition: ConsGEdge.h:348
static bool classof(const GepCGEdge *edge)
Definition: ConsGEdge.h:333
for isBitcode
Definition: BasicTypes.h:68
GenericEdge< ConstraintNode > GenericConsEdgeTy
Definition: ConsGEdge.h:42
s64_t APOffset
Definition: GeneralType.h:60
u32_t EdgeID
Definition: GeneralType.h:56