/** * Returns a <code>String</code> representation. */ @Override public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("Node[pos=").append(block().position()); sbuf.append(", parent="); sbuf.append(parent == null ? "*" : Integer.toString(parent.block().position())); sbuf.append(", children{"); for (int i = 0; i < children.length; i++) sbuf.append(children[i].block().position()).append(", "); sbuf.append("}]"); return sbuf.toString(); }
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) counter = nodes[i].makeDepth1stTree(null, visited, counter, distance, access); for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) if (nodes[i].makeDominatorTree(visited, distance, access)) changed = true; } while (changed);
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) counter = nodes[i].makeDepth1stTree(null, visited, counter, distance, access); for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) if (nodes[i].makeDominatorTree(visited, distance, access)) changed = true; } while (changed);
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) counter = nodes[i].makeDepth1stTree(null, visited, counter, distance, access); for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) if (nodes[i].makeDominatorTree(visited, distance, access)) changed = true; } while (changed);
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; BasicBlock[] entrances(Node n) { return n.block.entrances; } }; nodes[0].makeDepth1stTree(null, visited, 0, distance, access); do { for (int i = 0; i < size; i++) visited[i] = false; } while (nodes[0].makeDominatorTree(visited, distance, access)); Node.setChildren(nodes); return nodes;
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; BasicBlock[] entrances(Node n) { return n.block.entrances; } }; nodes[0].makeDepth1stTree(null, visited, 0, distance, access); do { for (int i = 0; i < size; i++) visited[i] = false; } while (nodes[0].makeDominatorTree(visited, distance, access)); Node.setChildren(nodes); return nodes;
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; BasicBlock[] entrances(Node n) { return n.block.entrances; } }; nodes[0].makeDepth1stTree(null, visited, 0, distance, access); do { for (int i = 0; i < size; i++) visited[i] = false; } while (nodes[0].makeDominatorTree(visited, distance, access)); Node.setChildren(nodes); return nodes;
boolean makeDominatorTree(boolean[] visited, int[] distance, Access access) { int index = block.index; if (visited[index]) return false; visited[index] = true; boolean changed = false; BasicBlock[] exits = access.exits(this); if (exits != null) for (int i = 0; i < exits.length; i++) { Node n = access.node(exits[i]); if (n.makeDominatorTree(visited, distance, access)) changed = true; } BasicBlock[] entrances = access.entrances(this); if (entrances != null) for (int i = 0; i < entrances.length; i++) { if (parent != null) { Node n = getAncestor(parent, access.node(entrances[i]), distance); if (n != parent) { parent = n; changed = true; } } } return changed; }
boolean makeDominatorTree(boolean[] visited, int[] distance, Access access) { int index = block.index; if (visited[index]) return false; visited[index] = true; boolean changed = false; BasicBlock[] exits = access.exits(this); if (exits != null) for (int i = 0; i < exits.length; i++) { Node n = access.node(exits[i]); if (n.makeDominatorTree(visited, distance, access)) changed = true; } BasicBlock[] entrances = access.entrances(this); if (entrances != null) for (int i = 0; i < entrances.length; i++) { if (parent != null) { Node n = getAncestor(parent, access.node(entrances[i]), distance); if (n != parent) { parent = n; changed = true; } } } return changed; }
boolean makeDominatorTree(boolean[] visited, int[] distance, Access access) { int index = block.index; if (visited[index]) return false; visited[index] = true; boolean changed = false; BasicBlock[] exits = access.exits(this); if (exits != null) for (int i = 0; i < exits.length; i++) { Node n = access.node(exits[i]); if (n.makeDominatorTree(visited, distance, access)) changed = true; } BasicBlock[] entrances = access.entrances(this); if (entrances != null) for (int i = 0; i < entrances.length; i++) { if (parent != null) { Node n = getAncestor(parent, access.node(entrances[i]), distance); if (n != parent) { parent = n; changed = true; } } } return changed; }
int makeDepth1stTree(Node caller, boolean[] visited, int counter, int[] distance, Access access) { int index = block.index; if (visited[index]) return counter; visited[index] = true; parent = caller; BasicBlock[] exits = access.exits(this); if (exits != null) for (int i = 0; i < exits.length; i++) { Node n = access.node(exits[i]); counter = n.makeDepth1stTree(this, visited, counter, distance, access); } distance[index] = counter++; return counter; }
int makeDepth1stTree(Node caller, boolean[] visited, int counter, int[] distance, Access access) { int index = block.index; if (visited[index]) return counter; visited[index] = true; parent = caller; BasicBlock[] exits = access.exits(this); if (exits != null) for (int i = 0; i < exits.length; i++) { Node n = access.node(exits[i]); counter = n.makeDepth1stTree(this, visited, counter, distance, access); } distance[index] = counter++; return counter; }
/** * Returns a <code>String</code> representation. */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("Node[pos=").append(block().position()); sbuf.append(", parent="); sbuf.append(parent == null ? "*" : Integer.toString(parent.block().position())); sbuf.append(", children{"); for (int i = 0; i < children.length; i++) sbuf.append(children[i].block().position()).append(", "); sbuf.append("}]"); return sbuf.toString(); }
int makeDepth1stTree(Node caller, boolean[] visited, int counter, int[] distance, Access access) { int index = block.index; if (visited[index]) return counter; visited[index] = true; parent = caller; BasicBlock[] exits = access.exits(this); if (exits != null) for (int i = 0; i < exits.length; i++) { Node n = access.node(exits[i]); counter = n.makeDepth1stTree(this, visited, counter, distance, access); } distance[index] = counter++; return counter; }
/** * Returns a <code>String</code> representation. */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("Node[pos=").append(block().position()); sbuf.append(", parent="); sbuf.append(parent == null ? "*" : Integer.toString(parent.block().position())); sbuf.append(", children{"); for (int i = 0; i < children.length; i++) sbuf.append(children[i].block().position()).append(", "); sbuf.append("}]"); return sbuf.toString(); }
/** * Returns a <code>String</code> representation. */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("Node[pos=").append(block().position()); sbuf.append(", parent="); sbuf.append(parent == null ? "*" : Integer.toString(parent.block().position())); sbuf.append(", children{"); for (int i = 0; i < children.length; i++) sbuf.append(children[i].block().position()).append(", "); sbuf.append("}]"); return sbuf.toString(); }
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) counter = nodes[i].makeDepth1stTree(null, visited, counter, distance, access); for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) if (nodes[i].makeDominatorTree(visited, distance, access)) changed = true; } while (changed);
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; BasicBlock[] entrances(Node n) { return n.block.entrances; } }; nodes[0].makeDepth1stTree(null, visited, 0, distance, access); do { for (int i = 0; i < size; i++) visited[i] = false; } while (nodes[0].makeDominatorTree(visited, distance, access)); Node.setChildren(nodes); return nodes;
boolean makeDominatorTree(boolean[] visited, int[] distance, Access access) { int index = block.index; if (visited[index]) return false; visited[index] = true; boolean changed = false; BasicBlock[] exits = access.exits(this); if (exits != null) for (int i = 0; i < exits.length; i++) { Node n = access.node(exits[i]); if (n.makeDominatorTree(visited, distance, access)) changed = true; } BasicBlock[] entrances = access.entrances(this); if (entrances != null) for (int i = 0; i < entrances.length; i++) { if (parent != null) { Node n = getAncestor(parent, access.node(entrances[i]), distance); if (n != parent) { parent = n; changed = true; } } } return changed; }
int[] distance = new int[size]; for (int i = 0; i < size; i++) { nodes[i] = new Node(basicBlocks[i]); visited[i] = false; for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) counter = nodes[i].makeDepth1stTree(null, visited, counter, distance, access); for (int i = 0; i < size; i++) if (nodes[i].block.exits() == 0) if (nodes[i].makeDominatorTree(visited, distance, access)) changed = true; } while (changed);