- pset *pre_colored; /**< Set of precolored nodes. */
- bitset_t *live; /**< A liveness bitset. */
- bitset_t *tmp_colors; /**< An auxiliary bitset which is as long as the number of colors in the class. */
- bitset_t *colors; /**< The color mask. */
- bitset_t *in_colors; /**< Colors used by live in values. */
- int colors_n; /**< The number of colors. */
+ pset *pre_colored; /**< Set of precolored nodes. */
+ bitset_t *live; /**< A liveness bitset. */
+ bitset_t *tmp_colors; /**< An auxiliary bitset which is as long as the number of colors in the class. */
+ bitset_t *colors; /**< The color mask. */
+ bitset_t *in_colors; /**< Colors used by live in values. */
+ int colors_n; /**< The number of colors. */
ir_node *irn, unsigned step, unsigned pressure,
unsigned is_def, unsigned is_real)
{
ir_node *irn, unsigned step, unsigned pressure,
unsigned is_def, unsigned is_real)
{
static int get_next_free_reg(const be_chordal_alloc_env_t *alloc_env, bitset_t *colors)
{
bitset_t *tmp = alloc_env->tmp_colors;
static int get_next_free_reg(const be_chordal_alloc_env_t *alloc_env, bitset_t *colors)
{
bitset_t *tmp = alloc_env->tmp_colors;
bitset_t *tmp = bitset_alloca(env->cls->n_regs);
bitset_t *def_constr = bitset_alloca(env->cls->n_regs);
ir_node *bl = get_nodes_block(irn);
bitset_t *tmp = bitset_alloca(env->cls->n_regs);
bitset_t *def_constr = bitset_alloca(env->cls->n_regs);
ir_node *bl = get_nodes_block(irn);
- if (arch_get_irn_reg_class(aenv, irn, i) != env->cls)
+ req = arch_get_register_req(irn, i);
+ if (req->cls != env->cls)
if (reg == NULL || !arch_register_type_is(reg, ignore))
continue;
if(arch_register_type_is(reg, joker))
continue;
if (reg == NULL || !arch_register_type_is(reg, ignore))
continue;
if(arch_register_type_is(reg, joker))
continue;
*/
if(!op->has_constraints ||
!values_interfere(birg, insn->irn, op->carrier) ||
*/
if(!op->has_constraints ||
!values_interfere(birg, insn->irn, op->carrier) ||
static void pair_up_operands(const be_chordal_alloc_env_t *alloc_env, be_insn_t *insn)
{
const be_chordal_env_t *env = alloc_env->chordal_env;
static void pair_up_operands(const be_chordal_alloc_env_t *alloc_env, be_insn_t *insn)
{
const be_chordal_env_t *env = alloc_env->chordal_env;
-
- int n_uses = be_insn_n_uses(insn);
- int n_defs = be_insn_n_defs(insn);
- bitset_t *bs = bitset_alloca(env->cls->n_regs);
- int *pairing = alloca(MAX(n_defs, n_uses) * sizeof(pairing[0]));
-
- int i, j;
+ bitset_t *bs = bitset_alloca(env->cls->n_regs);
+ int i;
+ int j;
be_stat_ev("constr_perm", get_irn_arity(perm));
foreach_out_edge(perm, edge) {
ir_node *proj = get_edge_src_irn(edge);
be_stat_ev("constr_perm", get_irn_arity(perm));
foreach_out_edge(perm, edge) {
ir_node *proj = get_edge_src_irn(edge);
static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env,
ir_node *irn, int *silent)
{
static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env,
ir_node *irn, int *silent)
{
//bp = hungarian_new(n_regs, n_regs, 2, HUNGARIAN_MATCH_PERFECT);
bp = bipartite_new(n_regs, n_regs);
//bp = hungarian_new(n_regs, n_regs, 2, HUNGARIAN_MATCH_PERFECT);
bp = bipartite_new(n_regs, n_regs);
bitset_andnot(bs, env->ignore_colors);
bitset_foreach(bs, col) {
//hungarian_add(bp, n_alloc, col, 1);
bitset_andnot(bs, env->ignore_colors);
bitset_foreach(bs, col) {
//hungarian_add(bp, n_alloc, col, 1);
(void) pset_hinsert_ptr(alloc_env->pre_colored, irn);
DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", irn, reg->name));
}
irn = pmap_get(partners, alloc_nodes[i]);
if (irn != NULL) {
(void) pset_hinsert_ptr(alloc_env->pre_colored, irn);
DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", irn, reg->name));
}
irn = pmap_get(partners, alloc_nodes[i]);
if (irn != NULL) {
(void) pset_hinsert_ptr(alloc_env->pre_colored, irn);
DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", irn, reg->name));
}
(void) pset_hinsert_ptr(alloc_env->pre_colored, irn);
DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", irn, reg->name));
}
/* Put the colors of all Projs in a bitset. */
foreach_out_edge(perm, edge) {
ir_node *proj = get_edge_src_irn(edge);
/* Put the colors of all Projs in a bitset. */
foreach_out_edge(perm, edge) {
ir_node *proj = get_edge_src_irn(edge);
/* Assign the not yet assigned Projs of the Perm a suitable color. */
foreach_out_edge(perm, edge) {
ir_node *proj = get_edge_src_irn(edge);
/* Assign the not yet assigned Projs of the Perm a suitable color. */
foreach_out_edge(perm, edge) {
ir_node *proj = get_edge_src_irn(edge);
DBG((dbg, LEVEL_2, "\tchecking reg of %+F: %s\n", proj, reg ? reg->name : "<none>"));
DBG((dbg, LEVEL_2, "\tchecking reg of %+F: %s\n", proj, reg ? reg->name : "<none>"));
col = get_next_free_reg(alloc_env, bs);
reg = arch_register_for_index(env->cls, col);
bitset_set(bs, reg->index);
col = get_next_free_reg(alloc_env, bs);
reg = arch_register_for_index(env->cls, col);
bitset_set(bs, reg->index);
pset_insert_ptr(alloc_env->pre_colored, proj);
DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", proj, reg->name));
}
pset_insert_ptr(alloc_env->pre_colored, proj);
DBG((dbg, LEVEL_2, "\tsetting %+F to register %s\n", proj, reg->name));
}
bitset_t *live = alloc_env->live;
bitset_t *colors = alloc_env->colors;
bitset_t *in_colors = alloc_env->in_colors;
bitset_t *live = alloc_env->live;
bitset_t *colors = alloc_env->colors;
bitset_t *in_colors = alloc_env->in_colors;
struct list_head *head = get_block_border_head(env, block);
be_lv_t *lv = env->birg->lv;
struct list_head *head = get_block_border_head(env, block);
be_lv_t *lv = env->birg->lv;
be_lv_foreach(lv, block, be_lv_state_in, idx) {
irn = be_lv_get_irn(lv, block, idx);
if(has_reg_class(env, irn)) {
be_lv_foreach(lv, block, be_lv_state_in, idx) {
irn = be_lv_get_irn(lv, block, idx);
if(has_reg_class(env, irn)) {
list_for_each_entry_reverse(border_t, b, head, list) {
ir_node *irn = b->irn;
int nr = get_irn_idx(irn);
list_for_each_entry_reverse(border_t, b, head, list) {
ir_node *irn = b->irn;
int nr = get_irn_idx(irn);
col = reg->index;
assert(!bitset_is_set(colors, col) && "pre-colored register must be free");
} else {
col = get_next_free_reg(alloc_env, colors);
reg = arch_register_for_index(env->cls, col);
col = reg->index;
assert(!bitset_is_set(colors, col) && "pre-colored register must be free");
} else {
col = get_next_free_reg(alloc_env, colors);
reg = arch_register_for_index(env->cls, col);
DBG((dbg, LEVEL_1, "\tassigning register %s(%d) to %+F\n", arch_register_get_name(reg), col, irn));
DBG((dbg, LEVEL_1, "\tassigning register %s(%d) to %+F\n", arch_register_get_name(reg), col, irn));
lv = be_assure_liveness(birg);
be_liveness_assure_sets(lv);
be_liveness_assure_chk(lv);
lv = be_assure_liveness(birg);
be_liveness_assure_sets(lv);
be_liveness_assure_chk(lv);
/* Handle register targeting constraints */
dom_tree_walk_irg(irg, constraints, NULL, &env);
/* Handle register targeting constraints */
dom_tree_walk_irg(irg, constraints, NULL, &env);
env.live = bitset_malloc(get_irg_last_idx(chordal_env->irg));
/* First, determine the pressure */
env.live = bitset_malloc(get_irg_last_idx(chordal_env->irg));
/* First, determine the pressure */