Static Value-Flow Analysis
Loading...
Searching...
No Matches
SparseObjGraph.h
Go to the documentation of this file.
1//===- SparseObjGraph.h - Static packed Obj value-flow routes -------------===//
2
3#ifndef INCLUDE_GRAPHS_SPARSEOBJGRAPH_H_
4#define INCLUDE_GRAPHS_SPARSEOBJGRAPH_H_
5
6#include "Graphs/ICFG.h"
7
8namespace SVF
9{
10
11class PointerAnalysis;
12class SVFIR;
13class SVFG;
14class SparseObjNode;
15
17
20{
21public:
23 : GenericSparseObjEdgeTy(source, target, 0) {}
24
25 std::string toString() const;
26};
27
29
34{
35public:
40
44
45 const ICFGNode* getICFGNode() const
46 {
47 return location;
48 }
49 std::string toString() const;
50};
51
53
61{
62public:
65
67 SparseObjGraph(const SVFG& svfg, ICFG& icfg,
68 PointerAnalysis& pta, const SVFIR& svfir);
71
73 const std::vector<const Edge*>& getInputs(const ICFGNode* node) const;
75 std::string toString() const;
77 void dump(const std::string& file);
78
79private:
80 bool isBranch(const ICFGNode* node) const;
81 Node* getOrCreateBaseObjNode(NodeID baseObjId, const ICFGNode* location);
82 Node* getBranchNode(NodeID base, const IntraCFGEdge* branch);
83 void addRouteEdge(Node* source, Node* target);
84 void addEdge(NodeID base, const ICFGNode* source,
85 const ICFGNode* target, const IntraCFGEdge* branch);
86 void connectFrom(NodeID base, const ICFGNode* source,
87 const Set<const ICFGNode*>& events,
88 Set<const ICFGNode*>& newSources);
89
99};
100
101} // namespace SVF
102
103namespace SVF
104{
105
106template<>
112
113template<>
118
119template<>
125
126} // namespace SVF
127
128#endif
NodeID id
Node ID.
Definition SVFValue.h:204
An edge carries the source packed Obj to the target ICFG location.
SparseObjEdge(SparseObjNode *source, SparseObjNode *target)
std::string toString() const
const std::vector< const Edge * > & getInputs(const ICFGNode *node) const
Return incoming edges at this ICFG location for client-side value flow.
bool isBranch(const ICFGNode *node) const
SparseObjGraph & operator=(const SparseObjGraph &)=delete
Map< const ICFGNode *, std::vector< const Edge * > > inputs
Node * getOrCreateBaseObjNode(NodeID baseObjId, const ICFGNode *location)
Map< const ICFGNode *, Set< NodeID > > returnedGroups
Map< NodeID, Map< const ICFGNode *, Node * > > groupNodes
Normal nodes are unique by (base, ICFG location); branch nodes by edge.
SparseObjGraph(const SVFG &svfg, ICFG &icfg, PointerAnalysis &pta, const SVFIR &svfir)
Construction uses static graphs and points-to results, not AE state.
void connectFrom(NodeID base, const ICFGNode *source, const Set< const ICFGNode * > &events, Set< const ICFGNode * > &newSources)
Map< const ICFGNode *, Map< const FunObjVar *, Set< NodeID > > > returnedGroupsByCallee
std::string toString() const
Describe the static nodes and edges as text, without AE values.
Map< NodeID, Map< const IntraCFGEdge *, Node * > > branchNodes
void addEdge(NodeID base, const ICFGNode *source, const ICFGNode *target, const IntraCFGEdge *branch)
SparseObjGraph(const SparseObjGraph &)=delete
Node * getBranchNode(NodeID base, const IntraCFGEdge *branch)
void addRouteEdge(Node *source, Node *target)
void dump(const std::string &file)
Write a DOT graph to <file>.dot through GraphPrinter.
const IntraCFGEdge * branch
const ICFGNode * location
std::string toString() const
const ICFGNode * getICFGNode() const
SparseObjNode(NodeID id, NodeID base, const ICFGNode *location, const IntraCFGEdge *branch)
for isBitcode
Definition BasicTypes.h:70
u32_t NodeID
Definition GeneralType.h:76
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition GeneralType.h:51
GenericGraph< SparseObjNode, SparseObjEdge > GenericSparseObjGraphTy
GenericNode< SparseObjNode, SparseObjEdge > GenericSparseObjNodeTy
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
Definition GeneralType.h:56
GenericEdge< SparseObjNode > GenericSparseObjEdgeTy