diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-20 13:23:01 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-20 13:23:01 -0600 |
commit | b320d02e1dbfa255ac0c919e37f89aa0108edaa5 (patch) | |
tree | 2c9660327a0b944cf2779ae45b9c1de825d9a9c5 /vaporize/library/CFGSimp.java | |
parent | c5ec4e0c84e5199d5a5ad418a0480749fcf17bab (diff) |
Implement partial reachable tracking in CFG
Diffstat (limited to 'vaporize/library/CFGSimp.java')
-rw-r--r-- | vaporize/library/CFGSimp.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/vaporize/library/CFGSimp.java b/vaporize/library/CFGSimp.java index f85c198..4456d39 100644 --- a/vaporize/library/CFGSimp.java +++ b/vaporize/library/CFGSimp.java @@ -52,6 +52,12 @@ public class CFGSimp extends VInstr.VisitorPR<ControlFlowGraph, String, RuntimeE for (VInstr s : f.body) s.accept(cfg, this); + MinimalLogger.info(String.format("Spitting out reaching...")); + for (CFGNode n : cfg.getNodes()) + MinimalLogger.info(String.format("%d ::: %s", + n.getLine(), + n.getReaching())); + if (this.use_graphviz) this.createDotGraph(this.kettle.parseFuncName(f)); @@ -89,6 +95,8 @@ public class CFGSimp extends VInstr.VisitorPR<ControlFlowGraph, String, RuntimeE CFGNode curr = cfg.getNode(n); this.dot_format += cfg.addEdge(this.curr, curr); this.curr = curr; + + curr.addReaching(n.dest.toString()); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (\"%s\":%s)", n.getClass().getSimpleName(), @@ -123,6 +131,8 @@ public class CFGSimp extends VInstr.VisitorPR<ControlFlowGraph, String, RuntimeE CFGNode curr = cfg.getNode(n); this.dot_format += cfg.addEdge(this.curr, curr); this.curr = curr; + + curr.addReaching(n.dest.toString()); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (\"%s\":%s)", n.getClass().getSimpleName(), @@ -163,8 +173,6 @@ public class CFGSimp extends VInstr.VisitorPR<ControlFlowGraph, String, RuntimeE cfg.getNode(new Integer(this.kettle .findLabelIndex(n.target.toString())))); - MinimalLogger.info(String.format("curr is now %s", - this.kettle.get(n).trim())); this.curr = cfg.getNextNode(curr); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (\"%s\":%s)", @@ -183,6 +191,9 @@ public class CFGSimp extends VInstr.VisitorPR<ControlFlowGraph, String, RuntimeE CFGNode curr = cfg.getNode(n); this.dot_format += cfg.addEdge(this.curr, curr); this.curr = curr; + + if (n.dest != null) + curr.addReaching(n.dest.toString()); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (\"%s\":%s)", n.getClass().getSimpleName(), @@ -200,6 +211,9 @@ public class CFGSimp extends VInstr.VisitorPR<ControlFlowGraph, String, RuntimeE CFGNode curr = cfg.getNode(n); this.dot_format += cfg.addEdge(this.curr, curr); this.curr = curr; + + if (n.dest != null) + curr.addReaching(n.dest.toString()); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (\"%s\":%s)", n.getClass().getSimpleName(), |