Commit 63205c89 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

amd64: Name the inputs of ret.

parent 34c76679
......@@ -13,10 +13,6 @@
#include "amd64_nodes_attr.h"
#include "gen_amd64_new_nodes.h"
enum {
n_amd64_Return_stack = 1,
};
static inline amd64_attr_t *get_amd64_attr(ir_node *node)
{
assert(is_amd64_irn(node));
......
......@@ -496,6 +496,7 @@ ret => {
op_flags => [ "cfopcode" ],
in_reqs => "...",
out_reqs => [ "none" ],
ins => [ "mem", "stack", "first_result" ],
fixed => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
mode => "mode_X",
emit => "ret",
......
......@@ -1628,24 +1628,19 @@ static ir_node *gen_Return(ir_node *node)
x86_cconv_t *cconv = current_cconv;
/* estimate number of return values */
size_t n_ins = 2 + n_res; /* memory + stackpointer, return values */
size_t n_callee_saves
= rbitset_popcount(cconv->callee_saves, N_AMD64_REGISTERS);
n_ins += n_callee_saves;
size_t p = n_amd64_ret_first_result;
size_t const n_callee_saves = rbitset_popcount(cconv->callee_saves, N_AMD64_REGISTERS);
size_t const n_ins = p + n_res + n_callee_saves;
const arch_register_req_t **reqs
= OALLOCN(be_obst, const arch_register_req_t*, n_ins);
ir_node **in = ALLOCAN(ir_node*, n_ins);
size_t p = 0;
in[p] = new_mem;
reqs[p] = arch_no_register_req;
++p;
in[n_amd64_ret_mem] = new_mem;
reqs[n_amd64_ret_mem] = arch_no_register_req;
unsigned spp = p++;
assert(spp == n_amd64_Return_stack);
in[spp] = sp;
reqs[spp] = amd64_registers[REG_RSP].single_req;
in[n_amd64_ret_stack] = sp;
reqs[n_amd64_ret_stack] = amd64_registers[REG_RSP].single_req;
/* result values */
for (size_t i = 0; i < n_res; ++i) {
......
......@@ -522,7 +522,7 @@ static void introduce_epilogue(ir_node *ret)
ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size_bytes(frame_type);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ir_node *first_sp = get_irn_n(ret, n_amd64_Return_stack);
ir_node *first_sp = get_irn_n(ret, n_amd64_ret_stack);
ir_node *curr_sp = first_sp;
ir_mode *mode_gp = mode_Lu;
......@@ -546,7 +546,7 @@ static void introduce_epilogue(ir_node *ret)
curr_sp = incsp;
}
}
set_irn_n(ret, n_amd64_Return_stack, curr_sp);
set_irn_n(ret, n_amd64_ret_stack, curr_sp);
/* keep verifier happy... */
if (get_irn_n_edges(first_sp) == 0 && is_Proj(first_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