bearch: Add and use be_foreach_value().
[libfirm] / ir / be / bemain.c
index 6f62633..74f8294 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "obst.h"
 #include "bitset.h"
-
+#include "statev.h"
 #include "irprog.h"
 #include "irgopt.h"
 #include "irgraph.h"
@@ -456,7 +456,6 @@ static void initialize_birg(be_irg_t *birg, ir_graph *irg, be_main_env_t *env)
        irg->be_data = birg;
 
        memset(birg, 0, sizeof(*birg));
-       birg->irg = irg;
        birg->main_env = env;
        obstack_init(&birg->obst);
        birg->lv = be_liveness_new(irg);
@@ -481,7 +480,6 @@ static void initialize_birg(be_irg_t *birg, ir_graph *irg, be_main_env_t *env)
        /* Ensure, that the ir_edges are computed. */
        assure_edges(irg);
 
-       add_irg_constraints(irg, IR_GRAPH_CONSTRAINT_BACKEND);
        be_info_init_irg(irg);
 
        dump(DUMP_INITIAL, irg, "prepared");
@@ -496,7 +494,6 @@ static const char *get_timer_name(be_timer_id_t id)
        case T_CODEGEN:        return "codegen";
        case T_RA_PREPARATION: return "ra_preparation";
        case T_SCHED:          return "sched";
-       case T_SPLIT:          return "split";
        case T_CONSTR:         return "constr";
        case T_FINISH:         return "finish";
        case T_EMIT:           return "emit";
@@ -506,7 +503,6 @@ static const char *get_timer_name(be_timer_id_t id)
        case T_LIVE:           return "live";
        case T_EXECFREQ:       return "execfreq";
        case T_SSA_CONSTR:     return "ssa_constr";
-       case T_RA_PROLOG:      return "ra_prolog";
        case T_RA_EPILOG:      return "ra_epilog";
        case T_RA_CONSTR:      return "ra_constr";
        case T_RA_SPILL:       return "ra_spill";
@@ -631,10 +627,11 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
        }
 
        /* For all graphs */
-       for (i = 0; i < num_birgs; ++i) {
-               be_irg_t *birg = &birgs[i];
-               ir_graph *irg  = birg->irg;
-               optimization_state_t state;
+       for (i = 0; i < num_irgs; ++i) {
+               ir_graph  *const irg    = get_irp_irg(i);
+               ir_entity *const entity = get_irg_entity(irg);
+               if (get_entity_linkage(entity) & IR_LINKAGE_NO_CODEGEN)
+                       continue;
 
                /* set the current graph (this is important for several firm functions) */
                current_ir_graph = irg;
@@ -658,7 +655,8 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
                be_timer_pop(T_VERIFY);
 
                /* get a code generator for this graph. */
-               arch_env->impl->init_graph(irg);
+               if (arch_env->impl->init_graph)
+                       arch_env->impl->init_graph(irg);
 
                /* some transformations need to be done before abi introduce */
                if (arch_env->impl->before_abi != NULL)
@@ -712,6 +710,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
                /* introduce patterns to assure constraints */
                be_timer_push(T_CONSTR);
                /* we switch off optimizations here, because they might cause trouble */
+               optimization_state_t state;
                save_optimization_state(&state);
                set_optimize(0);
                set_opt_cse(0);
@@ -789,12 +788,6 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
 
                dump(DUMP_FINAL, irg, "end");
 
-               if (!arch_env->custom_abi) {
-                       be_timer_push(T_ABI);
-                       be_abi_free(irg);
-                       be_timer_pop(T_ABI);
-               }
-
                restore_optimization_state(&state);
 
                be_timer_pop(T_OTHER);