Commit 09e7542f authored by Matthias Braun's avatar Matthias Braun
Browse files

be: Let backends deal with memperm offsets

Only the backends know how memperm are implementd and whether they use
sp- or fp-relative addressing. This should fix sparc memperm problems.

Long-term I'd like to remove the memperm node and use a callback that
creates a sequence of target specific nodes instead (similar to how
spills and reloads are created).
parent 5f947642
......@@ -114,6 +114,10 @@ static void arm_determine_frameoffset(ir_node *node, int sp_offset)
load_store_attr->offset += get_entity_offset(entity);
load_store_attr->offset += sp_offset;
}
} else if (be_is_MemPerm(node)) {
ir_graph *irg = get_irn_irg(node);
if (arm_get_irg_data(irg)->omit_fp)
be_set_MemPerm_offset(node, sp_offset);
}
}
......
......@@ -72,8 +72,6 @@ static void process_stack_bias(sp_sim_func const sim, ir_node *const block,
sched_foreach(block, node) {
if (be_is_IncSP(node)) {
sim_be_IncSP(node, &state);
} else if (be_is_MemPerm(node)) {
be_set_MemPerm_offset(node, state.offset);
} else {
sim(node, &state);
}
......
......@@ -40,9 +40,8 @@ typedef void (*sp_sim_func)(ir_node *node, stack_pointer_state_t *state);
/**
* From function begin simulate relative stack pointer offset along the
* function.
* Note that the code already contains a special case for IncSP and MemPerm
* nodes which need no handling in the callback.
* function. Note that the code already contains a special case for IncSP node
* which needs no handling in the callback.
*/
void be_sim_stack_pointer(ir_graph *irg, unsigned misalign, unsigned p2align,
sp_sim_func func);
......
......@@ -85,9 +85,7 @@ static void sparc_determine_frameoffset(ir_node *const node,
if (node_has_sp_base(node))
attr->immediate_value += sp_offset;
}
return;
}
if (sparc_has_load_store_attr(node)) {
} else if (sparc_has_load_store_attr(node)) {
sparc_load_store_attr_t *const attr = get_sparc_load_store_attr(node);
if (!attr->is_frame_entity)
return;
......@@ -98,7 +96,10 @@ static void sparc_determine_frameoffset(ir_node *const node,
if (node_has_sp_base(node))
attr->base.immediate_value += sp_offset;
}
return;
} else if (be_is_MemPerm(node)) {
ir_graph *irg = get_irn_irg(node);
if (sparc_get_irg_data(irg)->omit_fp)
be_set_MemPerm_offset(node, sp_offset);
}
}
......
Markdown is supported
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