#define DEBUG_LVL 0 //(DBG_START | DBG_DECIDE | DBG_WSETS | DBG_FIX | DBG_SPILL)
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
-#define MIN(a,b) (((a)<(b))?(a):(b))
-
typedef struct _workset_t workset_t;
typedef struct _belady_env_t {
}
DBG((dbg, DBG_DECIDE, " demand = %d\n", demand));
-
/*
* 2. Make room for at least 'demand' slots
*/
before its first usage, remove it from start workset */
for (i=max_allowed; i<ws->len; ++i) {
ir_node *irn = ws->vals[i].irn;
+
if (!pset_find_ptr(bel->used, irn)) {
ir_node *curr_bb = get_nodes_block(bel->instr);
workset_t *ws_start = get_block_info(curr_bb)->ws_start;
static void remove_copies(belady_env_t *bel) {
ir_node *irn;
- for (irn = pset_first(bel->copies); irn; irn = pset_next(bel->copies)) {
+ foreach_pset(bel->copies, irn) {
ir_node *src, *user;
assert(be_is_Copy(irn));
user = get_irn_edge(get_irn_irg(irn), irn, 0)->src;
- src = get_irn_n(irn, be_pos_Copy_orig);
+ src = be_get_Copy_op(irn);
set_irn_n(user, 0, src);
}
}
ir_node *irn;
irg_walk_graph(irg, rescue_used_reloads, NULL, bel->reloads);
- for(irn = pset_first(bel->reloads); irn; irn = pset_next(bel->reloads)) {
+ foreach_pset(bel->reloads, irn) {
ir_node *spill;
DBG((dbg, DBG_SPILL, "Removing %+F before %+F in %+F\n", irn, sched_next(irn), get_nodes_block(irn)));
bel.ws = new_workset(&bel.ob, &bel);
bel.uses = be_begin_uses(chordal_env->irg, chordal_env->birg->main_env->arch_env, bel.cls);
bel.senv = be_new_spill_env(chordal_env, is_mem_phi, NULL);
- DEBUG_ONLY(bel.senv->dbg = dbg;)
+ DEBUG_ONLY(be_set_spill_env_dbg_module(bel.senv, dbg);)
bel.reloads = pset_new_ptr_default();
bel.copies = pset_new_ptr_default();