Start block isn't a special case anymore (and now get the old node nr).
[libfirm] / ir / be / beschedtrace.c
index 636929c..2e3c409 100644 (file)
 
 #include "iredges_t.h"
 
-#include "besched_t.h"
+#include "besched.h"
 #include "belistsched.h"
-#include "benode_t.h"
+#include "benode.h"
+#include "belive.h"
 
 /* we need a special mark */
 static char _mark;
@@ -282,7 +283,7 @@ static int get_reg_difference(trace_env_t *env, ir_node *irn) {
        ir_node *block = get_nodes_block(irn);
 
        if (be_is_Call(irn)) {
-               /* we want calls prefered */
+               /* we want calls preferred */
                return -5;
        }
 
@@ -302,11 +303,16 @@ static int get_reg_difference(trace_env_t *env, ir_node *irn) {
        for (i = get_irn_arity(irn) - 1; i >= 0; i--) {
                ir_node *in = get_irn_n(irn, i);
 
-               if (mode_is_datab(get_irn_mode(in)) &&           /* must be data node */
-                   !arch_irn_is(in, ignore)        &&           /* ignore "ignore" nodes :) */
-                   !be_is_live_end(env->liveness, block, in)) { /* if the value lives outside of block: do not count */
-                       num_in++;
-               }
+               if (!mode_is_datab(get_irn_mode(in)))
+                       continue;
+
+               if (arch_irn_is_ignore(in))
+                       continue;
+
+               if (be_is_live_end(env->liveness, block, in))
+                       continue;
+
+               num_in++;
        }
 
        return num_out - num_in;
@@ -423,7 +429,7 @@ static void trace_preprocess_block(trace_env_t *env, ir_node *block) {
        for (cur_pos = 0, curr = root; curr; curr = get_irn_link(curr), cur_pos++) {
                sched_timestep_t d;
 
-               if (arch_irn_class_is(curr, branch)) {
+               if (is_cfop(curr)) {
                        /* assure, that branches can be executed last */
                        d = 0;
                }
@@ -497,7 +503,7 @@ static trace_env_t *trace_init(const be_irg_t *birg) {
 
        env->curr_time  = 0;
        env->sched_info = NEW_ARR_F(trace_irn_t, nn);
-       env->liveness   = be_liveness(birg);
+       env->liveness   = be_liveness(irg);
        FIRM_DBG_REGISTER(env->dbg, "firm.be.sched.trace");
 
        be_liveness_assure_chk(env->liveness);
@@ -527,7 +533,7 @@ static ir_node *basic_selection(ir_nodeset_t *ready_set)
 
        /* assure that branches and constants are executed last */
        foreach_ir_nodeset(ready_set, irn, iter) {
-               if (!arch_irn_class_is(irn, branch)) {
+               if (!is_cfop(irn)) {
                        return irn;
                }
        }
@@ -579,7 +585,7 @@ static ir_node *muchnik_select(void *block_env, ir_nodeset_t *ready_set, ir_node
                if (cnt == 1) {
                        irn = get_nodeset_node(&ecands);
 
-                       if (arch_irn_class_is(irn, branch)) {
+                       if (is_cfop(irn)) {
                                /* BEWARE: don't select a JUMP if others are still possible */
                                goto force_mcands;
                        }
@@ -655,7 +661,7 @@ static ir_node *heuristic_select(void *block_env, ir_nodeset_t *ns, ir_nodeset_t
        /* priority based selection, heuristic inspired by mueller diss */
        foreach_ir_nodeset(ns, irn, iter) {
                /* make sure that branches are scheduled last */
-               if (!arch_irn_class_is(irn, branch)) {
+               if (!is_cfop(irn)) {
                        int rdiff = get_irn_reg_diff(trace_env, irn);
                        int sign  = rdiff < 0;
                        int chg   = (rdiff < 0 ? -rdiff : rdiff) << PRIO_CHG_PRESS;