From 04fd097fb51346f655c7bdc0c88b85e29359ef1c Mon Sep 17 00:00:00 2001 From: bd-912 Date: Sat, 20 Apr 2024 23:43:30 -0600 Subject: Non-function live-interval computation algorithm --- vaporize/library/SpillEverywhere.java | 54 +++++++++++++---------------------- 1 file changed, 20 insertions(+), 34 deletions(-) (limited to 'vaporize/library/SpillEverywhere.java') diff --git a/vaporize/library/SpillEverywhere.java b/vaporize/library/SpillEverywhere.java index d6671bf..993bfa6 100644 --- a/vaporize/library/SpillEverywhere.java +++ b/vaporize/library/SpillEverywhere.java @@ -9,96 +9,82 @@ public class SpillEverywhere extends VInstr.VisitorPR vapor) { this.vp = vp; this.kettle = new Kettle(vapor); - this.vaporm = ""; - for (VFunction f : vp.functions) { + for (VFunction f : this.vp.functions) { + MinimalLogger.severe("Num : " + Arrays.toString(f.vars)); + this.kettle.replaceFunctionDeclare(f, 0, 0, 3); // use three registers for "spill everywhere" for (VInstr s : f.body) { s.accept("", this); } - this.kettle.replaceFunctionDeclare(f, 0, 0, 0); } MinimalLogger.info(kettle.dump()); } + public String visit(String p, VMemRead n) throws RuntimeException { - MinimalLogger.info(String.format("%s (%s:%s)", + MinimalLogger.info(String.format("->%s (%s:%s)", n.getClass().getSimpleName(), - this.kettle.get(n), + this.kettle.get(n).trim(), n.sourcePos.toString())); return null; } public String visit(String p, VMemWrite n) throws RuntimeException { - System.out.println("HEY!"); - MinimalLogger.info(String.format("%s (%s:%s)", + MinimalLogger.info(String.format("->%s (%s:%s)", n.getClass().getSimpleName(), - this.kettle.get(n), + this.kettle.get(n).trim(), n.sourcePos.toString())); return null; } public String visit(String p, VAssign n) throws RuntimeException { - MinimalLogger.info(String.format("%s (%s:%s)", + MinimalLogger.info(String.format("->%s (%s:%s)", n.getClass().getSimpleName(), - this.kettle.get(n), + this.kettle.get(n).trim(), n.sourcePos.toString())); return null; } public String visit(String p, VBranch n) throws RuntimeException { - MinimalLogger.info(String.format("%s (%s:%s)", + MinimalLogger.info(String.format("->%s (%s:%s)", n.getClass().getSimpleName(), - this.kettle.get(n), + this.kettle.get(n).trim(), n.sourcePos.toString())); return null; } public String visit(String p, VGoto n) throws RuntimeException { - MinimalLogger.info(String.format("%s (%s:%s)", + MinimalLogger.info(String.format("->%s (%s:%s)", n.getClass().getSimpleName(), - this.kettle.get(n), + this.kettle.get(n).trim(), n.sourcePos.toString())); return null; } public String visit(String p, VCall n) throws RuntimeException { - MinimalLogger.info(String.format("%s (%s:%s)", + MinimalLogger.info(String.format("->%s (%s:%s)", n.getClass().getSimpleName(), - this.kettle.get(n), + this.kettle.get(n).trim(), n.sourcePos.toString())); return null; } public String visit(String p, VBuiltIn n) throws RuntimeException { - MinimalLogger.info(String.format("%s (%s:%s)", + MinimalLogger.info(String.format("->%s (%s:%s)", n.op.name, - this.kettle.get(n), + this.kettle.get(n).trim(), n.sourcePos.toString())); return null; } public String visit(String p, VReturn n) throws RuntimeException { - MinimalLogger.info(String.format("%s (%s:%s)", + MinimalLogger.info(String.format("->%s (%s:%s)", n.getClass().getSimpleName(), - this.kettle.get(n), + this.kettle.get(n).trim(), n.sourcePos.toString())); return null; } -- cgit v1.2.3