diff options
Diffstat (limited to 'vaporize/library/CFGNode.java')
-rw-r--r-- | vaporize/library/CFGNode.java | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/vaporize/library/CFGNode.java b/vaporize/library/CFGNode.java deleted file mode 100644 index b23ca00..0000000 --- a/vaporize/library/CFGNode.java +++ /dev/null @@ -1,95 +0,0 @@ -package vaporize.library; - -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 HashSet<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.liveness = new HashSet<>(); - this.line = this.instruction.sourcePos.line; - } - - public String toString() { - return this.instruction.toString(); - } - - /** - * For if we only have a line - * number. (VBranch issues) - */ - // FIXME - public boolean equals(Object other) { - return (other instanceof CFGNode && - (((CFGNode) other).instruction == - this.instruction)) || - (other instanceof Node && - (((Node) other).sourcePos == - this.instruction.sourcePos)) || - (other instanceof Integer && - (((Integer) other) - .equals(this.instruction.sourcePos.line))); - } - - protected void addSource(CFGNode node) { - this.sources.add(node); - } - - protected void addDest(CFGNode node) { - 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 void addLiveness(String add) { - MinimalLogger.info(String.format("Use %s at %s", - add, - this.line)); - this.liveness.add(add); - } - - protected Node getInstruction() { - return this.instruction; - } - - protected ArrayList<CFGNode> getSources() { - return this.sources; - } - - protected ArrayList<CFGNode> getDests() { - return this.dests; - } - - protected HashSet<String> getReaching() { - return this.reaching; - } - - protected HashSet<String> getLiveness() { - return this.liveness; - } - - protected int getLine() { - return this.line; - } - - -} |