X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeprefalloc.c;h=d78fd19bd87d3f0d5b765d8bd609e14ff4dcda9d;hb=3dff5ea08f916551668dc18b449327a8a593bc9f;hp=34564e176cc08669b6bc1420edadcfee8cf15f2b;hpb=f84594874e48e9883cfb1e040856f3f56782c956;p=libfirm diff --git a/ir/be/beprefalloc.c b/ir/be/beprefalloc.c index 34564e176..d78fd19bd 100644 --- a/ir/be/beprefalloc.c +++ b/ir/be/beprefalloc.c @@ -60,7 +60,7 @@ #include "unionfind.h" #include "pdeq.h" #include "hungarian.h" - +#include "statev.h" #include "beabi.h" #include "bechordal_t.h" #include "be.h" @@ -257,13 +257,13 @@ static void check_defs(const ir_nodeset_t *live_nodes, float weight, ir_node *node) { const arch_register_req_t *req = arch_get_irn_register_req(node); - if (req->type & arch_register_req_type_limited) { + if (arch_register_req_is(req, limited)) { const unsigned *limited = req->limited; float penalty = weight * DEF_FACTOR; give_penalties_for_limits(live_nodes, penalty, limited, node); } - if (req->type & arch_register_req_type_should_be_same) { + if (arch_register_req_is(req, should_be_same)) { ir_node *insn = skip_Proj(node); allocation_info_t *info = get_allocation_info(node); int arity = get_irn_arity(insn); @@ -306,7 +306,6 @@ static void analyze_block(ir_node *block, void *data) if (is_Phi(node)) break; - ir_node *value; be_foreach_definition(node, cls, value, check_defs(&live_nodes, weight, value); ); @@ -345,7 +344,7 @@ static void analyze_block(ir_node *block, void *data) const arch_register_req_t *req = arch_get_irn_register_req_in(node, i); - if (!(req->type & arch_register_req_type_limited)) + if (!arch_register_req_is(req, limited)) continue; const unsigned *limited = req->limited; @@ -362,7 +361,7 @@ static void congruence_def(ir_nodeset_t *live_nodes, const ir_node *node) const arch_register_req_t *req = arch_get_irn_register_req(node); /* should be same constraint? */ - if (req->type & arch_register_req_type_should_be_same) { + if (arch_register_req_is(req, should_be_same)) { const ir_node *insn = skip_Proj_const(node); int arity = get_irn_arity(insn); unsigned node_idx = get_irn_idx(node); @@ -410,7 +409,6 @@ static void create_congruence_class(ir_node *block, void *data) /* check should be same constraints */ ir_node *last_phi = NULL; sched_foreach_reverse(block, node) { - ir_node *value; if (is_Phi(node)) { last_phi = node; break; @@ -595,7 +593,7 @@ static bool try_optimistic_split(ir_node *to_split, ir_node *before, allocation_info_t *info = get_allocation_info(to_split); float delta = 0; - /* stupid hack: don't optimisticallt split don't spill nodes... + /* stupid hack: don't optimistically split don't spill nodes... * (so we don't split away the values produced because of * must_be_different constraints) */ ir_node *original_insn = skip_Proj(info->original_value); @@ -699,12 +697,12 @@ static void assign_reg(const ir_node *block, ir_node *node, } /* ignore reqs must be preassigned */ - assert (! (req->type & arch_register_req_type_ignore)); + assert(!arch_register_req_is(req, ignore)); /* give should_be_same boni */ allocation_info_t *info = get_allocation_info(node); ir_node *in_node = skip_Proj(node); - if (req->type & arch_register_req_type_should_be_same) { + if (arch_register_req_is(req, should_be_same)) { float weight = (float)get_block_execfreq(block); int arity = get_irn_arity(in_node); @@ -740,7 +738,7 @@ static void assign_reg(const ir_node *block, ir_node *node, DB((dbg, LEVEL_2, "\n")); const unsigned *allowed_regs = normal_regs; - if (req->type & arch_register_req_type_limited) { + if (arch_register_req_is(req, limited)) { allowed_regs = req->limited; } @@ -752,8 +750,7 @@ static void assign_reg(const ir_node *block, ir_node *node, continue; /* alignment constraint? */ if (width > 1) { - if ((req->type & arch_register_req_type_aligned) - && (final_reg_index % width) != 0) + if (arch_register_req_is(req, aligned) && (final_reg_index % width) != 0) continue; bool fine = true; for (unsigned r0 = r+1; r0 < r+width; ++r0) { @@ -1044,7 +1041,7 @@ static void solve_lpp(ir_nodeset_t *live_nodes, ir_node *node, continue; const arch_register_req_t *req = arch_get_irn_register_req_in(node, i); - if (!(req->type & arch_register_req_type_limited)) + if (!arch_register_req_is(req, limited)) continue; const unsigned *limited = req->limited; @@ -1182,13 +1179,13 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node, double_width = true; const arch_register_t *reg = arch_get_irn_register(op); unsigned reg_index = reg->index; - if (req->type & arch_register_req_type_aligned) { + if (arch_register_req_is(req, aligned)) { if (!is_aligned(reg_index, req->width)) { good = false; continue; } } - if (!(req->type & arch_register_req_type_limited)) + if (!arch_register_req_is(req, limited)) continue; const unsigned *limited = req->limited; @@ -1200,15 +1197,15 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node, } /* is any of the live-throughs using a constrained output register? */ - ir_node *value; unsigned *live_through_regs = NULL; be_foreach_definition(node, cls, value, + (void)value; if (req_->width > 1) double_width = true; - if (! (req_->type & arch_register_req_type_limited)) + if (!arch_register_req_is(req_, limited)) continue; if (live_through_regs == NULL) { - rbitset_alloca(live_through_regs, n_regs); + live_through_regs = rbitset_alloca(n_regs); determine_live_through_regs(live_through_regs, node); } rbitset_or(forbidden_regs, req_->limited, n_regs); @@ -1221,7 +1218,7 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node, /* create these arrays if we haven't yet */ if (live_through_regs == NULL) { - rbitset_alloca(live_through_regs, n_regs); + live_through_regs = rbitset_alloca(n_regs); } if (double_width) { @@ -1264,7 +1261,7 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node, continue; const arch_register_req_t *req = arch_get_irn_register_req_in(node, i); - if (!(req->type & arch_register_req_type_limited)) + if (!arch_register_req_is(req, limited)) continue; const unsigned *limited = req->limited; @@ -1365,9 +1362,8 @@ static void add_phi_permutations(ir_node *block, int p) ir_node *op = pred_info->assignments[a]; const arch_register_t *op_reg = arch_get_irn_register(op); - /* virtual or joker registers are ok too */ - if ((op_reg->type & arch_register_type_joker) - || (op_reg->type & arch_register_type_virtual)) + /* Virtual registers are ok, too. */ + if (op_reg->type & arch_register_type_virtual) continue; permutation[regn] = a; @@ -1574,7 +1570,7 @@ static void allocate_coalesce_block(ir_node *block, void *data) if (req->cls != cls) continue; - if (req->type & arch_register_req_type_ignore) { + if (arch_register_req_is(req, limited)) { allocation_info_t *info = get_allocation_info(node); info->current_value = node; @@ -1652,9 +1648,8 @@ static void allocate_coalesce_block(ir_node *block, void *data) ir_nodeset_insert(&live_nodes, node); } - unsigned *forbidden_regs; /**< collects registers which must - not be used for optimistic splits */ - rbitset_alloca(forbidden_regs, n_regs); + /** Collects registers which must not be used for optimistic splits. */ + unsigned *const forbidden_regs = rbitset_alloca(n_regs); /* handle phis... */ assign_phi_registers(block); @@ -1696,7 +1691,6 @@ static void allocate_coalesce_block(ir_node *block, void *data) free_last_uses(&live_nodes, node); /* assign output registers */ - ir_node *value; be_foreach_definition_(node, cls, value, assign_reg(block, value, forbidden_regs); );