Commit fe638137 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

amd64, arm, sparc: Name the outputs of the respective call nodes.

parent fd5e3f96
......@@ -13,11 +13,6 @@
#include "amd64_nodes_attr.h"
#include "gen_amd64_new_nodes.h"
enum {
pn_amd64_Call_mem = 0,
pn_amd64_Call_flags = 1,
pn_amd64_Call_first_res = 2,
};
enum {
n_amd64_Return_stack = 1,
};
......
......@@ -474,6 +474,7 @@ call => {
state => "exc_pinned",
in_reqs => "...",
out_reqs => "...",
outs => [ "M", "flags", "first_result" ],
attr_type => "amd64_addr_attr_t",
attr => "amd64_op_mode_t op_mode, amd64_addr_t addr",
fixed => "amd64_insn_mode_t insn_mode = INSN_MODE_64;\n",
......
......@@ -1851,15 +1851,10 @@ static ir_node *gen_Call(ir_node *node)
assert(in_arity <= (int)max_inputs);
/* outputs:
* - memory
* - flags
* - results
* - caller saves
*/
int n_caller_saves
= rbitset_popcount(cconv->caller_saves, N_AMD64_REGISTERS);
int out_arity = 2 + cconv->n_reg_results + n_caller_saves;
/* count outputs */
unsigned o = pn_amd64_call_first_result;
unsigned const n_caller_saves = rbitset_popcount(cconv->caller_saves, N_AMD64_REGISTERS);
unsigned const out_arity = o + cconv->n_reg_results + n_caller_saves;
/* create call node */
ir_node *call = new_bd_amd64_call(dbgi, new_block, in_arity, in, out_arity,
......@@ -1869,19 +1864,12 @@ static ir_node *gen_Call(ir_node *node)
fix_node_mem_proj(call, mem_proj);
/* create output register reqs */
int o = 0;
arch_set_irn_register_req_out(call, pn_amd64_call_M, arch_no_register_req);
int memo = o++;
arch_set_irn_register_req_out(call, memo, arch_no_register_req);
assert(memo == pn_amd64_Call_mem);
int flagso = o++;
arch_set_irn_register_req_out(call, flagso,
amd64_reg_classes[CLASS_amd64_flags].class_req);
assert(flagso == pn_amd64_Call_flags);
arch_register_class_t const *const flags = &amd64_reg_classes[CLASS_amd64_flags];
arch_set_irn_register_req_out(call, pn_amd64_call_flags, flags->class_req);
/* add register requirements for the result regs */
assert(o == pn_amd64_Call_first_res);
for (size_t r = 0; r < n_ress; ++r) {
const reg_or_stackslot_t *result_info = &cconv->results[r];
const arch_register_t *reg = result_info->reg;
......@@ -1924,7 +1912,7 @@ static ir_node *gen_Proj_Call(ir_node *node)
ir_node *new_call = be_transform_node(call);
switch ((pn_Call)pn) {
case pn_Call_M:
return new_r_Proj(new_call, mode_M, pn_amd64_Call_mem);
return new_r_Proj(new_call, mode_M, pn_amd64_call_M);
case pn_Call_X_regular:
case pn_Call_X_except:
case pn_Call_T_result:
......@@ -1942,7 +1930,7 @@ static ir_node *gen_Proj_Proj_Call(ir_node *node)
x86_cconv_t *cconv = amd64_decide_calling_convention(tp, NULL);
const reg_or_stackslot_t *res = &cconv->results[pn];
ir_mode *mode = get_irn_mode(node);
unsigned new_pn = pn_amd64_Call_first_res+res->reg_offset;
unsigned new_pn = pn_amd64_call_first_result + res->reg_offset;
assert(res->reg != NULL);
if (mode_needs_gp_reg(mode))
......
......@@ -445,6 +445,7 @@ Bl => {
irn_flags => [ "modify_flags" ],
in_reqs => "...",
out_reqs => "...",
outs => [ "M", "first_result" ],
attr_type => "arm_Address_attr_t",
attr => "ir_entity *entity, int offset",
emit => 'bl %I',
......
......@@ -1640,7 +1640,7 @@ static ir_node *gen_Proj_Call(ir_node *node)
ir_node *new_call = be_transform_node(call);
switch ((pn_Call)pn) {
case pn_Call_M:
return new_r_Proj(new_call, mode_M, 0);
return new_r_Proj(new_call, mode_M, pn_arm_Bl_M);
case pn_Call_X_regular:
case pn_Call_X_except:
case pn_Call_T_result:
......@@ -2004,11 +2004,8 @@ static ir_node *gen_Call(ir_node *node)
assert(sync_arity <= n_params);
assert(in_arity <= max_inputs);
/* outputs:
* - memory
* - caller saves
*/
size_t out_arity = 1 + n_caller_saves;
/* Count outputs. */
unsigned const out_arity = pn_arm_Bl_first_result + n_caller_saves;
ir_node *res;
if (entity != NULL) {
......@@ -2027,10 +2024,10 @@ static ir_node *gen_Call(ir_node *node)
arch_set_irn_register_reqs_in(res, in_req);
/* create output register reqs */
arch_set_irn_register_req_out(res, 0, arch_no_register_req);
arch_set_irn_register_req_out(res, pn_arm_Bl_M, arch_no_register_req);
for (size_t o = 0; o < n_caller_saves; ++o) {
const arch_register_t *reg = caller_saves[o];
arch_set_irn_register_req_out(res, o+1, reg->single_req);
arch_set_irn_register_req_out(res, pn_arm_Bl_first_result + o, reg->single_req);
}
/* copy pinned attribute */
......
......@@ -556,6 +556,7 @@ Call => {
state => "exc_pinned",
in_reqs => "...",
out_reqs => "...",
outs => [ "M", "first_result" ],
attr_type => "sparc_call_attr_t",
constructors => {
imm => {
......
......@@ -2120,12 +2120,9 @@ static ir_node *gen_Call(ir_node *node)
}
assert(in_arity <= (int)max_inputs);
/* outputs:
* - memory
* - results
* - caller saves
*/
int out_arity = 1 + cconv->n_reg_results + n_caller_saves;
/* Count outputs. */
unsigned o = pn_sparc_Call_first_result;
unsigned const out_arity = o + cconv->n_reg_results + n_caller_saves;
/* create call node */
ir_node *res;
......@@ -2139,8 +2136,7 @@ static ir_node *gen_Call(ir_node *node)
arch_set_irn_register_reqs_in(res, in_req);
/* create output register reqs */
int o = 0;
arch_set_irn_register_req_out(res, o++, arch_no_register_req);
arch_set_irn_register_req_out(res, pn_sparc_Call_M, arch_no_register_req);
/* add register requirements for the result regs */
for (size_t r = 0; r < n_ress; ++r) {
const reg_or_stackslot_t *result_info = &cconv->results[r];
......@@ -2680,7 +2676,7 @@ static ir_node *gen_Proj_Call(ir_node *node)
switch ((pn_Call) pn) {
case pn_Call_M:
return new_r_Proj(new_call, mode_M, 0);
return new_r_Proj(new_call, mode_M, pn_sparc_Call_M);
case pn_Call_X_regular:
case pn_Call_X_except:
case pn_Call_T_result:
......
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