X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbecopyopt.c;h=762a8a164114c75c817d9a8ad6406a001bd5ae52;hb=30369d28b8fabe4f66cee12f42ee475d9444cf9e;hp=9941915100e0d33dcd47d05ed8440785ead60739;hpb=7d61ad5fbb6a87bea369c8a01103a92d9ab79a48;p=libfirm diff --git a/ir/be/becopyopt.c b/ir/be/becopyopt.c index 994191510..762a8a164 100644 --- a/ir/be/becopyopt.c +++ b/ir/be/becopyopt.c @@ -32,7 +32,7 @@ #include "debug.h" #include "error.h" -#include "execfreq.h" +#include "execfreq_t.h" #include "irdump_t.h" #include "iredges_t.h" #include "irgraph.h" @@ -280,6 +280,8 @@ static int co_get_costs_loop_depth(const ir_node *root, int pos) return 1+cost; } +static ir_execfreq_int_factors factors; + /** * Computes the costs of a copy according to execution frequency * @param pos the argument position of arg in the root arguments @@ -287,12 +289,10 @@ static int co_get_costs_loop_depth(const ir_node *root, int pos) */ static int co_get_costs_exec_freq(const ir_node *root, int pos) { - ir_graph *irg = get_irn_irg(root); - ir_node *root_bl = get_nodes_block(root); - ir_node *copy_bl + ir_node *root_bl = get_nodes_block(root); + ir_node *copy_bl = is_Phi(root) ? get_Block_cfgpred_block(root_bl, pos) : root_bl; - ir_exec_freq *exec_freq = be_get_irg_exec_freq(irg); - int res = get_block_execfreq_ulong(exec_freq, copy_bl); + int res = get_block_execfreq_int(&factors, copy_bl); /* don't allow values smaller than one. */ return res < 1 ? 1 : res; @@ -331,7 +331,6 @@ static int ou_max_ind_set_costs(unit_t *ou) ir_node **safe, **unsafe; int i, o, safe_count, safe_costs, unsafe_count, *unsafe_costs; bitset_t *curr; - size_t pos; int curr_weight, best_weight = 0; /* assign the nodes into two groups. @@ -605,7 +604,7 @@ static int compare_ous(const void *k1, const void *k2) static void co_sort_units(copy_opt_t *co) { int i, count = 0, costs; - unit_t *ou, **ous; + unit_t **ous; /* get the number of ous, remove them form the list and fill the array */ list_for_each_entry(unit_t, ou, &co->units, units) @@ -651,7 +650,6 @@ void co_build_ou_structure(copy_opt_t *co) void co_free_ou_structure(copy_opt_t *co) { - unit_t *curr, *tmp; ASSERT_OU_AVAIL(co); list_for_each_entry_safe(unit_t, curr, tmp, &co->units, units) { xfree(curr->nodes); @@ -666,7 +664,6 @@ void co_free_ou_structure(copy_opt_t *co) int co_get_max_copy_costs(const copy_opt_t *co) { int i, res = 0; - unit_t *curr; ASSERT_OU_AVAIL(co); @@ -681,7 +678,6 @@ int co_get_max_copy_costs(const copy_opt_t *co) int co_get_inevit_copy_costs(const copy_opt_t *co) { int res = 0; - unit_t *curr; ASSERT_OU_AVAIL(co); @@ -693,7 +689,6 @@ int co_get_inevit_copy_costs(const copy_opt_t *co) int co_get_copy_costs(const copy_opt_t *co) { int i, res = 0; - unit_t *curr; ASSERT_OU_AVAIL(co); @@ -715,7 +710,6 @@ int co_get_copy_costs(const copy_opt_t *co) int co_get_lower_bound(const copy_opt_t *co) { int res = 0; - unit_t *curr; ASSERT_OU_AVAIL(co); @@ -727,13 +721,11 @@ int co_get_lower_bound(const copy_opt_t *co) void co_complete_stats(const copy_opt_t *co, co_complete_stats_t *stat) { bitset_t *seen = bitset_malloc(get_irg_last_idx(co->irg)); - affinity_node_t *an; memset(stat, 0, sizeof(stat[0])); /* count affinity edges. */ co_gs_foreach_aff_node(co, an) { - neighb_t *neigh; stat->aff_nodes += 1; bitset_set(seen, get_irn_idx(an->irn)); co_gs_foreach_neighb(an, neigh) { @@ -975,8 +967,6 @@ static void co_dump_appel_graph(const copy_opt_t *co, FILE *f) } if (a) { - neighb_t *n; - co_gs_foreach_neighb(a, n) { if (!arch_irn_is_ignore(n->irn)) { int n_idx = node_map[get_irn_idx(n->irn)];