Bugfixes
authorDaniel Grund <grund@cs.uni-saarland.de>
Fri, 26 Aug 2005 08:33:22 +0000 (08:33 +0000)
committerDaniel Grund <grund@cs.uni-saarland.de>
Fri, 26 Aug 2005 08:33:22 +0000 (08:33 +0000)
ir/be/becopyheur.c
ir/be/becopyilp.c
ir/be/becopyopt.c
ir/be/becopyopt.h
ir/be/becopyoptmain.c
ir/be/beirgmod.c
ir/be/bemain.c
ir/be/benode.c
ir/be/bespillilp.c
ir/be/bessadestr.c
ir/be/beutil.c

index 4659f8f..0d152ca 100644 (file)
@@ -380,7 +380,7 @@ static int qnode_try_color(const qnode_t *qn) {
 /**
  * Determines a maximum weighted independent set with respect to
  * the interference and conflict edges of all nodes in a qnode.
- * TODO: This runs in 2^n in worst case. Use a heuristic iff n>???
+ * TODO: This runs in n! in worst case. Use a heuristic iff n>???
  */
 static INLINE void qnode_max_ind_set(qnode_t *qn, const unit_t *ou) {
        ir_node **safe, **unsafe;
index 3ff18da..8d1dcee 100644 (file)
 #include <malloc.h>
 #endif
 
+#define PATH_CONSTRAINTS_FOR_CLASSES
+#undef PRECOLOR_MAX_CLIQUE
 #undef NO_NULL_COLORS
 #undef NO_NULL_COLORS_EXTRA_CSTS
 #undef NO_NULL_COLORS_WITH_COSTS
-
 #if (defined(NO_NULL_COLORS_EXTRA_CSTS) || defined(NO_NULL_COLORS_WITH_COSTS)) && !defined(NO_NULL_COLORS)
 #error Chose your weapon!
 #endif
 
-#undef PRECOLOR_MAX_CLIQUE
-#define PATH_CONSTRAINTS_FOR_CLASSES
-
 #include "irprog.h"
 
 #include <lpp/lpp.h>
 #include <lpp/lpp_net.h>
-//#include <lpp/lpp_cplex.h>
+#include <lpp/lpp_cplex.h>
 #include <lpp/lpp_remote.h>
 #include "xmalloc.h"
 #include "pset.h"
@@ -890,8 +888,8 @@ static void pi_set_start_sol(problem_instance_t *pi) {
  */
 static void pi_solve_ilp(problem_instance_t *pi) {
        pi_set_start_sol(pi);
-       lpp_solve_net(pi->curr_lp, LPP_HOST, LPP_SOLVER);
-//     lpp_solve_cplex(pi->curr_lp);
+//     lpp_solve_net(pi->curr_lp, LPP_HOST, LPP_SOLVER);
+       lpp_solve_cplex(pi->curr_lp);
        DBG((dbg, LEVEL_1, "Solution time: %.2f\n", pi->curr_lp->sol_time));
 }
 
@@ -948,7 +946,7 @@ static void pi_apply_solution(problem_instance_t *pi) {
        sol = xmalloc((pi->last_x_var - pi->first_x_var + 1) * sizeof(*sol));
        state = lpp_get_solution(pi->curr_lp, sol, pi->first_x_var, pi->last_x_var);
        if (state != lpp_optimal) {
-               printf("Solution state is not 'optimal': %d\n", state);
+               printf("WARNING: Solution state is not 'optimal': %d\n", state);
                assert(state >= lpp_feasible && "The solution should at least be feasible!");
        }
        for (i=0; i<pi->last_x_var - pi->first_x_var + 1; ++i) {
index e719371..0118ae9 100644 (file)
@@ -35,7 +35,7 @@ static firm_dbg_module_t *dbg = NULL;
 /**
  * Determines a maximum weighted independent set with respect to
  * the interference and conflict edges of all nodes in a qnode.
- * TODO: This runs in 2^n in worst case. Use a heuristic iff n>???
+ * TODO: This runs in n! in worst case. Use a heuristic iff n>???
  */
 static int ou_max_ind_set_costs(unit_t *ou) {
        be_chordal_env_t *chordal_env = ou->co->chordal_env;
index c18e387..ef0b21f 100644 (file)
@@ -29,7 +29,7 @@
 #include "bechordal_t.h"
 #include "bearch.h"
 
-#define DEBUG_IRG "MergeSort.c__merge__datab"
+#define DEBUG_IRG "!!deflate.c__longest_match__datab"
 #define DEBUG_IRG_LVL_CO   SET_LEVEL_1
 #define DEBUG_IRG_LVL_HEUR SET_LEVEL_1
 #define DEBUG_IRG_LVL_ILP  SET_LEVEL_1
index 6a326ee..d372da6 100644 (file)
@@ -70,9 +70,9 @@ void be_copy_opt(be_chordal_env_t *chordal_env) {
        copystat_add_heur_costs(costs_heur);
        DBG((dbg, LEVEL_1, "Heur costs: %3d\n", costs_heur));
 #endif
+       assert(lower_bound == -1 || costs_heur == -1 || lower_bound <= costs_heur);
 #endif
 
-       assert(lower_bound <= costs_heur);
 
 #ifdef DO_ILP
        co_ilp_opt(co);
@@ -82,9 +82,9 @@ void be_copy_opt(be_chordal_env_t *chordal_env) {
        copystat_add_opt_costs(costs_ilp);
        DBG((dbg, LEVEL_1, "Opt  costs: %3d\n", costs_ilp));
 #endif
+       assert(lower_bound == -1 || costs_ilp == -1 || lower_bound <= costs_ilp);
+       assert(costs_ilp == -1 || costs_heur == -1 || costs_ilp <= costs_heur);
 #endif
-       assert(lower_bound <= costs_ilp);
-       assert(costs_ilp <= costs_heur);
 
        free_copy_opt(co);
 }
index e3b662d..e307a4f 100644 (file)
@@ -30,7 +30,7 @@
 #include "beirgmod.h"
 
 #define DBG_MODULE firm_dbg_register("firm.be.irgmod")
-#define DBG_LEVEL 0 // SET_LEVEL_4
+#define DBG_LEVEL SET_LEVEL_0
 
 struct _dom_front_info_t {
   pmap *df_map;
index 5f2413b..c87d5d5 100644 (file)
 #include "beasm_asm_gnu.h"
 
 #undef DUMP_ALLOCATED
+#define DUMP_PREPARED
+#define DUMP_SPILL
+#define DUMP_SCHED
+#undef DUMP_POST
+
 
 #define N_PHASES 256
 
@@ -115,9 +120,11 @@ static void prepare_graph(be_main_session_env_t *s)
        if (get_irg_loopinfo_state(s->irg) != (loopinfo_valid & loopinfo_cf_consistent))
                construct_cf_backedges(s->irg);
 
+#ifdef DUMP_PREPARED
        dump_dominator_information(true);
        dump_ir_block_graph(s->irg, "-prepared");
        dump_dominator_information(false);
+#endif
 }
 
 static void be_main_loop(void)
@@ -135,6 +142,8 @@ static void be_main_loop(void)
                ir_graph *irg = get_irp_irg(i);
                be_main_session_env_t session;
 
+               dump_ir_block_graph(irg, "-be-begin");
+
                DBG((env.dbg, LEVEL_1, "====> IRG: %F\n", irg));
 
                /* Init the session. */
@@ -145,7 +154,9 @@ static void be_main_loop(void)
 
                /* Schedule the graphs. */
                list_sched(irg, trivial_selector);
+#ifdef DUMP_SCHED
                dump_ir_block_graph_sched(irg, "-sched");
+#endif
 
                /* Verify the schedule */
                sched_verify_irg(irg);
@@ -161,8 +172,9 @@ static void be_main_loop(void)
                        DBG((env.dbg, LEVEL_1, "----> Reg class: %s\n", cls->name));
 
                        be_spill_ilp(&session, cls);
+#ifdef DUMP_SPILL
                        dump_ir_block_graph_sched(session.irg, "-spill");
-
+#endif
                        be_liveness(irg);
                        be_numbering(irg);
                        be_check_pressure(&session, cls);
@@ -186,9 +198,9 @@ static void be_main_loop(void)
 #endif
                        copystat_collect_cls(chordal_env);
 
-//                     dump_allocated_irg(env.arch_env, irg, "pre");
+                       dump_allocated_irg(env.arch_env, irg, "pre");
                        be_copy_opt(chordal_env);
-//                     dump_allocated_irg(env.arch_env, irg, "post");
+                       dump_allocated_irg(env.arch_env, irg, "post");
 
                        be_ssa_destruction(chordal_env);
                        be_ssa_destruction_check(chordal_env);
@@ -197,8 +209,9 @@ static void be_main_loop(void)
                        be_ra_chordal_done(chordal_env);
                        be_numbering_done(irg);
                }
+#ifdef DUMP_POST
                dump_ir_block_graph_sched(session.irg, "-post");
-
+#endif
                copystat_dump(irg);
        }
 }
index b7a53f0..714bb17 100644 (file)
@@ -251,8 +251,16 @@ be_node_set_irn_reg(const arch_irn_ops_t *_self, ir_node *irn,
     int idx, const arch_register_t *reg)
 {
   const arch_register_t **regs;
+  be_op_t *bo;
+  const be_node_factory_t *factory =
+    container_of(_self, const be_node_factory_t, irn_ops);
 
   idx = redir_proj((const ir_node **) &irn, idx);
+  bo = pmap_get(factory->irn_op_map, get_irn_op(irn));
+
+       if(!bo)
+               return;
+
   regs = (const arch_register_t **) &irn->attr;
   regs[idx] = reg;
 }
@@ -261,10 +269,25 @@ const arch_register_t *
 be_node_get_irn_reg(const arch_irn_ops_t *_self, const ir_node *irn, int idx)
 {
   const arch_register_t **regs;
+  be_op_t *bo;
+  int i, pos = arch_pos_make_out(idx);
+  const be_node_factory_t *factory =
+    container_of(_self, const be_node_factory_t, irn_ops);
 
   idx = redir_proj(&irn, idx);
-  regs = (const arch_register_t **) &irn->attr;
-  return regs[idx];
+  bo = pmap_get(factory->irn_op_map, get_irn_op(irn));
+
+  if(!bo)
+       return NULL;
+
+  for(i = 0; i < bo->n_pos; ++i) {
+       if(bo->pos[i] == pos) {
+         regs = (const arch_register_t **) &irn->attr;
+         return regs[idx];
+       }
+  }
+
+  return NULL;
 }
 
 arch_irn_class_t be_node_classify(const arch_irn_ops_t *_self, const ir_node *irn)
index fa9731e..6898c2c 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <lpp/lpp.h>
 #include <lpp/lpp_net.h>
+#include <lpp/lpp_cplex.h>
 
 #include "be_t.h"
 #include "belive_t.h"
@@ -39,8 +40,8 @@
 
 #define DBG_LEVEL SET_LEVEL_3
 
-#define DUMP_SOLUTION
-#define DUMP_ILP
+#undef DUMP_SOLUTION
+#undef DUMP_ILP
 
 #define LPP_SERVER "i44pc52"
 #define LPP_SOLVER "cplex"
@@ -645,7 +646,8 @@ void be_spill_ilp(const be_main_session_env_t *session_env,
 #endif
 
        DBG((si.dbg, LEVEL_1, "%F\n", session_env->irg));
-       lpp_solve_net(si.lpp, LPP_SERVER, LPP_SOLVER);
+//     lpp_solve_net(si.lpp, LPP_SERVER, LPP_SOLVER);
+       lpp_solve_cplex(si.lpp);
        assert(lpp_is_sol_valid(si.lpp) && "ILP not feasible");
 
        assert(lpp_is_sol_valid(si.lpp) && "solution of ILP must be valid");
index c302a54..de7cbcf 100644 (file)
@@ -30,7 +30,7 @@
 
 static firm_dbg_module_t *dbg = NULL;
 #define DEBUG_LVL SET_LEVEL_0
-
+#undef DUMP_GRAPHS
 
 #define get_chordal_arch(ce) ((ce)->session_env->main_env->arch_env)
 #define get_reg(irn) arch_get_irn_register(get_chordal_arch(chordal_env), irn, 0)
@@ -278,10 +278,13 @@ void be_ssa_destruction(be_chordal_env_t *chordal_env) {
 
        build_phi_rings(chordal_env);
        insert_all_perms(chordal_env);
+#ifdef DUMP_GRAPHS
        dump_ir_block_graph_sched(irg, "-ssa_destr_perms_placed");
-
+#endif
        set_regs_or_place_dupls(chordal_env);
+#ifdef DUMP_GRAPHS
        dump_ir_block_graph_sched(irg, "-ssa_destr_regs_set");
+#endif
 
        pmap_destroy(perm_map);
 }
index 04e7e1b..aa950cd 100644 (file)
@@ -32,6 +32,7 @@ static void dump_allocated_block(ir_node *block, void *data)
        ir_fprintf(f, "node:{title:\"b%N\"\nlabel:\"%n\n", block, block);
        sched_foreach(block, irn) {
                const char *prefix = "";
+
     const arch_register_t *reg = arch_get_irn_register(env, irn, 0);
 
                ir_fprintf(f, "\n");