#include "bechordal_t.h"
#include "bechordal_draw.h"
-#define DBG_LEVEL 0 //SET_LEVEL_4
+#define DBG_LEVEL SET_LEVEL_0
#define NO_COLOR (-1)
#undef DUMP_INTERVALS
bitset_t *live = env->live;
bitset_t *colors = env->colors;
bitset_t *in_colors = env->in_colors;
- const arch_env_t *arch_env = env->session_env->main_env->arch_env;
+ const arch_env_t *arch_env = env->session_env->main_env->arch_env;
const ir_node *irn;
border_t *b;
struct list_head *head = get_block_border_head(env, block);
pset *live_in = put_live_in(block, pset_new_ptr_default());
-
-
bitset_clear_all(live);
bitset_clear_all(colors);
bitset_clear_all(in_colors);
*/
for(irn = pset_first(live_in); irn; irn = pset_next(live_in)) {
if(has_reg_class(env, irn)) {
- const arch_register_t *reg = arch_get_irn_register(arch_env, irn, 0);
- int col;
+ const arch_register_t *reg = arch_get_irn_register(arch_env, irn, 0);
+ int col;
- assert(reg && "Node must have been assigned a register");
+ assert(reg && "Node must have been assigned a register");
col = arch_register_get_index(reg);
/* Mark the color of the live in value as used. */
* color.
*/
if(b->is_def && !is_live_in(block, irn)) {
- const arch_register_t *reg;
+ const arch_register_t *reg;
int col = NO_COLOR;
DBG((dbg, LEVEL_4, "\tcolors in use: %b\n", colors));
- col = bitset_next_clear(colors, 0);
- reg = arch_register_for_index(env->cls, col);
+ col = bitset_next_clear(colors, 0);
+ reg = arch_register_for_index(env->cls, col);
- assert(arch_get_irn_register(arch_env, irn, 0) == NULL
- && "This node must not have been assigned a register yet");
+ assert(arch_get_irn_register(arch_env, irn, 0) == NULL && "This node must not have been assigned a register yet");
assert(!bitset_is_set(live, nr) && "Value's definition must not have been encountered");
bitset_set(colors, col);
/* Clear the color upon a use. */
else if(!b->is_def) {
- const arch_register_t *reg = arch_get_irn_register(arch_env, irn, 0);
+ const arch_register_t *reg = arch_get_irn_register(arch_env, irn, 0);
int col;
- assert(reg && "Register must have been assigned");
+ assert(reg && "Register must have been assigned");
- col = arch_register_get_index(reg);
+ col = arch_register_get_index(reg);
assert(bitset_is_set(live, nr) && "Cannot have a non live use");
bitset_clear(colors, col);
}
}
- del_pset(live_in);
+ del_pset(live_in);
}
void be_ra_chordal_init(void)
static void check_pressure_walker(ir_node *bl, void *data)
{
+ firm_dbg_module_t *dbg = firm_dbg_register("be.ra.pressure");
check_pressure_info_t *info = data;
int n_regs = arch_register_class_n_regs(info->cls);
pset *live = pset_new_ptr_default();
int step = 0;
ir_node *irn;
- irn_live_t *li;
+ irn_live_t *li;
- live_foreach(bl, li) {
- if(live_is_end(li) && check_pressure_has_class(info, li->irn)) {
- ir_node *irn = (ir_node *) li->irn;
- pset_insert_ptr(live, irn);
- }
- }
+ firm_dbg_set_mask(dbg, -1);
+
+ live_foreach(bl, li) {
+ if(live_is_end(li) && check_pressure_has_class(info, li->irn)) {
+ ir_node *irn = (ir_node *) li->irn;
+ pset_insert_ptr(live, irn);
+ }
+ }
+
+ DBG((dbg, LEVEL_1, "end set for %+F\n", bl));
+ for(irn = pset_first(live); irn; irn = pset_next(live))
+ DBG((dbg, LEVEL_1, "\t%+F\n", irn));
sched_foreach_reverse(bl, irn) {
int i, n;
int pressure = pset_count(live);
+ DBG((dbg, LEVEL_1, "%+10F@%+10F: pressure %d\n", bl, irn, pressure));
+
if(pressure > n_regs) {
ir_node *x;
ir_printf("%+10F@%+10F: pressure to high: %d\n", bl, irn, pressure);