Static Value-Flow Analysis
Loading...
Searching...
No Matches
CSC.h
Go to the documentation of this file.
1//===- CSC.h -- Cycle Stride Calculation algorithm---------------------------------------//
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 * CSC.h
25 *
26 * Created on: 09, Feb, 2019
27 * Author: Yuxiang Lei
28 */
29
30#ifndef PROJECT_CSC_H
31#define PROJECT_CSC_H
32
33#include "Graphs/ConsG.h"
34#include "Graphs/SCC.h"
35#include "SVFIR/SVFValue.h" // for NodeBS
36#include "Util/WorkList.h"
37#include <limits.h>
38#include <map>
39#include <stack>
40
41namespace SVF
42{
43
45
49class CSC
50{
51public:
54 typedef typename IdToIdMap::iterator iterator;
55
56private:
59
61 IdToIdMap _D; // the sum of weight of a path relevant to a certain node, while accessing the node via DFS
62 NodeStack _S; // a stack holding a DFS branch
63 NodeSet _visited; // a set holding visited nodes
64// NodeStrides nodeStrides;
65// IdToIdMap pwcReps;
66
67public:
69 : _consG(g), _scc(c), _I(0) {}
70
71 void find(NodeStack& candidates);
72 void visit(NodeID nodeId, s32_t _w);
73 void clear();
74
76 {
77 return _visited.find(nId) != _visited.end();
78 }
79
81 {
82 _visited.insert(nId);
83 }
84// inline iterator begin() { return pwcReps.begin(); }
85//
86// inline iterator end() { return pwcReps.end(); }
87
88// NodeStrides &getNodeStrides() { return nodeStrides; }
89
90// const NodeSet& getPWCReps() const { return _pwcReps; }
91};
92
93} // End namespace SVF
94
95#endif //PROJECT_CSC_H
Definition CSC.h:50
FILOWorkList< NodeID > WorkStack
Definition CSC.h:53
void find(NodeStack &candidates)
Definition CSC.cpp:49
IdToIdMap _D
Definition CSC.h:61
void visit(NodeID nodeId, s32_t _w)
Definition CSC.cpp:76
bool isVisited(NodeID nId)
Definition CSC.h:75
Map< NodeID, NodeID > IdToIdMap
Definition CSC.h:52
NodeStack _S
Definition CSC.h:62
CSC(ConstraintGraph *g, CGSCC *c)
Definition CSC.h:68
ConstraintGraph * _consG
Definition CSC.h:57
IdToIdMap::iterator iterator
Definition CSC.h:54
NodeSet _visited
Definition CSC.h:63
void clear()
Definition CSC.cpp:39
CGSCC * _scc
Definition CSC.h:58
void setVisited(NodeID nId)
Definition CSC.h:80
NodeID _I
Definition CSC.h:60
for isBitcode
Definition BasicTypes.h:68
std::stack< NodeID > NodeStack
SCCDetection< ConstraintGraph * > CGSCC
Definition CSC.h:44
Set< NodeID > NodeSet
u32_t NodeID
Definition GeneralType.h:55
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
signed s32_t
Definition GeneralType.h:47