Commit 1325e154 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

amd64: Give leave a memory input and output.

It pops a value from the stack, so this memory access should be represented in the graph.
parent 88b21469
......@@ -244,9 +244,9 @@ sub_sp => {
leave => {
op_flags => [ "uses_memory" ],
state => "exc_pinned",
in_reqs => [ "rbp" ],
out_reqs => [ "rbp:I", "rsp:I" ],
outs => [ "frame", "stack" ],
in_reqs => [ "rbp", "mem" ],
out_reqs => [ "rbp:I", "mem", "rsp:I" ],
outs => [ "frame", "M", "stack" ],
fixed => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
emit => "leave",
},
......
......@@ -525,17 +525,19 @@ static void introduce_epilogue(ir_node *ret)
ir_node *curr_sp = first_sp;
if (!layout->sp_relative) {
int n_rbp = determine_rbp_input(ret);
ir_node *curr_bp = get_irn_n(ret, n_rbp);
ir_node *leave = new_bd_amd64_leave(NULL, block, curr_bp);
curr_bp = be_new_Proj(leave, pn_amd64_leave_frame);
curr_sp = be_new_Proj(leave, pn_amd64_leave_stack);
int const n_rbp = determine_rbp_input(ret);
ir_node *curr_bp = get_irn_n(ret, n_rbp);
ir_node *curr_mem = get_irn_n(ret, n_amd64_ret_mem);
ir_node *const leave = new_bd_amd64_leave(NULL, block, curr_bp, curr_mem);
curr_mem = be_new_Proj(leave, pn_amd64_leave_M);
curr_bp = be_new_Proj(leave, pn_amd64_leave_frame);
curr_sp = be_new_Proj(leave, pn_amd64_leave_stack);
arch_set_irn_register(curr_bp, bp);
arch_set_irn_register(curr_sp, sp);
sched_add_before(ret, leave);
set_irn_n(ret, n_rbp, curr_bp);
set_irn_n(ret, n_amd64_ret_mem, curr_mem);
set_irn_n(ret, n_rbp, curr_bp);
} else {
if (frame_size > 0) {
ir_node *incsp = amd64_new_IncSP(block, curr_sp,
......
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