Commit 4171a3d0 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

amd64, arm, ia32, sparc: Remove reg_offset from all backend-specific struct calling_convention_t.

Their values are either unused or trivial, i.e. result k has reg_offset k.
parent b412c330
......@@ -109,17 +109,11 @@ x86_cconv_t *amd64_decide_calling_convention(ir_type *function_type,
reg_or_stackslot_t *param = &params[i];
if (mode_is_float(mode) && float_param_regnum < n_float_param_regs) {
const arch_register_t *reg = float_param_regs[float_param_regnum];
param->reg = reg;
param->reg_offset = float_param_regnum + param_regnum;
++float_param_regnum;
param->reg = float_param_regs[float_param_regnum++];
if (amd64_use_x64_abi)
++param_regnum;
} else if (!mode_is_float(mode) && param_regnum < n_param_regs) {
const arch_register_t *reg = param_regs[param_regnum];
param->reg = reg;
param->reg_offset = float_param_regnum + param_regnum;
++param_regnum;
param->reg = param_regs[param_regnum++];
if (amd64_use_x64_abi)
++float_param_regnum;
} else {
......@@ -161,8 +155,7 @@ x86_cconv_t *amd64_decide_calling_convention(ir_type *function_type,
}
reg = result_regs[res_regnum++];
}
result->reg = reg;
result->reg_offset = i;
result->reg = reg;
rbitset_clear(caller_saves, reg->global_index);
++n_reg_results;
}
......
......@@ -1787,21 +1787,18 @@ static ir_node *gen_Proj_Call(ir_node *node)
static ir_node *gen_Proj_Proj_Call(ir_node *node)
{
unsigned pn = get_Proj_num(node);
ir_node *call = get_Proj_pred(get_Proj_pred(node));
ir_node *new_call = be_transform_node(call);
ir_type *tp = get_Call_type(call);
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_result + res->reg_offset;
assert(res->reg != NULL);
ir_node *const call = get_Proj_pred(get_Proj_pred(node));
ir_node *const new_call = be_transform_node(call);
ir_mode *mode = get_irn_mode(node);
if (mode_needs_gp_reg(mode))
mode = mode_gp;
else if (mode_is_float(mode))
mode = amd64_mode_xmm;
x86_free_calling_convention(cconv);
unsigned const pn = get_Proj_num(node);
unsigned const new_pn = pn_amd64_call_first_result + pn;
return new_r_Proj(new_call, mode, new_pn);
}
......
......@@ -72,10 +72,7 @@ calling_convention_t *arm_decide_calling_convention(const ir_graph *irg,
}
if (regnum < n_param_regs) {
const arch_register_t *reg = param_regs[regnum];
param->reg0 = reg;
param->reg_offset = regnum;
++regnum;
param->reg0 = param_regs[regnum++];
} else {
param->offset = stack_offset;
/* increase offset 4 bytes so everything is aligned */
......
......@@ -20,7 +20,6 @@ typedef struct reg_or_stackslot_t
{
const arch_register_t *reg0; /**< if != NULL, the first register used for this parameter. */
const arch_register_t *reg1; /**< if != NULL, the second register used. */
unsigned reg_offset;
ir_type *type; /**< indicates that an entity of the specific
type is needed */
unsigned offset; /**< if transmitted via stack, the offset for this parameter. */
......
......@@ -153,15 +153,9 @@ x86_cconv_t *ia32_decide_calling_convention(ir_type *function_type,
ir_mode *mode = get_type_mode(param_type);
if (mode_is_float(mode) && float_param_regnum < n_float_param_regs) {
const arch_register_t *reg = float_param_regs[float_param_regnum];
param->reg = reg;
param->reg_offset = float_param_regnum + param_regnum;
++float_param_regnum;
param->reg = float_param_regs[float_param_regnum++];
} else if (!mode_is_float(mode) && param_regnum < n_param_regs) {
const arch_register_t *reg = default_param_regs[param_regnum];
param->reg = reg;
param->reg_offset = float_param_regnum + param_regnum;
++param_regnum;
param->reg = default_param_regs[param_regnum++];
} else {
param->type = param_type;
param->offset = stack_offset;
......@@ -202,8 +196,7 @@ align_stack:;
}
reg = result_regs[res_regnum++];
}
result->reg = reg;
result->reg_offset = i;
result->reg = reg;
rbitset_clear(caller_saves, reg->global_index);
++n_reg_results;
}
......
......@@ -5052,20 +5052,18 @@ static ir_node *gen_Proj_Call(ir_node *node)
static ir_node *gen_Proj_Proj_Call(ir_node *node)
{
unsigned pn = get_Proj_num(node);
ir_node *call = get_Proj_pred(get_Proj_pred(node));
ir_node *new_call = be_transform_node(call);
ir_type *tp = get_Call_type(call);
x86_cconv_t *cconv = ia32_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_ia32_Call_first_result + res->reg_offset;
ir_node *const call = get_Proj_pred(get_Proj_pred(node));
ir_node *const new_call = be_transform_node(call);
ir_mode *mode = get_irn_mode(node);
if (mode_needs_gp_reg(mode))
mode = ia32_mode_gp;
else if (mode_is_float(mode))
mode = ia32_mode_E;
x86_free_calling_convention(cconv);
unsigned const pn = get_Proj_num(node);
unsigned const new_pn = pn_ia32_Call_first_result + pn;
return new_r_Proj(new_call, mode, new_pn);
}
......
......@@ -19,7 +19,6 @@
typedef struct reg_or_stackslot_t
{
const arch_register_t *reg;
unsigned reg_offset;
ir_type *type; /**< indicates that an entity of the
specific type is needed */
unsigned offset; /**< if transmitted via stack, the offset
......
......@@ -220,13 +220,11 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
}
if (regnum < n_param_regs) {
const arch_register_t *reg = param_regs[regnum];
arch_register_t const *reg = param_regs[regnum++];
if (irg == NULL || omit_fp)
reg = map_i_to_o_reg(reg);
param->reg0 = reg;
param->req0 = reg->single_req;
param->reg_offset = regnum;
++regnum;
param->reg0 = reg;
param->req0 = reg->single_req;
} else {
param->type = param_type;
param->offset = stack_offset;
......@@ -241,12 +239,11 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
panic("only 32 and 64bit modes supported");
if (regnum < n_param_regs) {
const arch_register_t *reg = param_regs[regnum];
arch_register_t const *reg = param_regs[regnum++];
if (irg == NULL || omit_fp)
reg = map_i_to_o_reg(reg);
param->reg1 = reg;
param->req1 = reg->single_req;
++regnum;
param->reg1 = reg;
param->req1 = reg->single_req;
} else {
ir_mode *regmode = param_regs[0]->cls->mode;
ir_type *type = get_type_for_mode(regmode);
......@@ -280,7 +277,6 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
} else {
const arch_register_t *reg = float_result_regs[next_reg];
rbitset_clear(caller_saves, reg->global_index);
result->reg_offset = i;
if (n_regs == 1) {
result->req0 = reg->single_req;
} else if (n_regs == 2) {
......@@ -309,8 +305,7 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
const arch_register_t *reg = param_regs[regnum++];
if (irg == NULL || omit_fp)
reg = map_i_to_o_reg(reg);
result->req0 = reg->single_req;
result->reg_offset = i;
result->req0 = reg->single_req;
rbitset_clear(caller_saves, reg->global_index);
++n_reg_results;
}
......
......@@ -27,7 +27,6 @@ typedef struct reg_or_stackslot_t
for the 2nd part of the parameter */
const arch_register_t *reg0;
const arch_register_t *reg1;
size_t reg_offset;
ir_type *type; /**< indicates that an entity of the specific
type is needed */
unsigned offset; /**< if transmitted via stack, the offset for
......
......@@ -2467,21 +2467,15 @@ static ir_node *gen_Proj_Call(ir_node *node)
static ir_node *gen_Proj_Proj_Call(ir_node *node)
{
unsigned pn = get_Proj_num(node);
ir_node *call = get_Proj_pred(get_Proj_pred(node));
ir_node *new_call = be_transform_node(call);
ir_type *function_type = get_Call_type(call);
calling_convention_t *cconv
= sparc_decide_calling_convention(function_type, NULL);
const reg_or_stackslot_t *res = &cconv->results[pn];
ir_mode *mode = get_irn_mode(node);
unsigned new_pn = pn_sparc_Call_first_result + res->reg_offset;
ir_node *const call = get_Proj_pred(get_Proj_pred(node));
ir_node *const new_call = be_transform_node(call);
assert(res->req0 != NULL && res->req1 == NULL);
if (mode_needs_gp_reg(mode)) {
ir_mode *mode = get_irn_mode(node);
if (mode_needs_gp_reg(mode))
mode = mode_gp;
}
sparc_free_calling_convention(cconv);
unsigned const pn = get_Proj_num(node);
unsigned const new_pn = pn_sparc_Call_first_result + pn;
return new_r_Proj(new_call, mode, new_pn);
}
......
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