Commit 39e27d1f authored by Adam Szalkowski's avatar Adam Szalkowski
Browse files

perform_memory operand now takes a spill instead of a reload

parent 607f0b0e
......@@ -41,7 +41,7 @@ arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa_if, FILE *fi
arch_env_t *arch_env_push_irn_handler(arch_env_t *env,
const arch_irn_handler_t *handler)
{
assert(env->handlers_tos <= ARCH_MAX_HANDLERS);
assert(env->handlers_tos < ARCH_MAX_HANDLERS);
env->handlers[env->handlers_tos++] = handler;
return env;
}
......@@ -142,10 +142,10 @@ int arch_possible_memory_operand(const arch_env_t *env, const ir_node *irn, unsi
}
}
extern void arch_perform_memory_operand(const arch_env_t *env, ir_node *irn, ir_node *reload, unsigned int i) {
extern void arch_perform_memory_operand(const arch_env_t *env, ir_node *irn, ir_node *spill, unsigned int i) {
const arch_irn_ops_t *ops = get_irn_ops(env, irn);
if(ops->impl->perform_memory_operand) {
ops->impl->perform_memory_operand(ops, irn, reload, i);
ops->impl->perform_memory_operand(ops, irn, spill, i);
} else {
return;
}
......
......@@ -349,10 +349,10 @@ struct _arch_irn_ops_if_t {
*
* @param self The this pointer.
* @param irn The node.
* @param reload The reload.
* @param spill The spill.
* @param i The position of the reload.
*/
void (*perform_memory_operand)(const void *self, ir_node *irn, ir_node *reload, unsigned int i);
void (*perform_memory_operand)(const void *self, ir_node *irn, ir_node *spill, unsigned int i);
};
/**
......@@ -373,7 +373,7 @@ extern int arch_get_sp_bias(const arch_env_t *env, ir_node *irn);
extern int arch_get_op_estimated_cost(const arch_env_t *env, const ir_node *irn);
extern arch_inverse_t *arch_get_inverse(const arch_env_t *env, const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obstack);
extern int arch_possible_memory_operand(const arch_env_t *env, const ir_node *irn, unsigned int i);
extern void arch_perform_memory_operand(const arch_env_t *env, ir_node *irn, ir_node *reload, unsigned int i);
extern void arch_perform_memory_operand(const arch_env_t *env, ir_node *irn, ir_node *spill, unsigned int i);
/**
* Get the register requirements for a node.
......
......@@ -379,6 +379,18 @@ ir_node *be_get_Reload_frame(const ir_node *irn)
return get_irn_n(irn, be_pos_Reload_frame);
}
ir_node *be_get_Spill_val(const ir_node *irn)
{
assert(be_is_Spill(irn));
return get_irn_n(irn, be_pos_Spill_val);
}
ir_node *be_get_Spill_frame(const ir_node *irn)
{
assert(be_is_Spill(irn));
return get_irn_n(irn, be_pos_Spill_frame);
}
ir_node *be_new_Perm(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
{
int i;
......
......@@ -346,6 +346,9 @@ entity* be_get_frame_entity(const ir_node *irn);
ir_node* be_get_Reload_mem(const ir_node *irn);
ir_node* be_get_Reload_frame(const ir_node* irn);
ir_node* be_get_Spill_val(const ir_node *irn);
ir_node* be_get_Spill_frame(const ir_node* irn);
void be_set_MemPerm_in_entity(const ir_node *irn, int n, entity* ent);
entity *be_get_MemPerm_in_entity(const ir_node *irn, int n);
......
......@@ -3564,7 +3564,6 @@ insert_reload(spill_ilp_t * si, const ir_node * value, ir_node * after)
void perform_memory_operand(spill_ilp_t * si, memoperand_t * memoperand)
{
defs_t *defs;
ir_node *reload;
ir_node *value = get_irn_n(memoperand->irn, memoperand->pos);
ir_node *spill;
const arch_env_t *arch_env = si->chordal_env->birg->main_env->arch_env;
......@@ -3576,10 +3575,7 @@ void perform_memory_operand(spill_ilp_t * si, memoperand_t * memoperand)
spill = defs->spills;
assert(spill && "no spill placed before reload");
reload = be_reload(arch_env, si->cls, memoperand->irn, get_irn_mode(value), spill);
arch_perform_memory_operand(arch_env, memoperand->irn, reload, memoperand->pos);
sched_remove(reload);
arch_perform_memory_operand(arch_env, memoperand->irn, spill, memoperand->pos);
}
void insert_memoperands(spill_ilp_t * si)
......
......@@ -711,12 +711,8 @@ static int ia32_possible_memory_operand(const void *self, const ir_node *irn, un
return 1;
}
static void ia32_perform_memory_operand(const void *self, ir_node *irn, ir_node *reload, unsigned int i) {
static void ia32_perform_memory_operand(const void *self, ir_node *irn, ir_node *spill, unsigned int i) {
assert(ia32_possible_memory_operand(self, irn, i) && "Cannot perform memory operand change");
assert(get_nodes_block(reload) == get_nodes_block(irn) && "Reload must be in same block as irn.");
if (get_irn_n_edges(reload) > 1)
return;
if (i == 2) {
ir_node *tmp = get_irn_n(irn, 3);
......@@ -727,13 +723,13 @@ static void ia32_perform_memory_operand(const void *self, ir_node *irn, ir_node
set_ia32_am_support(irn, ia32_am_Source);
set_ia32_op_type(irn, ia32_AddrModeS);
set_ia32_am_flavour(irn, ia32_B);
set_ia32_ls_mode(irn, get_irn_mode(reload));
set_ia32_frame_ent(irn, be_get_frame_entity(reload));
set_ia32_ls_mode(irn, get_irn_mode(get_irn_n(irn, i)));
set_ia32_frame_ent(irn, be_get_frame_entity(spill));
set_ia32_use_frame(irn);
set_ia32_got_reload(irn);
set_irn_n(irn, 0, be_get_Reload_frame(reload));
set_irn_n(irn, 4, be_get_Reload_mem(reload));
set_irn_n(irn, 0, be_get_Spill_frame(spill));
set_irn_n(irn, 4, spill);
/*
Input at position one is index register, which is NoReg.
......@@ -742,7 +738,7 @@ static void ia32_perform_memory_operand(const void *self, ir_node *irn, ir_node
*/
set_irn_n(irn, 3, get_irn_n(irn, 1));
DBG_OPT_AM_S(reload, irn);
//FIXME DBG_OPT_AM_S(reload, irn);
}
static const be_abi_callbacks_t ia32_abi_callbacks = {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment