package vaporize.library; import cs132.vapor.ast.*; import st.*; import misc.*; import java.util.*; public class CFGSimp extends VInstr.VisitorPR { private ControlFlowGraph cfg; public CFGSimp(VFunction n) { this.cfg = new ControlFlowGraph(); CFGNode start = new CFGNode(n.body[0]); this.cfg.setStart(start); // nodes for (VInstr s : n.body) this.cfg.addNode(new CFGNode(s)); // edges for (VInstr s : n.body) s.accept("", this); System.out.println(this.cfg.getNodes().toString()); } public ControlFlowGraph getCFG() { return this.cfg; } public String visit(String p, VMemRead n) throws RuntimeException { return null; } public String visit(String p, VMemWrite n) throws RuntimeException { return null; } public String visit(String p, VAssign n) throws RuntimeException { return null; } public String visit(String p, VBranch n) throws RuntimeException { // two edges return null; } public String visit(String p, VGoto n) throws RuntimeException { return null; } public String visit(String p, VCall n) throws RuntimeException { return null; } public String visit(String p, VBuiltIn n) throws RuntimeException { return null; } public String visit(String p, VReturn n) throws RuntimeException { return null; } }