summaryrefslogtreecommitdiff
path: root/vaporize/library/ControlFlowGraph.java
diff options
context:
space:
mode:
Diffstat (limited to 'vaporize/library/ControlFlowGraph.java')
-rw-r--r--vaporize/library/ControlFlowGraph.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/vaporize/library/ControlFlowGraph.java b/vaporize/library/ControlFlowGraph.java
index b4c995c..2a8caef 100644
--- a/vaporize/library/ControlFlowGraph.java
+++ b/vaporize/library/ControlFlowGraph.java
@@ -33,6 +33,24 @@ public class ControlFlowGraph {
return ret;
}
+ protected CFGNode getNextNode(CFGNode a) {
+ CFGNode ret = null;
+ // we return null if the passed node is the last in the list
+ for (int i = 0; i < this.nodes.size()-1; ++i) {
+ if (this.nodes.get(i).equals(a)) {
+ ret = this.nodes.get(i+1);
+ break;
+ }
+ }
+
+ if (ret == null)
+ MinimalLogger.severe(String.format("Could not find a node matching %s",
+ a.toString()));
+
+ return ret;
+
+ }
+
protected void addNode(CFGNode node) {
this.nodes.add(node);
}
@@ -53,6 +71,9 @@ public class ControlFlowGraph {
source.addDest(dest);
dest.addSource(source);
ret += ";";
+ } else {
+ MinimalLogger.info(String.format("Skipping duplicate edge for %d",
+ source.getInstruction().sourcePos.line));
}
return ret;