diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-20 23:43:30 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-20 23:43:30 -0600 |
commit | 04fd097fb51346f655c7bdc0c88b85e29359ef1c (patch) | |
tree | 246fb653f11e61306cb66249f4ecce451f7b8953 /vaporize/library/SpillEverywhere.java | |
parent | 35eae1492c94e353ba8a1a52bfbae9313808b357 (diff) |
Non-function live-interval computation algorithm
Diffstat (limited to 'vaporize/library/SpillEverywhere.java')
-rw-r--r-- | vaporize/library/SpillEverywhere.java | 54 |
1 files changed, 20 insertions, 34 deletions
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<String, String, RuntimeExc private VaporProgram vp; private Kettle kettle; - private String vaporm; - - // public CFGSimp(VaporProgram v) { - - // // 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 SpillEverywhere(VaporProgram vp, ArrayList<String> 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; } |