+ /* First step: Find the root set. */
+ foreach_out_edge(block, edge) {
+ ir_node *succ = get_edge_src_irn(edge);
+
+ if (is_root(succ, block)) {
+ mark_root_node(&be, succ);
+ set_irn_link(succ, root);
+ root = succ;
+ }
+ else
+ set_irn_link(succ, MARK);
+ }
+
+ /* Second step: calculate the pre-order list. */
+ preord = NULL;
+ for (curr = root; curr; curr = irn) {
+ irn = get_irn_link(curr);
+ descent(curr, block, &preord);
+ }
+ root = preord;
+
+ /* Third step: calculate the Delay. Note that our
+ * list is now in pre-order, starting at root
+ */
+ for (curr = root; curr; curr = get_irn_link(curr)) {
+ sched_timestep_t d;
+
+ if (arch_irn_classify(env->arch_env, curr) == arch_irn_class_branch) {
+ /* assure, that branches can be executed last */
+ d = 0;
+ }
+ else {
+ if (is_root_node(&be, curr))
+ d = exectime(env, curr);
+ else {
+ d = 0;
+ foreach_out_edge(curr, edge) {
+ ir_node *n = get_edge_src_irn(edge);
+
+ if (get_nodes_block(n) == block) {
+ sched_timestep_t ld;
+
+ ld = latency(env, curr, 1, n, 0) + get_irn_delay(&be, n);
+ d = ld > d ? ld : d;
+ }
+ }
+ }
+ }
+ set_irn_delay(&be, curr, d);
+ DB((be.dbg, LEVEL_2, "\t%+F delay %u\n", curr, d));
+
+ /* set the etime of all nodes to 0 */
+ set_irn_etime(&be, curr, 0);
+ }
+
+