Removed arch_irn_is_ignore with generic macro
authorDaniel Grund <grund@cs.uni-saarland.de>
Tue, 21 Mar 2006 16:05:23 +0000 (16:05 +0000)
committerDaniel Grund <grund@cs.uni-saarland.de>
Tue, 21 Mar 2006 16:05:23 +0000 (16:05 +0000)
ir/be/bearch.h
ir/be/becopyopt.c
ir/be/belower.c
ir/be/bemain.c
ir/be/beraextern.c
ir/be/bespillbelady.c

index da5a5a5..011b5cb 100644 (file)
@@ -384,13 +384,13 @@ extern arch_irn_class_t arch_irn_classify(const arch_env_t *env, const ir_node *
  */
 extern arch_irn_flags_t arch_irn_get_flags(const arch_env_t *env, const ir_node *irn);
 
-#define arch_irn_is_ignore(env, irn) ((arch_irn_get_flags(env, irn) & arch_irn_flags_ignore) != 0)
+#define arch_irn_is(env, irn, flag) ((arch_irn_get_flags(env, irn) & arch_irn_flags_ ## flag) != 0)
 
 #define arch_irn_has_reg_class(env, irn, pos, cls) \
   ((cls) == arch_get_irn_reg_class(env, irn, pos))
 
 #define arch_irn_consider_in_reg_alloc(env, cls, irn) \
-       (arch_irn_has_reg_class(env, irn, -1, cls) && !arch_irn_is_ignore(env, irn))
+       (arch_irn_has_reg_class(env, irn, -1, cls) && !arch_irn_is(env, irn, ignore))
 
 /**
  * Somebody who can be asked about IR nodes.
index abbf858..431743e 100644 (file)
@@ -76,7 +76,7 @@ void free_copy_opt(copy_opt_t *co) {
 int co_is_optimizable_root(const copy_opt_t *co, ir_node *irn) {
        arch_register_req_t req;
 
-       if (arch_irn_is_ignore(co->aenv, irn))
+       if (arch_irn_is(co->aenv, irn, ignore))
                return 0;
 
        if (is_Reg_Phi(irn) || is_Perm_Proj(co->aenv, irn) || is_2addr_code(co->aenv, irn, &req))
@@ -90,7 +90,7 @@ int co_is_optimizable_arg(const copy_opt_t *co, ir_node *irn) {
 
        assert(0 && "Is buggy and obsolete. Do not use");
 
-       if (arch_irn_is_ignore(co->aenv, irn))
+       if (arch_irn_is(co->aenv, irn, ignore))
                return 0;
 
        foreach_out_edge(irn, edge) {
@@ -472,7 +472,7 @@ static void build_graph_walker(ir_node *irn, void *env) {
        int pos, max;
        arch_register_req_t req;
 
-       if (!is_curr_reg_class(co, irn) || arch_irn_is_ignore(co->aenv, irn))
+       if (!is_curr_reg_class(co, irn) || arch_irn_is(co->aenv, irn, ignore))
                return;
 
        /* Phis */
index db07734..d4224ec 100644 (file)
@@ -508,7 +508,7 @@ static void gen_assure_different_pattern(ir_node *irn, be_irg_t *birg, ir_node *
        firm_dbg_module_t         *mod   = firm_dbg_register("firm.be.lower");
        const arch_register_class_t *cls = arch_get_irn_reg_class(arch_env, other_different, -1);
 
-       if (arch_irn_is_ignore(arch_env, other_different) || ! mode_is_datab(get_irn_mode(other_different))) {
+       if (arch_irn_is(arch_env, other_different, ignore) || ! mode_is_datab(get_irn_mode(other_different))) {
                DBG((mod, LEVEL_1, "ignore constraint for %+F because other_irn is ignore or not a datab node\n", irn));
                return;
        }
index d301466..54aee99 100644 (file)
@@ -332,7 +332,7 @@ static void be_main_loop(FILE *file_handle)
 void be_main(FILE *file_handle)
 {
        /* never build code for pseudo irgs */
-       set_visit_pseudo_irgs(0);
+       set_visit_pseudo_irgs(0);
 
        be_node_init();
        be_main_loop(file_handle);
index cbd55d7..8a9d45e 100644 (file)
@@ -345,7 +345,7 @@ static void ssa_destr_simple_walker(ir_node *blk, void *env) {
                        if (!is_Phi(phi))
                                break;
 
-                       if (arch_irn_is_ignore(raenv->aenv, phi))
+                       if (arch_irn_is(raenv->aenv, phi, ignore))
                                continue;
 
                        raenv->cls = arch_get_irn_reg_class(raenv->aenv, phi, -1);
@@ -536,7 +536,7 @@ static INLINE int get_spill_costs(be_raext_env_t *raenv, var_info_t *vi) {
        int c_spills=0, c_reloads=0;
 
        pset_foreach(vi->values, irn) {
-               if (arch_irn_is_ignore(raenv->aenv, irn) || be_is_Reload(irn)) {
+               if (arch_irn_is(raenv->aenv, irn, ignore) || be_is_Reload(irn)) {
                        pset_break(vi->values);
                        return UNSPILLABLE;
                }
@@ -619,7 +619,7 @@ static void dump_affinities_walker(ir_node *irn, void *env) {
        int pos, max;
        var_info_t *vi1, *vi2;
 
-       if (arch_get_irn_reg_class(raenv->aenv, irn, -1) != raenv->cls || arch_irn_is_ignore(raenv->aenv, irn))
+       if (arch_get_irn_reg_class(raenv->aenv, irn, -1) != raenv->cls || arch_irn_is(raenv->aenv, irn, ignore))
                return;
 
        vi1 = get_var_info(irn);
@@ -628,7 +628,7 @@ static void dump_affinities_walker(ir_node *irn, void *env) {
        if (arch_irn_classify(raenv->aenv, irn) == arch_irn_class_copy) {
                ir_node *other = get_irn_n(irn, be_pos_Copy_orig);
 
-               if (! arch_irn_is_ignore(raenv->aenv, other)) {
+               if (! arch_irn_is(raenv->aenv, other, ignore)) {
                        vi2 = get_var_info(other);
 
                        fprintf(raenv->f, "(%d, %d, %d)\n",  vi1->var_nr, vi2->var_nr, get_affinity_weight(irn));
@@ -640,7 +640,7 @@ static void dump_affinities_walker(ir_node *irn, void *env) {
        for (pos = 0, max = get_irn_arity(irn); pos<max; ++pos) {
                arch_get_register_req(raenv->aenv, &req, irn, pos);
 
-               if (arch_register_req_is(&req, should_be_same) && arch_irn_is_ignore(raenv->aenv, req.other_same)) {
+               if (arch_register_req_is(&req, should_be_same) && arch_irn_is(raenv->aenv, req.other_same, ignore)) {
                        vi2 = get_var_info(req.other_same);
 
                        fprintf(raenv->f, "(%d, %d, %d)\n",  vi1->var_nr, vi2->var_nr, get_affinity_weight(irn));
index 08b9c64..b54008a 100644 (file)
@@ -614,17 +614,20 @@ static void remove_unused_reloads(ir_graph *irg, belady_env_t *bel) {
                ir_node *spill;
                DBG((dbg, DBG_SPILL, "Removing %+F before %+F in %+F\n", irn, sched_next(irn), get_nodes_block(irn)));
 
-               spill = get_irn_n(irn, be_pos_Reload_mem);
+               if (be_is_Reload(irn))
+                       spill = get_irn_n(irn, be_pos_Reload_mem);
 
                /* remove reload */
                set_irn_n(irn, 0, new_Bad());
                sched_remove(irn);
 
-               /* if spill not used anymore, remove it too
-                * test of regclass is necessary since spill may be a phi-M */
-               if (get_irn_n_edges(spill) == 0 && bel->cls == arch_get_irn_reg_class(bel->arch, spill, -1)) {
-                       set_irn_n(spill, 0, new_Bad());
-                       sched_remove(spill);
+               if (be_is_Reload(irn)) {
+                       /* if spill not used anymore, remove it too
+                        * test of regclass is necessary since spill may be a phi-M */
+                       if (get_irn_n_edges(spill) == 0 && bel->cls == arch_get_irn_reg_class(bel->arch, spill, -1)) {
+                               set_irn_n(spill, 0, new_Bad());
+                               sched_remove(spill);
+                       }
                }
        }
 }