1 #include <featureTests.h>
2 #ifdef ROSE_ENABLE_SOURCE_ANALYSIS
7 #include "DataflowCFG.h"
19 #include "tbb/concurrent_hash_map.h"
20 #include "tbb/atomic.h"
74 class NodeStateHashCompare
77 NodeStateHashCompare() {}
78 NodeStateHashCompare(
const NodeStateHashCompare & that) {}
80 ~NodeStateHashCompare(){}
88 static size_t hash(
const Analysis* k ) {
return (
size_t) k; }
95 typedef tbb::concurrent_hash_map <Analysis*, std::vector<Lattice*>, NodeStateHashCompare > LatticeMap;
97 typedef tbb::concurrent_hash_map <Analysis*, std::vector<NodeFact*>, NodeStateHashCompare > NodeFactMap;
98 typedef tbb::concurrent_hash_map <Analysis*, bool, NodeStateHashCompare > BoolMap;
100 typedef std::map<Analysis*, std::vector<Lattice*> > LatticeMap;
102 typedef std::map<Analysis*, std::vector<NodeFact*> > NodeFactMap;
103 typedef std::map<Analysis*, bool > BoolMap;
108 LatticeMap dfInfoAbove;
112 LatticeMap dfInfoBelow;
120 BoolMap initializedAnalyses;
175 void initialized(
Analysis* analysis);
178 bool isInitialized(
Analysis* analysis);
186 void setLattices(
const Analysis* analysis, std::vector<Lattice*>& lattices);
187 void setLatticeAbove(
const Analysis* analysis, std::vector<Lattice*>& lattices);
188 void setLatticeBelow(
const Analysis* analysis, std::vector<Lattice*>& lattices);
191 Lattice* getLatticeAbove(
const Analysis* analysis,
int latticeName)
const;
193 Lattice* getLatticeBelow(
const Analysis* analysis,
int latticeName)
const;
197 static const std::vector<Lattice*>& getLatticeAbove(
const Analysis* analysis,
SgNode* n,
unsigned int index ) ;
201 static const std::vector<Lattice*>& getLatticeBelow(
const Analysis* analysis,
SgNode* n,
unsigned int index) ;
206 const std::vector<Lattice*>& getLatticeAbove(
const Analysis* analysis)
const;
209 const std::vector<Lattice*>& getLatticeBelow(
const Analysis* analysis)
const;
213 std::vector<Lattice*>& getLatticeAboveMod(
const Analysis* analysis);
216 std::vector<Lattice*>& getLatticeBelowMod(
const Analysis* analysis);
219 void deleteLatticeAbove(
const Analysis* analysis);
222 void deleteLatticeBelow(
const Analysis* analysis);
225 static bool eqLattices(
const std::vector<Lattice*>& latticesA,
226 const std::vector<Lattice*>& latticesB);
235 void unionLattices(std::set<Analysis*>& unionSet,
const Analysis* master);
246 Lattice* getLattice_ex(
const LatticeMap& dfMap,
247 const Analysis* analysis,
int latticeName)
const;
263 void setFacts(
const Analysis* analysis,
const std::vector<NodeFact*>& newFacts);
271 const std::vector<NodeFact*>& getFacts(
const Analysis* analysis)
const;
276 std::vector<NodeFact*>& getFactsMod(
const Analysis* analysis);
283 void deleteFacts(
const Analysis* analysis);
286 void deleteState(
const Analysis* analysis);
290 static std::map<DataflowNode, std::vector<NodeState*> > nodeStateMap;
291 static bool nodeStateMapInit;
305 static const std::vector<NodeState*> getNodeStates(
const DataflowNode& n);
312 static void initNodeStateMap(
bool (*filter) (
CFGNode cfgn));
353 static void copyLattices(std::vector<Lattice*>& dfInfoX,
const std::vector<Lattice*>& dfInfoY);
358 std::string str(
Analysis* analysis, std::string indent=
"")
const;