From c14f3676114df656e5c6c07b49351c74496aaf04 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Wed, 17 Apr 2024 12:22:22 -0600 Subject: Rename Node->NodeCFG to avoid namespace collision --- vaporize/library/CFGSimp.java | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'vaporize/library/CFGSimp.java') diff --git a/vaporize/library/CFGSimp.java b/vaporize/library/CFGSimp.java index 372f926..6ab276a 100644 --- a/vaporize/library/CFGSimp.java +++ b/vaporize/library/CFGSimp.java @@ -7,10 +7,26 @@ import java.util.*; public class CFGSimp extends VInstr.VisitorPR { - ControlFlowGraph cfg; + private ControlFlowGraph cfg; - public CFGSimp(ControlFlowGraph cfg) { - this.cfg = 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 R visit(P p, VMemRead n) throws RuntimeException { @@ -26,6 +42,7 @@ public class CFGSimp extends VInstr.VisitorPR { } public R visit(P p, VBranch n) throws RuntimeException { + // two edges return null; } -- cgit v1.2.3