if (is_ia32_Pop(node) || is_ia32_PopMem(node))
return -4;
+ if (is_ia32_Leave(node) || (be_is_Copy(node)
+ && arch_get_irn_register(node) == &ia32_registers[REG_ESP])) {
+ return SP_BIAS_RESET;
+ }
+
return 0;
}
arch_irn_add_flags(push, arch_irn_flags_prolog);
curr_sp = new_r_Proj(push, get_irn_mode(curr_sp), pn_ia32_Push_stack);
*mem = new_r_Proj(push, mode_M, pn_ia32_Push_M);
+ set_irn_pinned(push, op_pin_state_pinned);
/* the push must have SP out register */
arch_set_irn_register(curr_sp, arch_env->sp);
arch_irn_add_flags(curr_bp, arch_irn_flags_prolog);
be_set_constr_single_reg_out(curr_bp, 0, arch_env->bp,
arch_register_req_type_ignore);
+ set_irn_pinned(curr_bp, op_pin_state_pinned);
/* beware: the copy must be done before any other sp use */
curr_sp = be_new_CopyKeep_single(arch_env->sp->reg_class, bl, curr_sp, curr_bp, get_irn_mode(curr_sp));
/* simply remove the stack frame here */
curr_sp = be_new_IncSP(arch_env->sp, bl, curr_sp, BE_STACK_FRAME_SIZE_SHRINK, 0);
arch_irn_add_flags(curr_sp, arch_irn_flags_epilog);
+ set_irn_pinned(curr_sp, op_pin_state_pinned);
} else {
ir_mode *mode_bp = arch_env->bp->reg_class->mode;
curr_bp = new_r_Proj(leave, mode_bp, pn_ia32_Leave_frame);
curr_sp = new_r_Proj(leave, get_irn_mode(curr_sp), pn_ia32_Leave_stack);
arch_irn_add_flags(leave, arch_irn_flags_epilog);
+ set_irn_pinned(leave, op_pin_state_pinned);
} else {
ir_node *pop;
be_set_constr_single_reg_out(curr_sp, 0, arch_env->sp,
arch_register_req_type_ignore);
arch_irn_add_flags(curr_sp, arch_irn_flags_epilog);
+ set_irn_pinned(curr_sp, op_pin_state_pinned);
/* pop ebp */
pop = new_bd_ia32_PopEbp(NULL, bl, *mem, curr_sp);
curr_bp = new_r_Proj(pop, mode_bp, pn_ia32_Pop_res);
curr_sp = new_r_Proj(pop, get_irn_mode(curr_sp), pn_ia32_Pop_stack);
arch_irn_add_flags(pop, arch_irn_flags_epilog);
+ set_irn_pinned(pop, op_pin_state_pinned);
*mem = new_r_Proj(pop, mode_M, pn_ia32_Pop_M);
}
*/
static void ia32_after_ra(ir_graph *irg)
{
- be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
+ be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
+ bool at_begin = stack_layout->sp_relative ? true : false;
+ be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
/* create and coalesce frame entities */
irg_walk_graph(irg, NULL, ia32_collect_frame_entity_nodes, fec_env);
- be_assign_entities(fec_env, ia32_set_frame_entity);
+ be_assign_entities(fec_env, ia32_set_frame_entity, at_begin);
be_free_frame_entity_coalescer(fec_env);
irg_block_walk_graph(irg, NULL, ia32_after_ra_walker, NULL);
static arch_env_t *ia32_init(FILE *file_handle)
{
ia32_isa_t *isa = XMALLOC(ia32_isa_t);
- size_t i, n;
set_tarval_output_modes();
/* enter the ISA object into the intrinsic environment */
intrinsic_env.isa = isa;
- /* emit asm includes */
- n = get_irp_n_asms();
- for (i = 0; i < n; ++i) {
- be_emit_cstring("#APP\n");
- be_emit_ident(get_irp_asm(i));
- be_emit_cstring("\n#NO_APP\n");
- }
-
- /* needed for the debug support */
- be_gas_emit_switch_section(GAS_SECTION_TEXT);
- be_emit_irprintf("%stext0:\n", be_gas_get_private_prefix());
- be_emit_write_line();
-
return &isa->base;
}