summaryrefslogtreecommitdiff
path: root/vaporize/library/SpillEverywhere.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-17 01:33:05 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-17 01:33:05 -0600
commit62178e370f21ddf80766b8e1075c55e0d3945493 (patch)
tree13fcfc0d7177e578020366e905b71ca48e0857f0 /vaporize/library/SpillEverywhere.java
parentf08708ee07931db592ffb76c073bd80bcf6cf060 (diff)
CFG Skeleton Files
Diffstat (limited to 'vaporize/library/SpillEverywhere.java')
-rw-r--r--vaporize/library/SpillEverywhere.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/vaporize/library/SpillEverywhere.java b/vaporize/library/SpillEverywhere.java
new file mode 100644
index 0000000..aa8368f
--- /dev/null
+++ b/vaporize/library/SpillEverywhere.java
@@ -0,0 +1,84 @@
+package vaporize.library;
+
+import cs132.vapor.ast.*;
+import st.*;
+import misc.*;
+import java.util.*;
+
+public class SpillEverywhere<P, R> extends VInstr.VisitorPR<P, R, RuntimeException> {
+
+ ArrayList<String> vapor;
+ String vaporm;
+
+
+ public SpillEverywhere(ArrayList<String> vapor) {
+ this.vapor = vapor;
+ this.vaporm = "";
+ }
+
+ public R visit(P p, VMemRead n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VMemWrite n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VAssign n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VBranch n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ System.out.println("NEXT: " +
+ return null;
+ }
+
+ public R visit(P p, VGoto n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VCall n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VBuiltIn n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.op.name,
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ public R visit(P p, VReturn n) throws RuntimeException {
+ PrintFilter.print(String.format("%s (%s:%s)",
+ n.getClass().getSimpleName(),
+ this.vapor.get(n.sourcePos.line-1),
+ n.sourcePos.toString()), true);
+ return null;
+ }
+
+ }