/**
* 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;
#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"
*/
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));
}
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) {
/**
* 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;
#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
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);
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);
}
#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;
#include "beasm_asm_gnu.h"
#undef DUMP_ALLOCATED
+#define DUMP_PREPARED
+#define DUMP_SPILL
+#define DUMP_SCHED
+#undef DUMP_POST
+
#define N_PHASES 256
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)
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. */
/* 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);
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);
#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);
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);
}
}
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;
}
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)
#include <lpp/lpp.h>
#include <lpp/lpp_net.h>
+#include <lpp/lpp_cplex.h>
#include "be_t.h"
#include "belive_t.h"
#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"
#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");
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)
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);
}
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");