summaryrefslogtreecommitdiff
path: root/vaporize/library/CFGNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'vaporize/library/CFGNode.java')
-rw-r--r--vaporize/library/CFGNode.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/vaporize/library/CFGNode.java b/vaporize/library/CFGNode.java
index b79ee6b..9d627a0 100644
--- a/vaporize/library/CFGNode.java
+++ b/vaporize/library/CFGNode.java
@@ -4,18 +4,22 @@ import misc.*;
import cs132.vapor.ast.*;
import java.util.ArrayList;
+import java.util.HashSet;
class CFGNode {
private Node instruction;
private ArrayList<CFGNode> sources;
private ArrayList<CFGNode> dests;
+ private HashSet<String> reaching;
+ private ArrayList<String> liveness;
private int line;
protected CFGNode(Node instruction) {
this.instruction = instruction;
this.sources = new ArrayList<>();
this.dests = new ArrayList<>();
+ this.reaching = new HashSet<>();
this.line = this.instruction.sourcePos.line;
}
@@ -23,10 +27,6 @@ class CFGNode {
return this.instruction.toString();
}
- public int hashCode() {
- return this.line;
- }
-
/**
* For if we only have a line
* number. (VBranch issues)
@@ -52,6 +52,13 @@ class CFGNode {
this.dests.add(node);
}
+ protected void addReaching(String add) {
+ MinimalLogger.info(String.format("Def %s at %s",
+ add,
+ this.line));
+ this.reaching.add(add);
+ }
+
protected Node getInstruction() {
return this.instruction;
}
@@ -64,4 +71,13 @@ class CFGNode {
return this.dests;
}
+ protected HashSet<String> getReaching() {
+ return this.reaching;
+ }
+
+ protected int getLine() {
+ return this.line;
+ }
+
+
}