Commit 0e5f781d authored by Sebastian Hack's avatar Sebastian Hack
Browse files

Changed phase node initializer to take const ir_node

Adapted all the files to that -> constification
Added irg managed phases -> scheduling uses that now.

[r16820]
parent a41668ac
......@@ -52,7 +52,7 @@ typedef struct {
unsigned visited;
} irn_height_t;
static void *irn_height_init(ir_phase *ph, ir_node *irn, void *data)
static void *irn_height_init(ir_phase *ph, const ir_node *irn, void *data)
{
irn_height_t *h = data ? data : phase_alloc(ph, sizeof(h[0]));
(void)irn;
......
......@@ -61,7 +61,7 @@
#include "statev.h"
typedef struct _bl_info_t {
ir_node *block; /**< The block. */
const ir_node *block; /**< The block. */
int be_tgt_calc : 1;
int id : 31; /**< a tight number for the block.
......@@ -87,7 +87,7 @@ struct _lv_chk_t {
bl_info_t **map;
};
static void *init_block_data(ir_phase *ph, ir_node *irn, void *old)
static void *init_block_data(ir_phase *ph, const ir_node *irn, void *old)
{
lv_chk_t *lv = container_of(ph, lv_chk_t, ph);
bl_info_t *bi = phase_alloc(ph, sizeof(bi[0]));
......@@ -164,7 +164,7 @@ static void red_trans_closure(lv_chk_t *lv)
}
static void compute_back_edge_chain(lv_chk_t *lv, ir_node *bl)
static void compute_back_edge_chain(lv_chk_t *lv, const ir_node *bl)
{
bitset_t *tmp = bitset_alloca(lv->n_blocks);
bl_info_t *bi = get_block_info(lv, bl);
......
......@@ -64,7 +64,7 @@ static INLINE void _set_phi_class(ir_phase *ph, ir_node *irn, ir_node ***cls) {
}
/* initialize data structure for given irn in given phase */
static void *irn_phi_class_init(ir_phase *ph, ir_node *irn, void *data) {
static void *irn_phi_class_init(ir_phase *ph, const ir_node *irn, void *data) {
irn_phi_class_t *ipc = data ? data : phase_alloc(ph, sizeof(ipc[0]));
(void) irn;
memset(ipc, 0, sizeof(ipc[0]));
......
......@@ -143,8 +143,10 @@ typedef enum arch_irn_flags_t {
*/
extern const char *arch_irn_flag_str(arch_irn_flags_t flag);
#if 0
extern const arch_irn_ops_t *arch_get_irn_ops(const arch_env_t *env,
const ir_node *irn);
#endif
extern void arch_set_frame_offset(const arch_env_t *env, ir_node *irn, int bias);
......
......@@ -135,7 +135,7 @@ typedef struct {
} co2_t;
struct _co2_irn_t {
ir_node *irn;
const ir_node *irn;
affinity_node_t *aff;
co2_irn_t *touched_next;
col_t tmp_col;
......@@ -195,7 +195,7 @@ typedef struct {
#define get_co2_irn(co2, irn) ((co2_irn_t *) phase_get_or_set_irn_data(&co2->ph, irn))
#define get_co2_cloud_irn(co2, irn) ((co2_cloud_irn_t *) phase_get_or_set_irn_data(&co2->ph, irn))
static void *co2_irn_init(ir_phase *ph, ir_node *irn, void *data)
static void *co2_irn_init(ir_phase *ph, const ir_node *irn, void *data)
{
co2_t *env = (co2_t *) ph;
affinity_node_t *a = get_affinity_info(env->co, irn);
......@@ -250,13 +250,13 @@ int cmp_edges(const void *a, const void *b)
return QSORT_CMP(q->costs, p->costs);
}
static col_t get_col(co2_t *env, ir_node *irn)
static col_t get_col(co2_t *env, const ir_node *irn)
{
co2_irn_t *ci = get_co2_irn(env, irn);
return ci->tmp_fixed ? ci->tmp_col : ci->orig_col;
}
static INLINE int color_is_fix(co2_t *env, ir_node *irn)
static INLINE int color_is_fix(co2_t *env, const ir_node *irn)
{
co2_irn_t *ci = get_co2_irn(env, irn);
return ci->fixed || ci->tmp_fixed;
......@@ -306,7 +306,7 @@ static INLINE int is_constrained(co2_t *env, co2_irn_t *ci)
return ci->is_constrained;
}
static void incur_constraint_costs(co2_t *env, ir_node *irn, col_cost_pair_t *col_costs, int costs)
static void incur_constraint_costs(co2_t *env, const ir_node *irn, col_cost_pair_t *col_costs, int costs)
{
const arch_register_req_t *req;
......@@ -338,14 +338,14 @@ static void incur_constraint_costs(co2_t *env, ir_node *irn, col_cost_pair_t *co
*/
static void determine_color_costs(co2_t *env, co2_irn_t *ci, col_cost_pair_t *col_costs)
{
ir_node *irn = ci->irn;
const ir_node *irn = ci->irn;
be_ifg_t *ifg = env->co->cenv->ifg;
int n_regs = env->co->cls->n_regs;
bitset_t *forb = bitset_alloca(n_regs);
affinity_node_t *a = ci->aff;
bitset_pos_t elm;
ir_node *pos;
const ir_node *pos;
void *it;
int i;
......@@ -426,9 +426,9 @@ static void materialize_coloring(struct list_head *h)
}
}
static int change_color_not(co2_t *env, ir_node *irn, col_t not_col, struct list_head *parent_changed, int depth);
static int change_color_not(co2_t *env, const ir_node *irn, col_t not_col, struct list_head *parent_changed, int depth);
static int recolor(co2_t *env, ir_node *irn, col_cost_pair_t *col_list, struct list_head *parent_changed, int depth)
static int recolor(co2_t *env, const ir_node *irn, col_cost_pair_t *col_list, struct list_head *parent_changed, int depth)
{
int n_regs = env->co->cls->n_regs;
be_ifg_t *ifg = env->co->cenv->ifg;
......@@ -446,7 +446,7 @@ static int recolor(co2_t *env, ir_node *irn, col_cost_pair_t *col_list, struct l
int neigh_ok = 1;
struct list_head changed;
ir_node *n;
const ir_node *n;
void *it;
DBG((env->dbg, LEVEL_3, "\t\t%2{firm:indent}trying color %d(%d) on %+F\n", depth, tgt_col, costs, irn));
......@@ -513,7 +513,7 @@ static int recolor(co2_t *env, ir_node *irn, col_cost_pair_t *col_list, struct l
return res;
}
static int change_color_not(co2_t *env, ir_node *irn, col_t not_col, struct list_head *parent_changed, int depth)
static int change_color_not(co2_t *env, const ir_node *irn, col_t not_col, struct list_head *parent_changed, int depth)
{
co2_irn_t *ci = get_co2_irn(env, irn);
int res = 0;
......@@ -554,7 +554,7 @@ static int change_color_not(co2_t *env, ir_node *irn, col_t not_col, struct list
return res;
}
static int change_color_single(co2_t *env, ir_node *irn, col_t tgt_col, struct list_head *parent_changed, int depth)
static int change_color_single(co2_t *env, const ir_node *irn, col_t tgt_col, struct list_head *parent_changed, int depth)
{
co2_irn_t *ci = get_co2_irn(env, irn);
col_t col = get_col(env, irn);
......@@ -632,7 +632,7 @@ static void node_color_badness(co2_cloud_irn_t *ci, int *badness)
bitset_t *bs = bitset_alloca(n_regs);
bitset_pos_t elm;
ir_node *irn;
const ir_node *irn;
void *it;
admissible_colors(env, &ci->inh, bs);
......@@ -863,7 +863,7 @@ static co2_cloud_t *new_cloud(co2_t *env, affinity_node_t *a)
static void apply_coloring(co2_cloud_irn_t *ci, col_t col, int depth)
{
ir_node *irn = ci->inh.irn;
const ir_node *irn = ci->inh.irn;
int *front = FRONT_BASE(ci, col);
int i, ok;
struct list_head changed;
......@@ -1104,7 +1104,7 @@ static void writeback_colors(co2_t *env)
for(irn = env->touched; irn; irn = irn->touched_next) {
const arch_register_t *reg = arch_register_for_index(env->co->cls, irn->orig_col);
arch_set_irn_register(aenv, irn->irn, reg);
arch_set_irn_register(aenv, (ir_node *) irn->irn, reg);
}
}
......
......@@ -91,23 +91,23 @@ typedef struct _col_cost_t {
* An affinity chunk.
*/
typedef struct _aff_chunk_t {
ir_node **n; /**< An ARR_F containing all nodes of the chunk. */
bitset_t *nodes; /**< A bitset containing all nodes inside this chunk. */
bitset_t *interfere; /**< A bitset containing all interfering neighbours of the nodes in this chunk. */
int weight; /**< Weight of this chunk */
unsigned weight_consistent : 1; /**< Set if the weight is consistent. */
unsigned deleted : 1; /**< Set if the was deleted. */
int id; /**< For debugging: An id of this chunk. */
int visited;
col_cost_t *color_affinity;
const ir_node **n; /**< An ARR_F containing all nodes of the chunk. */
bitset_t *nodes; /**< A bitset containing all nodes inside this chunk. */
bitset_t *interfere; /**< A bitset containing all interfering neighbours of the nodes in this chunk. */
int weight; /**< Weight of this chunk */
unsigned weight_consistent : 1; /**< Set if the weight is consistent. */
unsigned deleted : 1; /**< Set if the was deleted. */
int id; /**< For debugging: An id of this chunk. */
int visited;
col_cost_t *color_affinity;
} aff_chunk_t;
/**
* An affinity edge.
*/
typedef struct _aff_edge_t {
ir_node *src; /**< Source node. */
ir_node *tgt; /**< Target node. */
const ir_node *src; /**< Source node. */
const ir_node *tgt; /**< Target node. */
double weight; /**< The weight of this edge. */
} aff_edge_t;
......@@ -128,7 +128,7 @@ typedef struct _co_mst_env_t {
/* stores coalescing related information for a node */
typedef struct _co_mst_irn_t {
ir_node *irn; /**< the irn this information belongs to */
const ir_node *irn; /**< the irn this information belongs to */
aff_chunk_t *chunk; /**< the chunk this irn belongs to */
bitset_t *adm_colors; /**< set of admissible colors for this irn */
ir_node **int_neighs; /**< array of all interfering neighbours (cached for speed reasons) */
......@@ -253,7 +253,7 @@ static INLINE aff_chunk_t *new_aff_chunk(co_mst_env_t *env) {
aff_chunk_t *c = xmalloc(sizeof(*c));
c->weight = -1;
c->weight_consistent = 0;
c->n = NEW_ARR_F(ir_node *, 0);
c->n = NEW_ARR_F(const ir_node *, 0);
c->nodes = bitset_irg_malloc(env->co->irg);
c->interfere = bitset_irg_malloc(env->co->irg);
c->color_affinity = xmalloc(env->n_regs * sizeof(c->color_affinity[0]));
......@@ -300,7 +300,7 @@ static INLINE void aff_chunk_add_node(aff_chunk_t *c, co_mst_irn_t *node) {
/**
* In case there is no phase information for irn, initialize it.
*/
static void *co_mst_irn_init(ir_phase *ph, ir_node *irn, void *old) {
static void *co_mst_irn_init(ir_phase *ph, const ir_node *irn, void *old) {
co_mst_irn_t *res = old ? old : phase_alloc(ph, sizeof(res[0]));
co_mst_env_t *env = ph->priv;
......@@ -358,7 +358,7 @@ static void *co_mst_irn_init(ir_phase *ph, ir_node *irn, void *old) {
/**
* Check if affinity chunk @p chunk interferes with node @p irn.
*/
static INLINE int aff_chunk_interferes(co_mst_env_t *env, const aff_chunk_t *chunk, ir_node *irn) {
static INLINE int aff_chunk_interferes(co_mst_env_t *env, const aff_chunk_t *chunk, const ir_node *irn) {
(void) env;
return bitset_is_set(chunk->interfere, get_irn_idx(irn));
}
......@@ -383,7 +383,7 @@ static INLINE int aff_chunks_interfere(co_mst_env_t *env, const aff_chunk_t *c1,
* Returns the affinity chunk of @p irn or creates a new
* one with @p irn as element if there is none assigned.
*/
static INLINE aff_chunk_t *get_aff_chunk(co_mst_env_t *env, ir_node *irn) {
static INLINE aff_chunk_t *get_aff_chunk(co_mst_env_t *env, const ir_node *irn) {
co_mst_irn_t *node = get_co_mst_irn(env, irn);
return node->chunk;
}
......@@ -393,7 +393,7 @@ static INLINE aff_chunk_t *get_aff_chunk(co_mst_env_t *env, ir_node *irn) {
* are no interference edges from chunk(src) to chunk(tgt)).
* @return 1 if successful, 0 if not possible
*/
static int aff_chunk_absorb(co_mst_env_t *env, ir_node *src, ir_node *tgt) {
static int aff_chunk_absorb(co_mst_env_t *env, const ir_node *src, const ir_node *tgt) {
aff_chunk_t *c1 = get_aff_chunk(env, src);
aff_chunk_t *c2 = get_aff_chunk(env, tgt);
......@@ -477,7 +477,7 @@ static void aff_chunk_assure_weight(co_mst_env_t *env, aff_chunk_t *c) {
}
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
ir_node *n = c->n[idx];
const ir_node *n = c->n[idx];
const affinity_node_t *an = get_affinity_info(env->co, n);
co_mst_irn_t *node = get_co_mst_irn(env, n);
......@@ -517,7 +517,7 @@ static void aff_chunk_assure_weight(co_mst_env_t *env, aff_chunk_t *c) {
*/
static int count_interfering_aff_neighs(co_mst_env_t *env, const affinity_node_t *an) {
const neighb_t *neigh;
ir_node *irn = an->irn;
const ir_node *irn = an->irn;
const co_mst_irn_t *node = get_co_mst_irn(env, irn);
int res = 0;
......@@ -576,8 +576,8 @@ static void build_affinity_chunks(co_mst_env_t *env) {
/* build the affinity edges */
co_gs_foreach_neighb(an, neigh) {
ir_node *m = neigh->irn;
int m_idx = get_irn_idx(m);
const ir_node *m = neigh->irn;
int m_idx = get_irn_idx(m);
/* record the edge in only one direction */
if (n_idx < m_idx) {
......@@ -650,13 +650,13 @@ static void build_affinity_chunks(co_mst_env_t *env) {
static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chunk_t *chunk)
{
pqueue *grow = new_pqueue();
int i;
const ir_node *max_node = NULL;
int max_weight = 0;
ir_node *max_node = NULL;
int i;
for (i = ARR_LEN(chunk->n) - 1; i >= 0; i--) {
ir_node *irn = chunk->n[i];
affinity_node_t *an = get_affinity_info(env->co, irn);
const ir_node *irn = chunk->n[i];
affinity_node_t *an = get_affinity_info(env->co, irn);
int w = 0;
neighb_t *neigh;
......@@ -680,7 +680,7 @@ static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu
for (i = ARR_LEN(chunk->n) - 1; i >= 0; --i)
bitset_add_irn(visited, chunk->n[i]);
pqueue_put(grow, max_node, max_weight);
pqueue_put(grow, (void *) max_node, max_weight);
bitset_remv_irn(visited, max_node);
i = 0;
while (!pqueue_empty(grow)) {
......@@ -701,7 +701,7 @@ static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu
co_mst_irn_t *node = get_co_mst_irn(env, neigh->irn);
if (bitset_contains_irn(visited, node->irn)) {
pqueue_put(grow, neigh->irn, neigh->costs);
pqueue_put(grow, (void *) neigh->irn, neigh->costs);
bitset_remv_irn(visited, node->irn);
}
}
......@@ -737,8 +737,8 @@ static void expand_chunk_from(co_mst_env_t *env, co_mst_irn_t *node, bitset_t *v
if (an != NULL) {
neighb_t *neigh;
co_gs_foreach_neighb(an, neigh) {
ir_node *m = neigh->irn;
int m_idx = get_irn_idx(m);
const ir_node *m = neigh->irn;
int m_idx = get_irn_idx(m);
co_mst_irn_t *n2;
/* skip ignore nodes */
......@@ -785,7 +785,7 @@ static aff_chunk_t *fragment_chunk(co_mst_env_t *env, int col, aff_chunk_t *c, w
aff_chunk_t *best = NULL;
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
ir_node *irn;
const ir_node *irn;
co_mst_irn_t *node;
aff_chunk_t *tmp_chunk;
decide_func_t *decider;
......@@ -1152,7 +1152,7 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) {
/* try to bring all nodes of given chunk to the current color. */
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
ir_node *irn = c->n[idx];
const ir_node *irn = c->n[idx];
co_mst_irn_t *node = get_co_mst_irn(env, irn);
int good;
......@@ -1244,8 +1244,8 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) {
DB((dbg, LEVEL_2, "using color %d\n", best_color));
for (idx = 0, len = ARR_LEN(best_chunk->n); idx < len; ++idx) {
ir_node *irn = best_chunk->n[idx];
co_mst_irn_t *node = get_co_mst_irn(env, irn);
const ir_node *irn = best_chunk->n[idx];
co_mst_irn_t *node = get_co_mst_irn(env, irn);
int res;
/* bring the node to the color. */
......@@ -1264,7 +1264,7 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) {
/* remove the nodes in best chunk from original chunk */
bitset_andnot(c->nodes, best_chunk->nodes);
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
ir_node *irn = c->n[idx];
const ir_node *irn = c->n[idx];
if (bitset_is_set(best_chunk->nodes, get_irn_idx(irn))) {
int last = ARR_LEN(c->n) - 1;
......@@ -1277,8 +1277,8 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) {
/* we have to get the nodes back into the original chunk because they are scattered over temporary chunks */
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
ir_node *n = c->n[idx];
co_mst_irn_t *nn = get_co_mst_irn(env, n);
const ir_node *n = c->n[idx];
co_mst_irn_t *nn = get_co_mst_irn(env, n);
nn->chunk = c;
}
......@@ -1286,7 +1286,7 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) {
visited = bitset_irg_malloc(env->co->irg);
bitset_or(visited, best_chunk->nodes);
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
ir_node *irn = c->n[idx];
const ir_node *irn = c->n[idx];
if (! bitset_is_set(visited, get_irn_idx(irn))) {
aff_chunk_t *new_chunk = new_aff_chunk(env);
co_mst_irn_t *node = get_co_mst_irn(env, irn);
......@@ -1298,8 +1298,8 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) {
}
for (idx = 0, len = ARR_LEN(best_chunk->n); idx < len; ++idx) {
ir_node *n = best_chunk->n[idx];
co_mst_irn_t *nn = get_co_mst_irn(env, n);
const ir_node *n = best_chunk->n[idx];
co_mst_irn_t *nn = get_co_mst_irn(env, n);
nn->chunk = NULL;
}
......@@ -1417,4 +1417,5 @@ void be_init_copyheur4(void) {
FIRM_DBG_REGISTER(dbg, "firm.be.co.heur4");
}
BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur4);
......@@ -291,7 +291,7 @@ static void build_clique_star_cstr(ilp_env_t *ienv) {
co_gs_foreach_aff_node(ienv->co, aff) {
struct obstack ob;
neighb_t *nbr;
ir_node *center = aff->irn;
const ir_node *center = aff->irn;
ir_node **nodes;
set *edges;
int i, o, n_nodes, n_edges;
......@@ -398,7 +398,7 @@ static void build_clique_star_cstr(ilp_env_t *ienv) {
}
static void extend_path(ilp_env_t *ienv, pdeq *path, ir_node *irn) {
static void extend_path(ilp_env_t *ienv, pdeq *path, const ir_node *irn) {
be_ifg_t *ifg = ienv->co->cenv->ifg;
int i, len;
ir_node **curr_path;
......
......@@ -870,7 +870,7 @@ void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
ir_node *irn;
void *it, *nit;
int n, n_regs;
unsigned i, j;
unsigned i;
n_regs = 0;
for(i = 0; i < co->cls->n_regs; ++i) {
......@@ -894,17 +894,6 @@ void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
fprintf(f, "%d %d\n", n, n_regs);
#if 0
printf("debut\n");
for (i = 0; i < n_regs; ++i) {
for (j = 0; j < i; ++j) {
fprintf(f, "%d %d -1\n", i, j);
printf("%d %d\n", i, j);
}
}
printf("fin\n");
#endif
be_ifg_foreach_node(ifg, it, irn) {
if(!arch_irn_is(co->aenv, irn, ignore)) {
int idx = node_map[get_irn_idx(irn)];
......@@ -946,333 +935,6 @@ void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
xfree(node_map);
}
typedef struct _appel_clique_walker_t {
ir_phase ph;
const copy_opt_t *co;
int curr_nr;
int node_count;
FILE *f;
int dumb;
int *color_map;
struct obstack obst;
} appel_clique_walker_t;
typedef struct _appel_block_info_t {
int *live_end_nr;
int *live_in_nr;
int *phi_nr;
ir_node **live_end;
ir_node **live_in;
ir_node **phi;
int n_live_end;
int n_live_in;
int n_phi;
} appel_block_info_t;
static int appel_aff_weight(const appel_clique_walker_t *env, ir_node *bl)
{
#if 0
double freq = get_block_execfreq(env->co->cenv->execfreq, bl);
int res = (int) freq;
return res == 0 ? 1 : res;
#else
ir_loop *loop = get_irn_loop(bl);
(void) env;
if(loop) {
int d = get_loop_depth(loop);
return 1 + d * d;
}
return 1;
#endif
}
static void *appel_clique_walker_irn_init(ir_phase *phase, ir_node *irn, void *old)
{
appel_block_info_t *res = NULL;
(void) old;
if(is_Block(irn)) {
appel_clique_walker_t *d = (void *) phase;
res = phase_alloc(phase, sizeof(res[0]));
res->phi_nr = phase_alloc(phase, d->co->cls->n_regs * sizeof(res->live_end_nr));
res->live_end_nr = phase_alloc(phase, d->co->cls->n_regs * sizeof(res->live_end_nr));
res->live_in_nr = phase_alloc(phase, d->co->cls->n_regs * sizeof(res->live_in_nr));
res->live_end = phase_alloc(phase, d->co->cls->n_regs * sizeof(res->live_end));
res->live_in = phase_alloc(phase, d->co->cls->n_regs * sizeof(res->live_in));
res->phi = phase_alloc(phase, d->co->cls->n_regs * sizeof(res->live_in));
}
return res;
}
typedef struct _insn_list_t {
be_insn_t *insn;
struct list_head list;
} insn_list_t;
static int appel_get_live_end_nr(appel_clique_walker_t *env, ir_node *bl, ir_node *irn)
{
appel_block_info_t *bli = phase_get_irn_data(&env->ph, bl);
int i;
for(i = 0; i < bli->n_live_end; ++i)
if(bli->live_end[i] == irn)
return bli->live_end_nr[i];
return -1;
}
static int appel_dump_clique(appel_clique_walker_t *env, const ir_nodeset_t *live, ir_node *bl, int curr_nr, int start_nr)
{
ir_node **live_arr = alloca(env->co->cls->n_regs * sizeof(live_arr[0]));
ir_node *irn;
int n_live;
int j;
ir_nodeset_iterator_t iter;
n_live = 0;
foreach_ir_nodeset(live, irn, iter)
live_arr[n_live++] = irn;
/* dump the live after clique */
if(!env->dumb) {
for(j = 0; j < n_live; ++j) {
int k;
for(k = j + 1; k < n_live; ++k) {
fprintf(env->f, "%d %d -1 ", curr_nr + j, curr_nr + k);
}
fprintf(env->f, "\n");
}
}
/* dump the affinities */
for(j = 0; !env->dumb && j < n_live; ++j) {
ir_node *irn = live_arr[j];
int old_nr = PTR_TO_INT(get_irn_link(irn));
/* if the node was already live in the last insn dump the affinity */
if(old_nr > start_nr) {
int weight = appel_aff_weight(env, bl);
fprintf(env->f, "%d %d %d\n", old_nr, curr_nr + j, weight);
}
}
/* set the current numbers into the link field. */
for(j = 0; j < n_live; ++j) {
ir_node *irn = live_arr[j];
set_irn_link(irn, INT_TO_PTR(curr_nr + j));
}
return curr_nr + n_live;
}
static void appel_walker(ir_node *bl, void *data)
{
appel_clique_walker_t *env = data;
appel_block_info_t *bli = phase_get_or_set_irn_data(&env->ph, bl);
struct obstack *obst = &env->obst;
void *base = obstack_base(obst);
ir_nodeset_t live;
ir_nodeset_iterator_t iter;
be_lv_t *lv = env->co->cenv->birg->lv;
int n_insns = 0;
int n_nodes = 0;
int start_nr = env->curr_nr;
int curr_nr = start_nr;
be_insn_env_t insn_env;
int i, j;
ir_node *irn;
be_insn_t **insns;
insn_env.aenv = env->co->aenv;
insn_env.cls = env->co->cls;
insn_env.obst = obst;
insn_env.ignore_colors = env->co->cenv->ignore_colors;
/* Guess how many insns will be in this block. */
sched_foreach(bl, irn)
n_nodes++;