projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ia32: cleanup handling of 8/16bit operations
[libfirm]
/
ir
/
be
/
becopyopt.c
diff --git
a/ir/be/becopyopt.c
b/ir/be/becopyopt.c
index
acc6402
..
762a8a1
100644
(file)
--- a/
ir/be/becopyopt.c
+++ b/
ir/be/becopyopt.c
@@
-32,7
+32,7
@@
#include "debug.h"
#include "error.h"
#include "debug.h"
#include "error.h"
-#include "execfreq.h"
+#include "execfreq
_t
.h"
#include "irdump_t.h"
#include "iredges_t.h"
#include "irgraph.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;
}
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
/**
* 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)
{
*/
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;
= 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;
/* 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;
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.
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;
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)
/* 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)
{
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);
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;
int co_get_max_copy_costs(const copy_opt_t *co)
{
int i, res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
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;
int co_get_inevit_copy_costs(const copy_opt_t *co)
{
int res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
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;
int co_get_copy_costs(const copy_opt_t *co)
{
int i, res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
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;
int co_get_lower_bound(const copy_opt_t *co)
{
int res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
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));
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) {
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) {
stat->aff_nodes += 1;
bitset_set(seen, get_irn_idx(an->irn));
co_gs_foreach_neighb(an, neigh) {
@@
-787,7
+779,7
@@
static void add_edge(copy_opt_t *co, ir_node *n1, ir_node *n2, int costs)
new_node.irn = n1;
new_node.degree = 0;
new_node.neighbours = NULL;
new_node.irn = n1;
new_node.degree = 0;
new_node.neighbours = NULL;
- node =
(affinity_node_t*)set_insert(
co->nodes, &new_node, sizeof(new_node), hash_irn(new_node.irn));
+ node =
set_insert(affinity_node_t,
co->nodes, &new_node, sizeof(new_node), hash_irn(new_node.irn));
for (nbr = node->neighbours; nbr; nbr = nbr->next)
if (nbr->irn == n2) {
for (nbr = node->neighbours; nbr; nbr = nbr->next)
if (nbr->irn == n2) {
@@
-878,7
+870,7
@@
int co_gs_is_optimizable(copy_opt_t *co, ir_node *irn)
ASSERT_GS_AVAIL(co);
new_node.irn = irn;
ASSERT_GS_AVAIL(co);
new_node.irn = irn;
- n =
(affinity_node_t*)set_find(
co->nodes, &new_node, sizeof(new_node), hash_irn(new_node.irn));
+ n =
set_find(affinity_node_t,
co->nodes, &new_node, sizeof(new_node), hash_irn(new_node.irn));
if (n) {
return (n->degree > 0);
} else
if (n) {
return (n->degree > 0);
} else
@@
-975,8
+967,6
@@
static void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
}
if (a) {
}
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)];
co_gs_foreach_neighb(a, n) {
if (!arch_irn_is_ignore(n->irn)) {
int n_idx = node_map[get_irn_idx(n->irn)];