#include "debug.h"
#include "error.h"
-#include "execfreq.h"
+#include "execfreq_t.h"
#include "irdump_t.h"
#include "iredges_t.h"
#include "irgraph.h"
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
*/
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;
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.
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)
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);
int co_get_max_copy_costs(const copy_opt_t *co)
{
int i, res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
int co_get_inevit_copy_costs(const copy_opt_t *co)
{
int res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
int co_get_copy_costs(const copy_opt_t *co)
{
int i, res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
int co_get_lower_bound(const copy_opt_t *co)
{
int res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(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) {
}
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)];