private static void insertEdgesToSinkDFS(final FlowGraph graph,
			final Block block, final BitSet visited, final BitSet returned,
			final Map preds, boolean reverse) {
		boolean leaf = true; // Is a vertex a leaf node?

		// Get the successors of block
		final Iterator e = graph.succs(block).iterator();

		while (e.hasNext()) {
			final Block succ = (Block) e.next();

			// Determine index of succ vertex in a pre-order traversal
			final int index = graph.preOrderIndex(succ);
			Assert.isTrue(index >= 0, "Unreachable block " + succ);

			if (!visited.get(index)) {
				// If the successor block hasn't been visited, visit it
				visited.set(index);
				DominatorTree.insertEdgesToSinkDFS(graph, succ, visited,
						returned, preds, reverse);
				returned.set(index);
				leaf = false;

			} else if (returned.get(index)) {
				// Already visited and returned, so a descendent of succ
				// has an edge to the sink.
				leaf = false;
			}
		}

		if (leaf && (block != graph.sink())) {
			// If we're dealing with a leaf node that is not the sink, set
			// up its predacessor set.

			if (!reverse) {
				// If we're going forwards (computing dominators), get the
				// predacessor vertices from the sink
				Set p = (Set) preds.get(graph.sink());

				// If there are no (known) predacessors, make a new HashSet to
				// store them and register it in the pred Map.
				if (p == null) {
					p = new HashSet();
					preds.put(graph.sink(), p);
				}

				// The block is in the predacessors of the sink
				p.add(block);

			} else {
				// If we're going backwards, get the block's predacessors
				Set p = (Set) preds.get(block);

				if (p == null) {
					p = new HashSet();
					preds.put(block, p);
				}

				// Add the sink vertex to the predacessors of the block
				p.add(graph.sink());
			}
		}
	}