30#ifndef INCLUDE_CFL_CFLSolver_H_
31#define INCLUDE_CFL_CFLSolver_H_
120 typedef std::map<const Label, NodeBS>
TypeMap;
121 typedef std::unordered_map<NodeID, TypeMap>
DataMap;
134 return predMap[key][ty].test_and_set(src);
139 return succMap[key][ty].test_and_set(dst);
146 return predMap[key][ty] |= data;
153 return succMap[key][ty] |= data;
228 for (
const NodeID datum: dstData)
241 for (
const NodeID datum: srcData)
255 auto iter2 = iter1->second.find(ty);
256 if (iter2 == iter1->second.end())
259 return iter2->second.test(dst);
345 void meld_h(
NodeID x, TreeNode* uNode, TreeNode* vNode);
356 for (
auto iter2: iter1.second)
371 void meld(
NodeID x, TreeNode* uNode, TreeNode* vNode);
bool isInWorklist(const CFLEdge *item)
FIFOWorkList< const CFLEdge * > WorkList
Define worklist.
WorkList worklist
Worklist for resolution.
virtual void solve()
Start solving.
const CFLGraph * getGraph() const
Return CFL Graph.
static double numOfChecks
virtual void processCFLEdge(const CFLEdge *Y_edge)
Process CFLEdge.
virtual void initialize()
Initialize worklist.
CFGrammar::Production Production
const CFGrammar * getGrammar() const
Return CFL Grammar.
virtual bool pushIntoWorklist(const CFLEdge *item)
virtual bool isWorklistEmpty()
const CFLEdge * popFromWorklist()
Worklist operations.
CFLSolver(CFLGraph *_graph, CFGrammar *_grammar)
std::vector< Symbol > Production
TreeNode * getNode_h(NodeID src, NodeID dst)
Get the node dst in tree(src).
void insertEdge_h(TreeNode *u, TreeNode *v)
add v into desc(x) as a child of u
virtual void initialize()
Initialize worklist.
POCRHybridSolver(CFLGraph *_graph, CFGrammar *_grammar)
void meld(NodeID x, TreeNode *uNode, TreeNode *vNode)
void meld_h(NodeID x, TreeNode *uNode, TreeNode *vNode)
bool hasInd_h(NodeID src, NodeID dst)
void addArc_h(NodeID src, NodeID dst)
void addArc(NodeID src, NodeID dst)
TreeNode * addInd_h(NodeID src, NodeID dst)
Add a node dst to tree(src).
Map< NodeID, std::unordered_map< NodeID, TreeNode * > > indMap
virtual ~POCRHybridSolver()
Destructor.
virtual void processCFLEdge(const CFLEdge *Y_edge)
Process CFLEdge.
DataMap::const_iterator const_iterator
void clearEdges(const NodeID key)
TypeMap & getPredMap(const NodeID key)
bool addPred(const NodeID key, const NodeID src, const Label ty)
bool hasEdge(const NodeID src, const NodeID dst, const Label ty)
find src -> find src[ty] -> find dst in set
virtual ~POCRSolver()
Destructor.
DataMap::iterator iterator
virtual void processCFLEdge(const CFLEdge *Y_edge)
Process CFLEdge.
TypeMap & getSuccMap(const NodeID key)
NodeBS & getSuccs(const NodeID key, const Label ty)
NodeBS addEdges(const NodeID src, const NodeBS &dstData, const Label ty)
add edges and return the set of added edges (dst) for src
const_iterator begin() const
bool addSucc(const NodeID key, const NodeID dst, const Label ty)
NodeBS addEdges(const NodeBS &srcData, const NodeID dst, const Label ty)
add edges and return the set of added edges (src) for dst
std::map< const Label, NodeBS > TypeMap
POCRSolver(CFLGraph *_graph, CFGrammar *_grammar)
NodeBS & getPreds(const NodeID key, const Label ty)
bool addEdge(const NodeID src, const NodeID dst, const Label ty)
std::unordered_map< NodeID, TypeMap > DataMap
bool addPreds(const NodeID key, const NodeBS &data, const Label ty)
const_iterator end() const
bool addSuccs(const NodeID key, const NodeBS &data, const Label ty)
virtual void initialize()
Initialize worklist.
virtual void buildCFLData()
Init CFLData.
GrammarBase::Symbol Label
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
bool operator==(const TreeNode &rhs) const
bool operator<(const TreeNode &rhs) const
std::unordered_set< TreeNode * > children