add a note so the next person doesn't have to dig so long anymore
[libfirm] / ir / be / beprefalloc.c
index feefba3..4b7f8fa 100644 (file)
@@ -252,7 +252,7 @@ static void give_penalties_for_limits(const ir_nodeset_t *live_nodes,
                return;
 
        penalty   *= NEIGHBOR_FACTOR;
-       n_allowed  = rbitset_popcnt(limited, n_regs);
+       n_allowed  = rbitset_popcount(limited, n_regs);
        if (n_allowed > 1) {
                /* only create a very weak penalty if multiple regs are allowed */
                penalty = (penalty * 0.8f) / n_allowed;
@@ -314,7 +314,7 @@ static void check_defs(const ir_nodeset_t *live_nodes, float weight,
                int                arity = get_irn_arity(insn);
                int                i;
 
-               float factor = 1.0f / rbitset_popcnt(&req->other_same, arity);
+               float factor = 1.0f / rbitset_popcount(&req->other_same, arity);
                for (i = 0; i < arity; ++i) {
                        ir_node           *op;
                        unsigned           r;
@@ -345,7 +345,7 @@ static void check_defs(const ir_nodeset_t *live_nodes, float weight,
  */
 static void analyze_block(ir_node *block, void *data)
 {
-       float         weight = get_block_execfreq(execfreqs, block);
+       float         weight = (float)get_block_execfreq(execfreqs, block);
        ir_nodeset_t  live_nodes;
        ir_node      *node;
        (void) data;
@@ -693,7 +693,7 @@ static bool try_optimistic_split(ir_node *to_split, ir_node *before,
        from_reg        = arch_get_irn_register(to_split);
        from_r          = arch_register_get_index(from_reg);
        block           = get_nodes_block(before);
-       split_threshold = get_block_execfreq(execfreqs, block) * SPLIT_DELTA;
+       split_threshold = (float)get_block_execfreq(execfreqs, block) * SPLIT_DELTA;
 
        if (pref_delta < split_threshold*0.5)
                return false;
@@ -804,7 +804,7 @@ static void assign_reg(const ir_node *block, ir_node *node,
 
        in_node = skip_Proj(node);
        if (req->type & arch_register_req_type_should_be_same) {
-               float weight = get_block_execfreq(execfreqs, block);
+               float weight = (float)get_block_execfreq(execfreqs, block);
                int   arity  = get_irn_arity(in_node);
                int   i;
 
@@ -1021,12 +1021,12 @@ static void permute_values(ir_nodeset_t *live_nodes, ir_node *before,
                DB((dbg, LEVEL_2, "Perm %+F (perm %+F,%+F, before %+F)\n",
                    perm, in[0], in[1], before));
 
-               proj0 = new_r_Proj(block, perm, get_irn_mode(in[0]), 0);
+               proj0 = new_r_Proj(perm, get_irn_mode(in[0]), 0);
                mark_as_copy_of(proj0, in[0]);
                reg = arch_register_for_index(cls, old_r);
                use_reg(proj0, reg);
 
-               proj1 = new_r_Proj(block, perm, get_irn_mode(in[1]), 1);
+               proj1 = new_r_Proj(perm, get_irn_mode(in[1]), 1);
                mark_as_copy_of(proj1, in[1]);
                reg = arch_register_for_index(cls, r2);
                use_reg(proj1, reg);
@@ -1448,7 +1448,7 @@ static void adapt_phi_prefs(ir_node *phi)
                        continue;
 
                /* give bonus for already assigned register */
-               weight = get_block_execfreq(execfreqs, pred_block);
+               weight = (float)get_block_execfreq(execfreqs, pred_block);
                r      = arch_register_get_index(reg);
                info->prefs[r] += weight * AFF_PHI;
        }
@@ -1470,7 +1470,7 @@ static void propagate_phi_register(ir_node *phi, unsigned assigned_r)
                ir_node           *pred_block = get_Block_cfgpred_block(block, i);
                unsigned           r;
                float              weight
-                       = get_block_execfreq(execfreqs, pred_block) * AFF_PHI;
+                       = (float)get_block_execfreq(execfreqs, pred_block) * AFF_PHI;
 
                if (info->prefs[assigned_r] >= weight)
                        continue;
@@ -1536,7 +1536,7 @@ static void assign_phi_registers(ir_node *block)
                        costs = costs < 0 ? -logf(-costs+1) : logf(costs+1);
                        costs *= 100;
                        costs += 10000;
-                       hungarian_add(bp, n, r, costs);
+                       hungarian_add(bp, n, r, (int)costs);
                        DB((dbg, LEVEL_3, " %s(%f)", arch_register_for_index(cls, r)->name,
                                                info->prefs[r]));
                }
@@ -1814,7 +1814,7 @@ static void determine_block_order(void)
                block_costs_t *cost_info;
                ir_node *block = blocklist[i];
 
-               float execfreq   = get_block_execfreq(execfreqs, block);
+               float execfreq   = (float)get_block_execfreq(execfreqs, block);
                float costs      = execfreq;
                int   n_cfgpreds = get_Block_n_cfgpreds(block);
                int   p;
@@ -1869,7 +1869,7 @@ static void determine_block_order(void)
                                }
                        }
                        block = best_pred;
-               } while(block != NULL && !Block_block_visited(block));
+               } while (block != NULL && !Block_block_visited(block));
 
                /* now put all nodes in the worklist in our final order */
                while (!pdeq_empty(worklist)) {
@@ -1923,7 +1923,7 @@ static void be_pref_alloc_cls(void)
 static void dump(int mask, ir_graph *irg, const char *suffix,
                  void (*dumper)(ir_graph *, const char *))
 {
-       if(birg->main_env->options->dump_flags & mask)
+       if (birg->main_env->options->dump_flags & mask)
                be_dump(irg, suffix, dumper);
 }
 
@@ -2024,9 +2024,7 @@ static void be_pref_alloc(be_irg_t *new_birg)
        obstack_free(&obst, NULL);
 }
 
-/**
- * Initializes this module.
- */
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_pref_alloc);
 void be_init_pref_alloc(void)
 {
        static be_ra_t be_ra_pref = {
@@ -2039,5 +2037,3 @@ void be_init_pref_alloc(void)
        be_register_allocator("pref", &be_ra_pref);
        FIRM_DBG_REGISTER(dbg, "firm.be.prefalloc");
 }
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_pref_alloc);