Commit 01fb70d6 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Pass the stack pointer register as parameter to be_abi_fix_stack_nodes().

* It was retrieved from the arch_env before.
* Also rename be_abi_fix_stack_nodes() to be_fix_stack_nodes().
parent 202f008f
......@@ -89,7 +89,7 @@ static void TEMPLATE_prepare_graph(ir_graph *irg)
static void TEMPLATE_emit(ir_graph *irg)
{
/* fix stack entity offsets */
be_abi_fix_stack_nodes(irg);
be_fix_stack_nodes(irg, &TEMPLATE_registers[REG_SP]);
be_abi_fix_stack_bias(irg);
/* emit code */
TEMPLATE_emit_function(irg);
......
......@@ -635,7 +635,7 @@ static void amd64_finish_graph(ir_graph *irg)
introduce_prologue_epilogue(irg);
/* fix stack entity offsets */
be_abi_fix_stack_nodes(irg);
be_fix_stack_nodes(irg, &amd64_registers[REG_RSP]);
be_abi_fix_stack_bias(irg);
/* Fix 2-address code constraints. */
......
......@@ -142,7 +142,7 @@ void arm_finish_graph(ir_graph *irg)
introduce_prolog_epilog(irg);
/* fix stack entity offsets */
be_abi_fix_stack_nodes(irg);
be_fix_stack_nodes(irg, &arm_registers[REG_SP]);
be_abi_fix_stack_bias(irg);
/* do peephole optimizations and fix stack offsets */
......
......@@ -192,12 +192,9 @@ static void collect_stack_nodes_walker(ir_node *node, void *data)
ARR_APP1(ir_node*, env->sp_nodes, node);
}
void be_abi_fix_stack_nodes(ir_graph *irg)
void be_fix_stack_nodes(ir_graph *const irg, arch_register_t const *const sp)
{
be_lv_t *lv = be_get_irg_liveness(irg);
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
be_irg_t *birg = be_birg_from_irg(irg);
const arch_register_t *sp = arch_env->sp;
be_irg_t *const birg = be_birg_from_irg(irg);
arch_register_req_type_t type = arch_register_req_type_produces_sp;
if (!rbitset_is_set(birg->allocatable_regs, sp->global_index))
......@@ -226,6 +223,7 @@ void be_abi_fix_stack_nodes(ir_graph *irg)
be_ssa_construction_add_copies(&senv, walker_env.sp_nodes, n_sp_nodes);
be_ssa_construction_fix_users_array(&senv, walker_env.sp_nodes, n_sp_nodes);
be_lv_t *const lv = be_get_irg_liveness(irg);
if (lv->sets_valid) {
for (size_t i = 0; i < n_sp_nodes; ++i) {
be_liveness_update(lv, walker_env.sp_nodes[i]);
......@@ -239,7 +237,7 @@ void be_abi_fix_stack_nodes(ir_graph *irg)
for (size_t i = 0, n_phis = ARR_LEN(phis); i < n_phis; ++i) {
ir_node *phi = phis[i];
be_set_phi_reg_req(phi, sp_req);
arch_set_irn_register(phi, arch_env->sp);
arch_set_irn_register(phi, sp);
}
be_ssa_construction_destroy(&senv);
DEL_ARR_F(walker_env.sp_nodes);
......
......@@ -17,9 +17,9 @@
/**
* Rewire all stack modifying nodes and their users to assure SSA property.
* @param env The abi
* @param sp The stack pointer register
*/
void be_abi_fix_stack_nodes(ir_graph *irg);
void be_fix_stack_nodes(ir_graph *irg, arch_register_t const *sp);
/**
* Fix the stack bias for all nodes accessing the stack frame using the
......
......@@ -1180,7 +1180,7 @@ static void ia32_emit(ir_graph *irg)
introduce_prologue_epilogue(irg);
/* fix stack entity offsets */
be_abi_fix_stack_nodes(irg);
be_fix_stack_nodes(irg, &ia32_registers[REG_ESP]);
be_abi_fix_stack_bias(irg);
/* fix 2-address code constraints */
......
......@@ -751,7 +751,7 @@ void sparc_finish_graph(ir_graph *irg)
sparc_introduce_prolog_epilog(irg);
/* fix stack entity offsets */
be_abi_fix_stack_nodes(irg);
be_fix_stack_nodes(irg, &sparc_registers[REG_SP]);
sparc_fix_stack_bias(irg);
heights = heights_new(irg);
......
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