diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-15 01:43:59 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-15 01:43:59 -0600 |
commit | 056690e0e60d4d0ce046c171691aa02a7071eeae (patch) | |
tree | 499b93cadf1079bc7d60551971f37f4596c552b5 /vaporize/library | |
parent | 664e7846c0ca942dc94029010b94dcc41d78f492 (diff) |
Some pretty-printer functionality in TotalSpill
Diffstat (limited to 'vaporize/library')
-rw-r--r-- | vaporize/library/TotalSpill.java | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/vaporize/library/TotalSpill.java b/vaporize/library/TotalSpill.java index 9af45ea..cd75712 100644 --- a/vaporize/library/TotalSpill.java +++ b/vaporize/library/TotalSpill.java @@ -8,47 +8,60 @@ import java.util.*; public class TotalSpill<P, R> extends VInstr.VisitorPR<P, R, RuntimeException> { - private void printNode(P p, Node n) { - PrintFilter.print(n.getClass().getSimpleName(), true); - } - public R visit(P p, VMemRead n) throws RuntimeException { - this.printNode(p, n); + PrintFilter.print(String.format("%s (%s)", + n.getClass().getSimpleName(), + n.sourcePos.toString()), true); return null; } public R visit(P p, VMemWrite n) throws RuntimeException { - this.printNode(p, n); + PrintFilter.print(String.format("%s (%s)", + n.getClass().getSimpleName(), + n.sourcePos.toString()), true); return null; } public R visit(P p, VAssign n) throws RuntimeException { - this.printNode(p, n); + PrintFilter.print(String.format("%s (%s)", + n.getClass().getSimpleName(), + n.sourcePos.toString()), true); return null; } public R visit(P p, VBranch n) throws RuntimeException { - this.printNode(p, n); + PrintFilter.print(String.format("%s (%s)", + n.getClass().getSimpleName(), + n.sourcePos.toString()), true); return null; } public R visit(P p, VGoto n) throws RuntimeException { - this.printNode(p, n); + PrintFilter.print(String.format("%s (%s)", + n.getClass().getSimpleName(), + n.sourcePos.toString()), true); return null; } public R visit(P p, VCall n) throws RuntimeException { - this.printNode(p, n); + PrintFilter.print(String.format("%s (%s)", + n.getClass().getSimpleName(), + n.sourcePos.toString()), true); return null; } public R visit(P p, VBuiltIn n) throws RuntimeException { - this.printNode(p, n); + PrintFilter.print(String.format("%s (%s:%s)", + n.getClass().getSimpleName(), + n.op.name, + n.sourcePos.toString()), true); return null; } public R visit(P p, VReturn n) throws RuntimeException { - this.printNode(p, n); + PrintFilter.print(String.format("%s (%s)", + n.getClass().getSimpleName(), + n.sourcePos.toString()), true); return null; } |