Commit fcb579b8 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Remove the unused parameter const arch_env_t *env from arch_irn_get_flags(),...

Remove the unused parameter const arch_env_t *env from arch_irn_get_flags(), arch_irn_is() and arch_irn_consider_in_reg_alloc().

[r22706]
parent b0469904
......@@ -1367,10 +1367,10 @@ static ir_node *create_barrier(be_abi_irg_t *env, ir_node *bl, ir_node **mem, pm
arch_set_irn_register(proj, reg);
/* if the proj projects a ignore register or a node which is set to ignore, propagate this property. */
if (arch_register_type_is(reg, ignore) || arch_irn_is(env->birg->main_env->arch_env, in[n], ignore))
if (arch_register_type_is(reg, ignore) || arch_irn_is(in[n], ignore))
flags |= arch_irn_flags_ignore;
if (arch_irn_is(env->birg->main_env->arch_env, in[n], modify_sp))
if (arch_irn_is(in[n], modify_sp))
flags |= arch_irn_flags_modify_sp;
be_node_set_flags(irn, pos, flags);
......@@ -2316,7 +2316,7 @@ static void collect_stack_nodes_walker(ir_node *node, void *data)
{
fix_stack_walker_env_t *env = data;
if (arch_irn_is(env->arch_env, node, modify_sp)) {
if (arch_irn_is(node, modify_sp)) {
assert(get_irn_mode(node) != mode_M && get_irn_mode(node) != mode_T);
ARR_APP1(ir_node*, env->sp_nodes, node);
}
......
......@@ -238,10 +238,9 @@ arch_irn_class_t arch_irn_classify(const ir_node *irn)
return ops->classify(irn);
}
extern arch_irn_flags_t arch_irn_get_flags(const arch_env_t *env, const ir_node *irn)
arch_irn_flags_t arch_irn_get_flags(const ir_node *irn)
{
const arch_irn_ops_t *ops = get_irn_ops(irn);
(void)env; // TODO remove parameter
return ops->get_flags(irn);
}
......
......@@ -226,19 +226,18 @@ arch_irn_class_t arch_irn_classify(const ir_node *irn);
/**
* Get the flags of a node.
* @param env The architecture environment.
* @param irn The node.
* @return The flags.
*/
extern arch_irn_flags_t arch_irn_get_flags(const arch_env_t *env, const ir_node *irn);
arch_irn_flags_t arch_irn_get_flags(const ir_node *irn);
#define arch_irn_is(env, irn, flag) ((arch_irn_get_flags(env, irn) & arch_irn_flags_ ## flag) != 0)
#define arch_irn_is(irn, flag) ((arch_irn_get_flags(irn) & arch_irn_flags_ ## flag) != 0)
#define arch_irn_has_reg_class(irn, pos, cls) \
((cls) == arch_get_irn_reg_class(irn, pos))
#define arch_irn_consider_in_reg_alloc(env, cls, irn) \
(arch_irn_has_reg_class(irn, -1, cls) && !arch_irn_is(env, irn, ignore))
#define arch_irn_consider_in_reg_alloc(cls, irn) \
(arch_irn_has_reg_class(irn, -1, cls) && !arch_irn_is(irn, ignore))
/**
* Get the operations of an irn.
......
......@@ -179,7 +179,7 @@ static INLINE border_t *border_add(be_chordal_env_t *env, struct list_head *head
*/
static INLINE int has_reg_class(const be_chordal_env_t *env, const ir_node *irn)
{
return arch_irn_consider_in_reg_alloc(env->birg->main_env->arch_env, env->cls, irn);
return arch_irn_consider_in_reg_alloc(env->cls, irn);
}
static int get_next_free_reg(const be_chordal_alloc_env_t *alloc_env, bitset_t *colors)
......@@ -877,7 +877,6 @@ static void assign(ir_node *block, void *env_ptr)
bitset_t *live = alloc_env->live;
bitset_t *colors = alloc_env->colors;
bitset_t *in_colors = alloc_env->in_colors;
const arch_env_t *arch_env = env->birg->main_env->arch_env;
struct list_head *head = get_block_border_head(env, block);
be_lv_t *lv = env->birg->lv;
......@@ -929,7 +928,7 @@ static void assign(ir_node *block, void *env_ptr)
list_for_each_entry_reverse(border_t, b, head, list) {
ir_node *irn = b->irn;
int nr = get_irn_idx(irn);
int ignore = arch_irn_is(arch_env, irn, ignore);
int ignore = arch_irn_is(irn, ignore);
/*
* Assign a color, if it is a local def. Global defs already have a
......
......@@ -424,7 +424,7 @@ static void draw_block(ir_node *bl, void *data)
be_lv_foreach(lv, bl, be_lv_state_in, idx) {
ir_node *irn = be_lv_get_irn(lv, bl, idx);
if (arch_irn_consider_in_reg_alloc(env->arch_env, env->cls, irn)) {
if (arch_irn_consider_in_reg_alloc(env->cls, irn)) {
const arch_register_t *reg = arch_get_irn_register(irn);
int col = arch_register_get_index(reg);
int x = (col + 1) * opts->h_inter_gap;
......
......@@ -83,7 +83,7 @@ static INLINE struct list_head *_get_block_border_head(const be_chordal_env_t *i
#define border_prev(b) (list_entry((b)->list.prev, border_t, list))
#define chordal_has_class(chordal_env, irn) \
arch_irn_consider_in_reg_alloc(chordal_env->birg->main_env->arch_env, chordal_env->cls, irn)
arch_irn_consider_in_reg_alloc(chordal_env->cls, irn)
void be_ra_chordal_color(be_chordal_env_t *chordal_env);
......
......@@ -1178,8 +1178,8 @@ static void ifg_dump_graph_attr(FILE *f, void *self)
static int ifg_is_dump_node(void *self, ir_node *irn)
{
co2_t *env = self;
return !arch_irn_is(env->co->aenv, irn, ignore);
(void)self;
return !arch_irn_is(irn, ignore);
}
static void ifg_dump_node_attr(FILE *f, void *self, ir_node *irn)
......
......@@ -124,7 +124,6 @@ typedef struct _co_mst_env_t {
pqueue_t *chunks; /**< priority queue for chunks */
pset *chunkset; /**< set holding all chunks */
be_ifg_t *ifg; /**< the interference graph */
const arch_env_t *aenv; /**< the arch environment */
copy_opt_t *co; /**< the copy opt object */
unsigned chunk_visited;
col_cost_t **single_cols;
......@@ -399,7 +398,7 @@ static void *co_mst_irn_init(ir_phase *ph, const ir_node *irn, void *old) {
/* build list of interfering neighbours */
len = 0;
be_ifg_foreach_neighbour(env->ifg, nodes_it, irn, neigh) {
if (! arch_irn_is(env->aenv, neigh, ignore)) {
if (!arch_irn_is(neigh, ignore)) {
obstack_ptr_grow(phase_obst(ph), neigh);
++len;
}
......@@ -558,7 +557,7 @@ static void aff_chunk_assure_weight(co_mst_env_t *env, aff_chunk_t *c) {
const ir_node *m = neigh->irn;
/* skip ignore nodes */
if (arch_irn_is(env->aenv, m, ignore))
if (arch_irn_is(m, ignore))
continue;
w += node_contains(c->n, m) ? neigh->costs : 0;
......@@ -589,7 +588,7 @@ static int count_interfering_aff_neighs(co_mst_env_t *env, const affinity_node_t
int i;
/* skip ignore nodes */
if (arch_irn_is(env->aenv, n, ignore))
if (arch_irn_is(n, ignore))
continue;
/* check if the affinity neighbour interfere */
......@@ -625,7 +624,7 @@ static void build_affinity_chunks(co_mst_env_t *env) {
affinity_node_t *an;
/* skip ignore nodes */
if (arch_irn_is(env->aenv, n, ignore))
if (arch_irn_is(n, ignore))
continue;
n1 = get_co_mst_irn(env, n);
......@@ -648,7 +647,7 @@ static void build_affinity_chunks(co_mst_env_t *env) {
aff_edge_t edge;
/* skip ignore nodes */
if (arch_irn_is(env->aenv, m, ignore))
if (arch_irn_is(m, ignore))
continue;
edge.src = n;
......@@ -724,7 +723,7 @@ static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu
int w = 0;
neighb_t *neigh;
if (arch_irn_is(env->aenv, irn, ignore))
if (arch_irn_is(irn, ignore))
continue;
if (an) {
......@@ -752,7 +751,7 @@ static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu
affinity_node_t *an = get_affinity_info(env->co, irn);
neighb_t *neigh;
if (arch_irn_is(env->aenv, irn, ignore))
if (arch_irn_is(irn, ignore))
continue;
assert(i <= ARR_LEN(chunk->n));
......@@ -806,7 +805,7 @@ static void expand_chunk_from(co_mst_env_t *env, co_mst_irn_t *node, bitset_t *v
co_mst_irn_t *n2;
/* skip ignore nodes */
if (arch_irn_is(env->aenv, m, ignore))
if (arch_irn_is(m, ignore))
continue;
n2 = get_co_mst_irn(env, m);
......@@ -1049,7 +1048,7 @@ static int recolor_nodes(co_mst_env_t *env, co_mst_irn_t *node, col_cost_t *cost
neigh = node->int_neighs[j];
/* skip ignore nodes */
if (arch_irn_is(env->aenv, neigh, ignore))
if (arch_irn_is(neigh, ignore))
continue;
nn = get_co_mst_irn(env, neigh);
......@@ -1413,7 +1412,6 @@ int co_solve_heuristic_mst(copy_opt_t *co) {
mst_env.co = co;
mst_env.ignore_regs = ignore_regs;
mst_env.ifg = co->cenv->ifg;
mst_env.aenv = co->aenv;
mst_env.chunkset = pset_new_ptr(512);
mst_env.chunk_visited = 0;
mst_env.single_cols = phase_alloc(&mst_env.ph, sizeof(*mst_env.single_cols) * n_regs);
......@@ -1452,7 +1450,7 @@ int co_solve_heuristic_mst(copy_opt_t *co) {
co_mst_irn_t *mirn;
const arch_register_t *reg;
if (arch_irn_is(mst_env.aenv, irn, ignore))
if (arch_irn_is(irn, ignore))
continue;
mirn = get_co_mst_irn(&mst_env, irn);
......
......@@ -296,7 +296,7 @@ static void build_clique_star_cstr(ilp_env_t *ienv) {
set *edges;
int i, o, n_nodes, n_edges;
if (arch_irn_is(ienv->co->aenv, aff->irn, ignore))
if (arch_irn_is(aff->irn, ignore))
continue;
obstack_init(&ob);
......@@ -305,7 +305,7 @@ static void build_clique_star_cstr(ilp_env_t *ienv) {
/* get all affinity neighbours */
n_nodes = 0;
co_gs_foreach_neighb(aff, nbr) {
if (!arch_irn_is(ienv->co->aenv, nbr->irn, ignore)) {
if (!arch_irn_is(nbr->irn, ignore)) {
obstack_ptr_grow(&ob, nbr->irn);
++n_nodes;
}
......@@ -409,7 +409,7 @@ static void extend_path(ilp_env_t *ienv, pdeq *path, const ir_node *irn) {
if (pdeq_contains(path, irn))
return;
if (arch_irn_is(ienv->co->aenv, irn, ignore))
if (arch_irn_is(irn, ignore))
return;
/* insert the new irn */
......
......@@ -219,8 +219,9 @@ void free_copy_opt(copy_opt_t *co) {
int co_is_optimizable_root(const copy_opt_t *co, ir_node *irn) {
const arch_register_req_t *req;
const arch_register_t *reg;
(void)co; // TODO remove parameter
if (arch_irn_is(co->aenv, irn, ignore))
if (arch_irn_is(irn, ignore))
return 0;
reg = arch_get_irn_register(irn);
......@@ -415,7 +416,7 @@ static void co_collect_units(ir_node *irn, void *env) {
/* Else insert the argument of the phi to the members of this ou */
DBG((dbg, LEVEL_1, "\t Member: %+F\n", arg));
if (! arch_irn_is(co->aenv, arg, ignore)) {
if (!arch_irn_is(arg, ignore)) {
/* Check if arg has occurred at a prior position in the arg/list */
arg_pos = 0;
for (o=1; o<unit->node_count; ++o) {
......@@ -459,7 +460,7 @@ static void co_collect_units(ir_node *irn, void *env) {
for (i = 0; (1U << i) <= other; ++i) {
if (other & (1U << i)) {
ir_node *o = get_irn_n(skip_Proj(irn), i);
if (!arch_irn_is(co->aenv, o, ignore) &&
if (!arch_irn_is(o, ignore) &&
!nodes_interfere(co->cenv, irn, o)) {
++count;
}
......@@ -477,7 +478,7 @@ static void co_collect_units(ir_node *irn, void *env) {
for (i = 0; 1U << i <= other; ++i) {
if (other & (1U << i)) {
ir_node *o = get_irn_n(skip_Proj(irn), i);
if (!arch_irn_is(co->aenv, o, ignore) &&
if (!arch_irn_is(o, ignore) &&
!nodes_interfere(co->cenv, irn, o)) {
unit->nodes[k] = o;
unit->costs[k] = co->get_costs(co, irn, o, -1);
......@@ -771,7 +772,7 @@ static void build_graph_walker(ir_node *irn, void *env) {
int pos, max;
const arch_register_t *reg;
if (!is_curr_reg_class(co, irn) || arch_irn_is(co->aenv, irn, ignore))
if (!is_curr_reg_class(co, irn) || arch_irn_is(irn, ignore))
return;
reg = arch_get_irn_register(irn);
......@@ -796,7 +797,7 @@ static void build_graph_walker(ir_node *irn, void *env) {
for (i = 0; 1U << i <= other; ++i) {
if (other & (1U << i)) {
ir_node *other = get_irn_n(skip_Proj(irn), i);
if (! arch_irn_is(co->aenv, other, ignore))
if (!arch_irn_is(other, ignore))
add_edges(co, irn, other, co->get_costs(co, irn, other, 0));
}
}
......@@ -883,14 +884,14 @@ void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
n = n_regs;
be_ifg_foreach_node(ifg, it, irn) {
if(!arch_irn_is(co->aenv, irn, ignore))
if (!arch_irn_is(irn, ignore))
node_map[get_irn_idx(irn)] = n++;
}
fprintf(f, "%d %d\n", n, n_regs);
be_ifg_foreach_node(ifg, it, irn) {
if(!arch_irn_is(co->aenv, irn, ignore)) {
if (!arch_irn_is(irn, ignore)) {
int idx = node_map[get_irn_idx(irn)];
affinity_node_t *a = get_affinity_info(co, irn);
......@@ -906,7 +907,8 @@ void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
}
be_ifg_foreach_neighbour(ifg, nit, irn, adj) {
if(!arch_irn_is(co->aenv, adj, ignore) && !co_dump_appel_disjoint_constraints(co, irn, adj)) {
if (!arch_irn_is(adj, ignore) &&
!co_dump_appel_disjoint_constraints(co, irn, adj)) {
int adj_idx = node_map[get_irn_idx(adj)];
if(idx < adj_idx)
fprintf(f, "%d %d -1\n", idx, adj_idx);
......@@ -917,7 +919,7 @@ void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
neighb_t *n;
co_gs_foreach_neighb(a, n) {
if(!arch_irn_is(co->aenv, n->irn, ignore)) {
if (!arch_irn_is(n->irn, ignore)) {
int n_idx = node_map[get_irn_idx(n->irn)];
if(idx < n_idx)
fprintf(f, "%d %d %d\n", idx, n_idx, (int) n->costs);
......@@ -991,8 +993,8 @@ static void ifg_dump_graph_attr(FILE *f, void *self)
static int ifg_is_dump_node(void *self, ir_node *irn)
{
co_ifg_dump_t *cod = self;
return !arch_irn_is(cod->co->aenv, irn, ignore);
(void)self;
return !arch_irn_is(irn, ignore);
}
static void ifg_dump_node_attr(FILE *f, void *self, ir_node *irn)
......
......@@ -53,7 +53,6 @@
#include "besched_t.h"
#include "benode_t.h"
static const arch_env_t *arch_env = NULL;
static const arch_register_class_t *flag_class = NULL;
static const arch_register_t *flags_reg = NULL;
static func_rematerialize remat = NULL;
......@@ -185,7 +184,7 @@ static void rematerialize_or_move(ir_node *flags_needed, ir_node *node,
static int is_modify_flags(ir_node *node) {
int i, arity;
if(arch_irn_is(arch_env, node, modify_flags))
if (arch_irn_is(node, modify_flags))
return 1;
if(!be_is_Keep(node))
return 0;
......@@ -194,7 +193,7 @@ static int is_modify_flags(ir_node *node) {
for(i = 0; i < arity; ++i) {
ir_node *in = get_irn_n(node, i);
in = skip_Proj(in);
if(arch_irn_is(arch_env, in, modify_flags))
if (arch_irn_is(in, modify_flags))
return 1;
}
......@@ -250,7 +249,7 @@ static void fix_flags_walker(ir_node *block, void *env)
continue;
/* spiller can't (correctly) remat flag consumers at the moment */
assert(!arch_irn_is(arch_env, node, rematerializable));
assert(!arch_irn_is(node, rematerializable));
if(skip_Proj(new_flags_needed) != flags_needed) {
if(flags_needed != NULL) {
......@@ -268,7 +267,7 @@ static void fix_flags_walker(ir_node *block, void *env)
}
flag_consumers = node;
set_irn_link(flag_consumers, NULL);
assert(arch_irn_is(arch_env, flags_needed, rematerializable));
assert(arch_irn_is(flags_needed, rematerializable));
} else {
/* link all consumers in a list */
set_irn_link(node, flag_consumers);
......@@ -292,7 +291,6 @@ void be_sched_fix_flags(be_irg_t *birg, const arch_register_class_t *flag_cls,
{
ir_graph *irg = be_get_birg_irg(birg);
arch_env = be_get_birg_arch_env(birg);
flag_class = flag_cls;
flags_reg = & flag_class->regs[0];
remat = remat_func;
......
......@@ -640,15 +640,15 @@ void be_ifg_dump_dot(be_ifg_t *ifg, ir_graph *irg, FILE *file, const be_ifg_dump
bitset_free(nodes);
}
static void int_comp_rec(be_irg_t *birg, be_ifg_t *ifg, ir_node *n, bitset_t *seen)
static void int_comp_rec(be_ifg_t *ifg, ir_node *n, bitset_t *seen)
{
void *neigh_it = be_ifg_neighbours_iter_alloca(ifg);
ir_node *m;
be_ifg_foreach_neighbour(ifg, neigh_it, n, m) {
if(!bitset_contains_irn(seen, m) && !arch_irn_is(birg->main_env->arch_env, m, ignore)) {
if (!bitset_contains_irn(seen, m) && !arch_irn_is(m, ignore)) {
bitset_add_irn(seen, m);
int_comp_rec(birg, ifg, m, seen);
int_comp_rec(ifg, m, seen);
}
}
......@@ -663,10 +663,10 @@ static int int_component_stat(be_irg_t *birg, be_ifg_t *ifg)
ir_node *n;
be_ifg_foreach_node(ifg, nodes_it, n) {
if (! bitset_contains_irn(seen, n) && ! arch_irn_is(birg->main_env->arch_env, n, ignore)) {
if (!bitset_contains_irn(seen, n) && !arch_irn_is(n, ignore)) {
++n_comp;
bitset_add_irn(seen, n);
int_comp_rec(birg, ifg, n, seen);
int_comp_rec(ifg, n, seen);
}
}
......
......@@ -46,8 +46,7 @@
* @param mach_op the machine operand for which uses are added
*/
static void add_machine_operands(const be_insn_env_t *env, be_insn_t *insn, ir_node *mach_op) {
const arch_env_t *arch_env = env->aenv;
struct obstack *obst = env->obst;
struct obstack *obst = env->obst;
int i, n;
for (i = 0, n = get_irn_arity(mach_op); i < n; ++i) {
......@@ -55,7 +54,7 @@ static void add_machine_operands(const be_insn_env_t *env, be_insn_t *insn, ir_n
if (is_irn_machine_operand(op)) {
add_machine_operands(env, insn, op);
} else if (arch_irn_consider_in_reg_alloc(arch_env, env->cls, op)) {
} else if (arch_irn_consider_in_reg_alloc(env->cls, op)) {
be_operand_t o;
/* found a register use, create an operand */
......@@ -82,8 +81,7 @@ static void add_machine_operands(const be_insn_env_t *env, be_insn_t *insn, ir_n
*/
be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn)
{
const arch_env_t *arch_env = env->aenv;
struct obstack *obst = env->obst;
struct obstack *obst = env->obst;
be_operand_t o;
be_insn_t *insn;
int i, n;
......@@ -107,7 +105,7 @@ be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn)
in the backend, but check it for now. */
assert(get_irn_mode(p) != mode_T);
if (arch_irn_consider_in_reg_alloc(arch_env, env->cls, p)) {
if (arch_irn_consider_in_reg_alloc(env->cls, p)) {
/* found a def: create a new operand */
o.req = arch_get_register_req(p, -1);
o.carrier = p;
......@@ -121,7 +119,7 @@ be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn)
pre_colored += arch_get_irn_register(p) != NULL;
}
}
} else if (arch_irn_consider_in_reg_alloc(arch_env, env->cls, irn)) {
} else if (arch_irn_consider_in_reg_alloc(env->cls, irn)) {
/* only one def, create one operand */
o.req = arch_get_register_req(irn, -1);
o.carrier = irn;
......@@ -147,7 +145,7 @@ be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn)
if (is_irn_machine_operand(op)) {
add_machine_operands(env, insn, op);
} else if (arch_irn_consider_in_reg_alloc(arch_env, env->cls, op)) {
} else if (arch_irn_consider_in_reg_alloc(env->cls, op)) {
/* found a register use, create an operand */
o.req = arch_get_register_req(irn, i);
o.carrier = op;
......
......@@ -795,6 +795,7 @@ void be_liveness_transfer(const arch_env_t *arch_env,
ir_node *node, ir_nodeset_t *nodeset)
{
int i, arity;
(void)arch_env; // TODO remove parameter
/* You should better break out of your loop when hitting the first phi
* function. */
......@@ -806,11 +807,11 @@ void be_liveness_transfer(const arch_env_t *arch_env,
foreach_out_edge(node, edge) {
ir_node *proj = get_edge_src_irn(edge);
if (arch_irn_consider_in_reg_alloc(arch_env, cls, proj)) {
if (arch_irn_consider_in_reg_alloc(cls, proj)) {
ir_nodeset_remove(nodeset, proj);
}
}
} else if (arch_irn_consider_in_reg_alloc(arch_env, cls, node)) {
} else if (arch_irn_consider_in_reg_alloc(cls, node)) {
ir_nodeset_remove(nodeset, node);
}
......@@ -818,7 +819,7 @@ void be_liveness_transfer(const arch_env_t *arch_env,
for (i = 0; i < arity; ++i) {
ir_node *op = get_irn_n(node, i);
if (arch_irn_consider_in_reg_alloc(arch_env, cls, op))
if (arch_irn_consider_in_reg_alloc(cls, op))
ir_nodeset_insert(nodeset, op);
}
}
......@@ -830,11 +831,12 @@ void be_liveness_end_of_block(const be_lv_t *lv, const arch_env_t *arch_env,
const ir_node *block, ir_nodeset_t *live)
{
int i;
(void)arch_env; // TODO remove parameter
assert(lv->nodes && "live sets must be computed");
be_lv_foreach(lv, block, be_lv_state_end, i) {
ir_node *node = be_lv_get_irn(lv, block, i);
if(!arch_irn_consider_in_reg_alloc(arch_env, cls, node))
if (!arch_irn_consider_in_reg_alloc(cls, node))
continue;
ir_nodeset_insert(live, node);
......
......@@ -68,7 +68,6 @@ typedef struct {
/** Lowering walker environment. */
typedef struct _lower_env_t {
be_irg_t *birg;
const arch_env_t *arch_env;
unsigned do_copy : 1;
DEBUG_ONLY(firm_dbg_module_t *dbg_module;)
} lower_env_t;
......@@ -519,16 +518,16 @@ static INLINE ir_node *belower_skip_proj(ir_node *irn) {
return irn;
}
static ir_node *find_copy(constraint_env_t *env, ir_node *irn, ir_node *op) {
const arch_env_t *arch_env = be_get_birg_arch_env(env->birg);
ir_node *block = get_nodes_block(irn);
ir_node *cur_node;
static ir_node *find_copy(ir_node *irn, ir_node *op)
{
ir_node *block = get_nodes_block(irn);
ir_node *cur_node;
for (cur_node = sched_prev(irn);
! is_Block(cur_node) && be_is_Copy(cur_node) && get_nodes_block(cur_node) == block;
cur_node = sched_prev(cur_node))
{
if (be_get_Copy_op(cur_node) == op && arch_irn_is(arch_env, cur_node, dont_spill))
if (be_get_Copy_op(cur_node) == op && arch_irn_is(cur_node, dont_spill))
return cur_node;
}
......@@ -539,14 +538,14 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different,
be_irg_t *birg = env->birg;
ir_graph *irg = be_get_birg_irg(birg);
pset *op_set = env->op_set;
const arch_env_t *arch_env = be_get_birg_arch_env(birg);
ir_node *block = get_nodes_block(irn);
const arch_register_class_t *cls = arch_get_irn_reg_class(other_different, -1);
ir_node *in[2], *keep, *cpy;
op_copy_assoc_t key, *entry;
DEBUG_ONLY(firm_dbg_module_t *mod = env->dbg;)
if (arch_irn_is(arch_env, other_different, ignore) || ! mode_is_datab(get_irn_mode(other_different))) {
if (arch_irn_is(other_different, ignore) ||
!mode_is_datab(get_irn_mode(other_different))) {
DBG((mod, LEVEL_1, "ignore constraint for %+F because other_irn is ignore or not a datab node\n", irn));
return;
}
......@@ -557,7 +556,7 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different,
/* The copy is optimized later if not needed */
/* check if already exists such a copy in the schedule immediately before */
cpy = find_copy(env, belower_skip_proj(irn), other_different);
cpy = find_copy(belower_skip_proj(irn), other_different);
if (! cpy) {
cpy = be_new_Copy(cls, irg, block, other_different);
be_node_set_flags(cpy, BE_OUT_POS(0), arch_irn_flags_dont_spill);
......@@ -873,8 +872,7 @@ void assure_constraints(be_irg_t *birg) {
*/
static int push_through_perm(ir_node *perm, void *data)
{
lower_env_t *env = data;
const arch_env_t *aenv = env->arch_env;
lower_env_t *env = data;
ir_graph *irg = get_irn_irg(perm);
ir_node *bl = get_nodes_block(perm);
......@@ -912,7 +910,7 @@ static int push_through_perm(ir_node *perm, void *data)
sched_foreach_reverse_from (sched_prev(perm), irn) {
for (i = get_irn_arity(irn) - 1; i >= 0; --i) {
ir_node *op = get_irn_n(irn, i);
if (arch_irn_consider_in_reg_alloc(aenv, cls, op) &&
if (arch_irn_consider_in_reg_alloc(cls, op) &&
!values_interfere(env->birg, op, one_proj)) {
frontier = irn;
goto found_front;
......@@ -946,7 +944,7 @@ found_front:
break;
if(!sched_comes_after(frontier, node))
break;
if(arch_irn_is(aenv, node, modify_flags))
if (arch_irn_is(node, modify_flags))
break;
if(is_Proj(node)) {
req = arch_get_register_req(get_Proj_pred(node),
......@@ -958,7 +956,7 @@ found_front:
break;
for(i = get_irn_arity(node) - 1; i >= 0; --i) {