From 38ef4ec52804876ba0a3daef3a2d1817f17bc1e5 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Sat, 20 Apr 2024 17:09:21 -0600 Subject: Fix minor bugs in Liveness computation --- vaporize/library/CFGSimp.java | 63 ++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'vaporize/library') diff --git a/vaporize/library/CFGSimp.java b/vaporize/library/CFGSimp.java index 76d5acd..54ec61c 100644 --- a/vaporize/library/CFGSimp.java +++ b/vaporize/library/CFGSimp.java @@ -11,32 +11,32 @@ public class CFGSimp extends VInstr.VisitorPR cfgs; - private CFGNode curr; + private VFunction func; // the current function being processed + private CFGNode curr; // the current node being processed private String dot_format; // a list of edges to be processed by graphviz public CFGSimp(VaporProgram vp, ArrayList vapor) { - this.vp = vp; this.kettle = new Kettle(vapor); this.cfgs = new ArrayList(); this.curr = null; - for (VFunction f : this.vp.functions) { + for (VFunction f : vp.functions) { + this.func = f; ControlFlowGraph cfg = new ControlFlowGraph(); this.dot_format = ""; MinimalLogger.info(String.format("CFGSimp is collecting nodes for %s", - this.kettle.parseFuncName(f))); - for (VCodeLabel s : f.labels) { + this.kettle.parseFuncName(this.func))); + for (VCodeLabel s : this.func.labels) { MinimalLogger.info(String.format("Label %d \"%s\"", s.sourcePos.line, this.kettle.get(s).trim())); cfg.addNode(new CFGNode(s)); } - for (VInstr s : f.body) { + for (VInstr s : this.func.body) { MinimalLogger.info(String.format(" Body %d \"%s\"", s.sourcePos.line, this.kettle.get(s).trim())); @@ -54,7 +54,7 @@ public class CFGSimp extends VInstr.VisitorPR%s (\"%s\":%s)", n.getClass().getSimpleName(), @@ -103,8 +112,9 @@ public class CFGSimp extends VInstr.VisitorPR