From 62178e370f21ddf80766b8e1075c55e0d3945493 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Wed, 17 Apr 2024 01:33:05 -0600 Subject: CFG Skeleton Files --- vaporize/library/SpillEverywhere.java | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 vaporize/library/SpillEverywhere.java (limited to 'vaporize/library/SpillEverywhere.java') 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 extends VInstr.VisitorPR { + + ArrayList vapor; + String vaporm; + + + public SpillEverywhere(ArrayList 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; + } + + } -- cgit v1.2.3