Commit ff26d458 authored by Matthias Braun's avatar Matthias Braun
Browse files

cleanup, use C99

parent 00b938cf
...@@ -187,47 +187,41 @@ static void rewrite_unsigned_float_Conv(ir_node *node) ...@@ -187,47 +187,41 @@ static void rewrite_unsigned_float_Conv(ir_node *node)
part_block(node); part_block(node);
{ ir_node *block = get_nodes_block(node);
ir_node *block = get_nodes_block(node); ir_node *unsigned_x = get_Conv_op(node);
ir_node *unsigned_x = get_Conv_op(node); ir_mode *mode_u = get_irn_mode(unsigned_x);
ir_mode *mode_u = get_irn_mode(unsigned_x); ir_mode *mode_s = find_signed_mode(mode_u);
ir_mode *mode_s = find_signed_mode(mode_u); ir_mode *mode_d = mode_D;
ir_mode *mode_d = mode_D; ir_node *signed_x = new_rd_Conv(dbgi, block, unsigned_x, mode_s);
ir_node *signed_x = new_rd_Conv(dbgi, block, unsigned_x, mode_s); ir_node *res = new_rd_Conv(dbgi, block, signed_x, mode_d);
ir_node *res = new_rd_Conv(dbgi, block, signed_x, mode_d); ir_node *zero = new_r_Const(irg, get_mode_null(mode_s));
ir_node *zero = new_r_Const(irg, get_mode_null(mode_s)); ir_node *cmp = new_rd_Cmp(dbgi, block, signed_x, zero,
ir_node *cmp = new_rd_Cmp(dbgi, block, signed_x, zero, ir_relation_less);
ir_relation_less); ir_node *cond = new_rd_Cond(dbgi, block, cmp);
ir_node *cond = new_rd_Cond(dbgi, block, cmp); ir_node *proj_true = new_r_Proj(cond, mode_X, pn_Cond_true);
ir_node *proj_true = new_r_Proj(cond, mode_X, pn_Cond_true); ir_node *proj_false = new_r_Proj(cond, mode_X, pn_Cond_false);
ir_node *proj_false = new_r_Proj(cond, mode_X, pn_Cond_false); ir_node *in_true[1] = { proj_true };
ir_node *in_true[1] = { proj_true }; ir_node *in_false[1] = { proj_false };
ir_node *in_false[1] = { proj_false }; ir_node *true_block = new_r_Block(irg, ARRAY_SIZE(in_true), in_true);
ir_node *true_block = new_r_Block(irg, ARRAY_SIZE(in_true), in_true); ir_node *false_block = new_r_Block(irg, ARRAY_SIZE(in_false),in_false);
ir_node *false_block = new_r_Block(irg, ARRAY_SIZE(in_false),in_false); ir_node *true_jmp = new_r_Jmp(true_block);
ir_node *true_jmp = new_r_Jmp(true_block); ir_node *false_jmp = new_r_Jmp(false_block);
ir_node *false_jmp = new_r_Jmp(false_block); ir_tarval *correction = new_tarval_from_double(4294967296., mode_d);
ir_tarval *correction = new_tarval_from_double(4294967296., mode_d); ir_node *c_const = new_r_Const(irg, correction);
ir_node *c_const = new_r_Const(irg, correction); ir_node *fadd = new_rd_Add(dbgi, true_block, res, c_const, mode_d);
ir_node *fadd = new_rd_Add(dbgi, true_block, res, c_const,
mode_d); ir_node *lower_in[2] = { true_jmp, false_jmp };
ir_node *phi_in[2] = { fadd, res };
ir_node *lower_in[2] = { true_jmp, false_jmp }; ir_mode *dest_mode = get_irn_mode(node);
ir_node *phi_in[2] = { fadd, res };
ir_mode *dest_mode = get_irn_mode(node); set_irn_in(lower_block, ARRAY_SIZE(lower_in), lower_in);
ir_node *phi; ir_node *phi = new_r_Phi(lower_block, ARRAY_SIZE(phi_in), phi_in, mode_d);
ir_node *res_conv; assert(get_Block_phis(lower_block) == NULL);
set_Block_phis(lower_block, phi);
set_irn_in(lower_block, ARRAY_SIZE(lower_in), lower_in); set_Phi_next(phi, NULL);
phi = new_r_Phi(lower_block, ARRAY_SIZE(phi_in), phi_in, mode_d);
assert(get_Block_phis(lower_block) == NULL); ir_node *res_conv = new_rd_Conv(dbgi, lower_block, phi, dest_mode);
set_Block_phis(lower_block, phi); exchange(node, res_conv);
set_Phi_next(phi, NULL);
res_conv = new_rd_Conv(dbgi, lower_block, phi, dest_mode);
exchange(node, res_conv);
}
} }
/** /**
...@@ -249,58 +243,54 @@ static void rewrite_float_unsigned_Conv(ir_node *node) ...@@ -249,58 +243,54 @@ static void rewrite_float_unsigned_Conv(ir_node *node)
part_block(node); part_block(node);
{ ir_node *block = get_nodes_block(node);
ir_node *block = get_nodes_block(node); ir_node *float_x = get_Conv_op(node);
ir_node *float_x = get_Conv_op(node); ir_mode *mode_u = get_irn_mode(node);
ir_mode *mode_u = get_irn_mode(node); ir_mode *mode_s = find_signed_mode(mode_u);
ir_mode *mode_s = find_signed_mode(mode_u); ir_mode *mode_f = get_irn_mode(float_x);
ir_mode *mode_f = get_irn_mode(float_x); ir_tarval *limit = new_tarval_from_double(2147483648., mode_f);
ir_tarval *limit = new_tarval_from_double(2147483648., mode_f); ir_node *limitc = new_r_Const(irg, limit);
ir_node *limitc = new_r_Const(irg, limit); ir_node *cmp = new_rd_Cmp(dbgi, block, float_x, limitc,
ir_node *cmp = new_rd_Cmp(dbgi, block, float_x, limitc, ir_relation_greater_equal);
ir_relation_greater_equal); ir_node *cond = new_rd_Cond(dbgi, block, cmp);
ir_node *cond = new_rd_Cond(dbgi, block, cmp); ir_node *proj_true = new_r_Proj(cond, mode_X, pn_Cond_true);
ir_node *proj_true = new_r_Proj(cond, mode_X, pn_Cond_true); ir_node *proj_false = new_r_Proj(cond, mode_X, pn_Cond_false);
ir_node *proj_false = new_r_Proj(cond, mode_X, pn_Cond_false); ir_node *in_true[1] = { proj_true };
ir_node *in_true[1] = { proj_true }; ir_node *in_false[1] = { proj_false };
ir_node *in_false[1] = { proj_false }; ir_node *true_block = new_r_Block(irg, ARRAY_SIZE(in_true), in_true);
ir_node *true_block = new_r_Block(irg, ARRAY_SIZE(in_true), in_true); ir_node *false_block = new_r_Block(irg, ARRAY_SIZE(in_false),in_false);
ir_node *false_block = new_r_Block(irg, ARRAY_SIZE(in_false),in_false); ir_node *true_jmp = new_r_Jmp(true_block);
ir_node *true_jmp = new_r_Jmp(true_block); ir_node *false_jmp = new_r_Jmp(false_block);
ir_node *false_jmp = new_r_Jmp(false_block);
ir_tarval *correction = new_tarval_from_long(0x80000000l, mode_s);
ir_tarval *correction = new_tarval_from_long(0x80000000l, mode_s); ir_node *c_const = new_r_Const(irg, correction);
ir_node *c_const = new_r_Const(irg, correction); ir_node *sub = new_rd_Sub(dbgi, true_block, float_x, limitc,
ir_node *sub = new_rd_Sub(dbgi, true_block, float_x, limitc, mode_f);
mode_f); ir_node *sub_conv = new_rd_Conv(dbgi, true_block, sub, mode_s);
ir_node *sub_conv = new_rd_Conv(dbgi, true_block, sub, mode_s); ir_node *xorn = new_rd_Eor(dbgi, true_block, sub_conv, c_const,
ir_node *xorn = new_rd_Eor(dbgi, true_block, sub_conv, c_const, mode_s);
mode_s);
ir_node *converted = new_rd_Conv(dbgi, false_block, float_x,mode_s);
ir_node *converted = new_rd_Conv(dbgi, false_block, float_x,mode_s);
ir_node *lower_in[2] = { true_jmp, false_jmp };
ir_node *lower_in[2] = { true_jmp, false_jmp }; ir_node *phi_in[2] = { xorn, converted };
ir_node *phi_in[2] = { xorn, converted };
ir_node *phi; set_irn_in(lower_block, ARRAY_SIZE(lower_in), lower_in);
ir_node *res_conv; ir_node *phi = new_r_Phi(lower_block, ARRAY_SIZE(phi_in), phi_in, mode_s);
assert(get_Block_phis(lower_block) == NULL);
set_irn_in(lower_block, ARRAY_SIZE(lower_in), lower_in); set_Block_phis(lower_block, phi);
phi = new_r_Phi(lower_block, ARRAY_SIZE(phi_in), phi_in, mode_s); set_Phi_next(phi, NULL);
assert(get_Block_phis(lower_block) == NULL);
set_Block_phis(lower_block, phi); ir_node *res_conv = new_rd_Conv(dbgi, lower_block, phi, mode_u);
set_Phi_next(phi, NULL); exchange(node, res_conv);
res_conv = new_rd_Conv(dbgi, lower_block, phi, mode_u);
exchange(node, res_conv);
}
} }
static int sparc_rewrite_Conv(ir_node *node, void *ctx) static int sparc_rewrite_Conv(ir_node *node, void *ctx)
{ {
(void) ctx;
ir_mode *to_mode = get_irn_mode(node); ir_mode *to_mode = get_irn_mode(node);
ir_node *op = get_Conv_op(node); ir_node *op = get_Conv_op(node);
ir_mode *from_mode = get_irn_mode(op); ir_mode *from_mode = get_irn_mode(op);
(void) ctx;
if (mode_is_float(to_mode) && mode_is_int(from_mode) if (mode_is_float(to_mode) && mode_is_int(from_mode)
&& get_mode_size_bits(from_mode) == 32 && get_mode_size_bits(from_mode) == 32
...@@ -320,77 +310,66 @@ static int sparc_rewrite_Conv(ir_node *node, void *ctx) ...@@ -320,77 +310,66 @@ static int sparc_rewrite_Conv(ir_node *node, void *ctx)
static void sparc_handle_intrinsics(void) static void sparc_handle_intrinsics(void)
{ {
ir_type *tp, *int_tp, *uint_tp; i_record records[3];
i_record records[8];
size_t n_records = 0; size_t n_records = 0;
runtime_rt rt_iMod, rt_uMod;
#define ID(x) new_id_from_chars(x, sizeof(x)-1)
int_tp = new_type_primitive(mode_Is);
uint_tp = new_type_primitive(mode_Iu);
/* we need to rewrite some forms of int->float conversions */ /* we need to rewrite some forms of int->float conversions */
{ i_instr_record *map_Conv = &records[n_records++].i_instr;
i_instr_record *map_Conv = &records[n_records++].i_instr; map_Conv->kind = INTRINSIC_INSTR;
map_Conv->op = op_Conv;
map_Conv->i_mapper = sparc_rewrite_Conv;
map_Conv->kind = INTRINSIC_INSTR;
map_Conv->op = op_Conv;
map_Conv->i_mapper = sparc_rewrite_Conv;
}
/* SPARC has no signed mod instruction ... */ /* SPARC has no signed mod instruction ... */
{ ir_type *int_tp = new_type_primitive(mode_Is);
i_instr_record *map_Mod = &records[n_records++].i_instr; ir_type *mod_tp = new_type_method(2, 1);
set_method_param_type(mod_tp, 0, int_tp);
tp = new_type_method(2, 1); set_method_param_type(mod_tp, 1, int_tp);
set_method_param_type(tp, 0, int_tp); set_method_res_type(mod_tp, 0, int_tp);
set_method_param_type(tp, 1, int_tp);
set_method_res_type(tp, 0, int_tp); runtime_rt rt_iMod;
ident *mod_id = new_id_from_str(".rem");
rt_iMod.ent = new_entity(get_glob_type(), ID(".rem"), tp); rt_iMod.ent = new_entity(get_glob_type(), mod_id, mod_tp);
set_entity_ld_ident(rt_iMod.ent, ID(".rem")); set_entity_ld_ident(rt_iMod.ent, mod_id);
rt_iMod.mode = mode_T; rt_iMod.mode = mode_T;
rt_iMod.res_mode = mode_Is; rt_iMod.res_mode = mode_Is;
rt_iMod.mem_proj_nr = pn_Mod_M; rt_iMod.mem_proj_nr = pn_Mod_M;
rt_iMod.regular_proj_nr = pn_Mod_X_regular; rt_iMod.regular_proj_nr = pn_Mod_X_regular;
rt_iMod.exc_proj_nr = pn_Mod_X_except; rt_iMod.exc_proj_nr = pn_Mod_X_except;
rt_iMod.res_proj_nr = pn_Mod_res; rt_iMod.res_proj_nr = pn_Mod_res;
set_entity_visibility(rt_iMod.ent, ir_visibility_external);
set_entity_visibility(rt_iMod.ent, ir_visibility_external);
i_instr_record *map_imod = &records[n_records++].i_instr;
map_Mod->kind = INTRINSIC_INSTR; map_imod->kind = INTRINSIC_INSTR;
map_Mod->op = op_Mod; map_imod->op = op_Mod;
map_Mod->i_mapper = (i_mapper_func)i_mapper_RuntimeCall; map_imod->i_mapper = (i_mapper_func)i_mapper_RuntimeCall;
map_Mod->ctx = &rt_iMod; map_imod->ctx = &rt_iMod;
}
/* ... nor an unsigned mod. */
{
i_instr_record *map_Mod = &records[n_records++].i_instr;
tp = new_type_method(2, 1);
set_method_param_type(tp, 0, uint_tp);
set_method_param_type(tp, 1, uint_tp);
set_method_res_type(tp, 0, uint_tp);
rt_uMod.ent = new_entity(get_glob_type(), ID(".urem"), tp);
set_entity_ld_ident(rt_uMod.ent, ID(".urem"));
rt_uMod.mode = mode_T;
rt_uMod.res_mode = mode_Iu;
rt_uMod.mem_proj_nr = pn_Mod_M;
rt_uMod.regular_proj_nr = pn_Mod_X_regular;
rt_uMod.exc_proj_nr = pn_Mod_X_except;
rt_uMod.res_proj_nr = pn_Mod_res;
set_entity_visibility(rt_uMod.ent, ir_visibility_external);
map_Mod->kind = INTRINSIC_INSTR;
map_Mod->op = op_Mod;
map_Mod->i_mapper = (i_mapper_func)i_mapper_RuntimeCall;
map_Mod->ctx = &rt_uMod;
}
assert(n_records < ARRAY_SIZE(records)); /* ... nor an unsigned mod. */
ir_type *umod_tp = new_type_method(2, 1);
ir_type *uint_tp = new_type_primitive(mode_Iu);
set_method_param_type(umod_tp, 0, uint_tp);
set_method_param_type(umod_tp, 1, uint_tp);
set_method_res_type(umod_tp, 0, uint_tp);
runtime_rt rt_uMod;
ident *umod_id = new_id_from_str(".urem");
rt_uMod.ent = new_entity(get_glob_type(), umod_id, umod_tp);
set_entity_ld_ident(rt_uMod.ent, umod_id);
rt_uMod.mode = mode_T;
rt_uMod.res_mode = mode_Iu;
rt_uMod.mem_proj_nr = pn_Mod_M;
rt_uMod.regular_proj_nr = pn_Mod_X_regular;
rt_uMod.exc_proj_nr = pn_Mod_X_except;
rt_uMod.res_proj_nr = pn_Mod_res;
set_entity_visibility(rt_uMod.ent, ir_visibility_external);
i_instr_record *map_umod = &records[n_records++].i_instr;
map_umod->kind = INTRINSIC_INSTR;
map_umod->op = op_Mod;
map_umod->i_mapper = (i_mapper_func)i_mapper_RuntimeCall;
map_umod->ctx = &rt_uMod;
assert(n_records <= ARRAY_SIZE(records));
lower_intrinsics(records, n_records, /*part_block_used=*/ true); lower_intrinsics(records, n_records, /*part_block_used=*/ true);
} }
...@@ -430,12 +409,9 @@ static void sparc_end_codegeneration(void *self) ...@@ -430,12 +409,9 @@ static void sparc_end_codegeneration(void *self)
static void sparc_lower_for_target(void) static void sparc_lower_for_target(void)
{ {
ir_mode *mode_gp = sparc_reg_classes[CLASS_sparc_gp].mode;
size_t i, n_irgs = get_irp_n_irgs();
lower_calls_with_compounds(LF_RETURN_HIDDEN); lower_calls_with_compounds(LF_RETURN_HIDDEN);
for (i = 0; i < n_irgs; ++i) { for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i); ir_graph *irg = get_irp_irg(i);
/* Turn all small CopyBs into loads/stores and all bigger CopyBs into /* Turn all small CopyBs into loads/stores and all bigger CopyBs into
* memcpy calls. */ * memcpy calls. */
...@@ -447,14 +423,15 @@ static void sparc_lower_for_target(void) ...@@ -447,14 +423,15 @@ static void sparc_lower_for_target(void)
lower_builtins(0, NULL); lower_builtins(0, NULL);
for (size_t i = 0; i < n_irgs; ++i) { ir_mode *mode_gp = sparc_reg_classes[CLASS_sparc_gp].mode;
for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i); ir_graph *irg = get_irp_irg(i);
lower_switch(irg, 4, 256, mode_gp); lower_switch(irg, 4, 256, mode_gp);
} }
sparc_lower_64bit(); sparc_lower_64bit();
for (i = 0; i < n_irgs; ++i) { for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i); ir_graph *irg = get_irp_irg(i);
ir_lower_mode_b(irg, mode_Iu); ir_lower_mode_b(irg, mode_Iu);
/* TODO: Pass SPARC_MIN_STACKSIZE as addr_delta as soon as /* TODO: Pass SPARC_MIN_STACKSIZE as addr_delta as soon as
...@@ -555,8 +532,8 @@ static ir_node *sparc_new_spill(ir_node *value, ir_node *after) ...@@ -555,8 +532,8 @@ static ir_node *sparc_new_spill(ir_node *value, ir_node *after)
ir_node *frame = get_irg_frame(irg); ir_node *frame = get_irg_frame(irg);
ir_node *mem = get_irg_no_mem(irg); ir_node *mem = get_irg_no_mem(irg);
ir_mode *mode = get_irn_mode(value); ir_mode *mode = get_irn_mode(value);
ir_node *store;
ir_node *store;
if (mode_is_float(mode)) { if (mode_is_float(mode)) {
store = create_stf(NULL, block, value, frame, mem, mode, NULL, 0, true); store = create_stf(NULL, block, value, frame, mem, mode, NULL, 0, true);
} else { } else {
...@@ -574,9 +551,8 @@ static ir_node *sparc_new_reload(ir_node *value, ir_node *spill, ...@@ -574,9 +551,8 @@ static ir_node *sparc_new_reload(ir_node *value, ir_node *spill,
ir_graph *irg = get_irn_irg(value); ir_graph *irg = get_irn_irg(value);
ir_node *frame = get_irg_frame(irg); ir_node *frame = get_irg_frame(irg);
ir_mode *mode = get_irn_mode(value); ir_mode *mode = get_irn_mode(value);
ir_node *load;
ir_node *res;
ir_node *load;
if (mode_is_float(mode)) { if (mode_is_float(mode)) {
load = create_ldf(NULL, block, frame, spill, mode, NULL, 0, true); load = create_ldf(NULL, block, frame, spill, mode, NULL, 0, true);
} else { } else {
...@@ -585,7 +561,7 @@ static ir_node *sparc_new_reload(ir_node *value, ir_node *spill, ...@@ -585,7 +561,7 @@ static ir_node *sparc_new_reload(ir_node *value, ir_node *spill,
} }
sched_add_before(before, load); sched_add_before(before, load);
assert((long)pn_sparc_Ld_res == (long)pn_sparc_Ldf_res); assert((long)pn_sparc_Ld_res == (long)pn_sparc_Ldf_res);
res = new_r_Proj(load, mode, pn_sparc_Ld_res); ir_node *res = new_r_Proj(load, mode, pn_sparc_Ld_res);
return res; return res;
} }
......
...@@ -305,7 +305,7 @@ static bool uses_reg(const ir_node *node, unsigned reg_index, unsigned width) ...@@ -305,7 +305,7 @@ static bool uses_reg(const ir_node *node, unsigned reg_index, unsigned width)
static bool writes_reg(const ir_node *node, unsigned reg_index, unsigned width) static bool writes_reg(const ir_node *node, unsigned reg_index, unsigned width)
{ {
be_foreach_out(node, o) { be_foreach_out(node, o) {
const arch_register_t *out_reg = arch_get_irn_register_out(node, o); const arch_register_t *out_reg = arch_get_irn_register_out(node, o);
if (out_reg == NULL) if (out_reg == NULL)
continue; continue;
const arch_register_req_t *out_req = arch_get_irn_register_req_out(node, o); const arch_register_req_t *out_req = arch_get_irn_register_req_out(node, o);
...@@ -375,8 +375,7 @@ static bool can_move_up_into_delayslot(const ir_node *node, const ir_node *to) ...@@ -375,8 +375,7 @@ static bool can_move_up_into_delayslot(const ir_node *node, const ir_node *to)
return false; return false;
/* node must not use any results of 'to' */ /* node must not use any results of 'to' */
int arity = get_irn_arity(node); for (int i = 0, arity = get_irn_arity(node); i < arity; ++i) {
for (int i = 0; i < arity; ++i) {
ir_node *in = get_irn_n(node, i); ir_node *in = get_irn_n(node, i);
ir_node *skipped = skip_Proj(in); ir_node *skipped = skip_Proj(in);
if (skipped == to) if (skipped == to)
...@@ -417,8 +416,7 @@ static bool can_move_up_into_delayslot(const ir_node *node, const ir_node *to) ...@@ -417,8 +416,7 @@ static bool can_move_up_into_delayslot(const ir_node *node, const ir_node *to)
} else if (is_sparc_SDiv(to) || is_sparc_UDiv(to)) { } else if (is_sparc_SDiv(to) || is_sparc_UDiv(to)) {
/* node will be inserted between wr and div so it must not overwrite /* node will be inserted between wr and div so it must not overwrite
* anything except the wr input */ * anything except the wr input */
int arity = get_irn_arity(to); for (int i = 0, arity = get_irn_arity(to); i < arity; ++i) {
for (int i = 0; i < arity; ++i) {
assert((long)n_sparc_SDiv_dividend_high == (long)n_sparc_UDiv_dividend_high); assert((long)n_sparc_SDiv_dividend_high == (long)n_sparc_UDiv_dividend_high);
if (i == n_sparc_SDiv_dividend_high) if (i == n_sparc_SDiv_dividend_high)
continue; continue;
......
...@@ -54,12 +54,11 @@ static void kill_unused_stacknodes(ir_node *node) ...@@ -54,12 +54,11 @@ static void kill_unused_stacknodes(ir_node *node)
} else if (is_Phi(node)) { } else if (is_Phi(node)) {
int arity = get_irn_arity(node); int arity = get_irn_arity(node);
ir_node **ins = ALLOCAN(ir_node*, arity); ir_node **ins = ALLOCAN(ir_node*, arity);
int i;
sched_remove(node); sched_remove(node);
memcpy(ins, get_irn_in(node), arity*sizeof(ins[0])); memcpy(ins, get_irn_in(node), arity*sizeof(ins[0]));
kill_node(node); kill_node(node);
for (i = 0; i < arity; ++i) for (int i = 0; i < arity; ++i)
kill_unused_stacknodes(ins[i]); kill_unused_stacknodes(ins[i]);
} }
} }
...@@ -103,16 +102,11 @@ void sparc_introduce_prolog_epilog(ir_graph *irg) ...@@ -103,16 +102,11 @@ void sparc_introduce_prolog_epilog(ir_graph *irg)
unsigned frame_size = get_type_size_bytes(frame_type); unsigned frame_size = get_type_size_bytes(frame_type);
/* introduce epilog for every return node */ /* introduce epilog for every return node */
{ ir_node *end_block = get_irg_end_block(irg);
ir_node *end_block = get_irg_end_block(irg); for (int i = 0, arity = get_irn_arity(end_block); i < arity; ++i) {
int arity = get_irn_arity(end_block); ir_node *ret = get_irn_n(end_block, i);
int i; assert(is_sparc_Return(ret));
introduce_epilog(ret);
for (i = 0; i < arity; ++i) {
ir_node *ret = get_irn_n(end_block, i);
assert(is_sparc_Return(ret));
introduce_epilog(ret);
}
} }
while (be_is_Keep(sched_next(schedpoint))) while (be_is_Keep(sched_next(schedpoint)))
...@@ -172,7 +166,7 @@ static void finish_sparc_Save(ir_node *node) ...@@ -172,7 +166,7 @@ static void finish_sparc_Save(ir_node *node)
sparc_attr_t *attr = get_sparc_attr(node); sparc_attr_t *attr = get_sparc_attr(node);
int offset = attr->immediate_value; int offset = attr->immediate_value;
if (! sparc_is_value_imm_encodeable(offset)) { if (!sparc_is_value_imm_encodeable(offset)) {
ir_node *base = get_irn_n(node, n_sparc_Save_stack); ir_node *base = get_irn_n(node, n_sparc_Save_stack);
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *block = get_nodes_block(node); ir_node *block = get_nodes_block(node);
...@@ -198,12 +192,12 @@ static void finish_be_IncSP(ir_node *node) ...@@ -198,12 +192,12 @@ static void finish_be_IncSP(ir_node *node)
int offset = be_get_IncSP_offset(node); int offset = be_get_IncSP_offset(node);
/* we might have to break the IncSP apart if the constant has become too big */ /* we might have to break the IncSP apart if the constant has become too big */
if (! sparc_is_value_imm_encodeable(offset) && ! sparc_is_value_imm_encodeable(-offset)) { if (!sparc_is_value_imm_encodeable(offset) && !sparc_is_value_imm_encodeable(-offset)) {
ir_node *sp = be_get_IncSP_pred(node); ir_node *sp = be_get_IncSP_pred(node);
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *block = get_nodes_block(node); ir_node *block = get_nodes_block(node);
ir_node *constant = create_constant_from_immediate(node, offset); ir_node *constant = create_constant_from_immediate(node, offset);
ir_node *sub = new_bd_sparc_Sub_reg(dbgi, block, sp, constant); ir_node *sub = new_bd_sparc_Sub_reg(dbgi, block, sp, constant);
sched_add_before(node, sub); sched_add_before(node, sub);
arch_set_irn_register(sub, &sparc_registers[REG_SP]); arch_set_irn_register(sub, &sparc_registers[REG_SP]);
...@@ -221,7 +215,7 @@ static void finish_sparc_FrameAddr(ir_node *node) ...@@ -221,7 +215,7 @@ static void finish_sparc_FrameAddr(ir_node *node)
sparc_attr_t *attr = get_sparc_attr(node); sparc_attr_t *attr = get_sparc_attr(node);
int offset = attr->immediate_value; int offset = attr->immediate_value;
if (! sparc_is_value_imm_encodeable(offset)) { if (!sparc_is_value_imm_encodeable(offset)) {
ir_node *base = get_irn_n(node, n_sparc_FrameAddr_base); ir_node *base = get_irn_n(node, n_sparc_FrameAddr_base);
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *block = get_nodes_block(node); ir_node *block = get_nodes_block(node);
...@@ -241,10 +235,10 @@ static void finish_sparc_Ld(ir_node *node) ...@@ -241,10 +235,10 @@ static void finish_sparc_Ld(ir_node *node)
int offset = attr->immediate_value; int offset = attr->immediate_value;
const sparc_load_store_attr_t *load_store_attr = get_sparc_load_store_attr_const(node); const sparc_load_store_attr_t *load_store_attr = get_sparc_load_store_attr_const(node);
if (! load_store_attr->is_frame_entity) if (!load_store_attr->is_frame_entity)
return; return;
if (! sparc_is_value_imm_encodeable(offset)) { if (!sparc_is_value_imm_encodeable(offset)) {
ir_node *ptr = get_irn_n(node, n_sparc_Ld_ptr); ir_node *ptr = get_irn_n(node, n_sparc_Ld_ptr);
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *block = get_nodes_block(node); ir_node *block = get_nodes_block(node);
...@@ -302,10 +296,10 @@ static void finish_sparc_Ldf(ir_node *node) ...@@ -302,10 +296,10 @@ static void finish_sparc_Ldf(ir_node *node)
int offset = attr->immediate_value; int offset = attr->immediate_value;
const sparc_load_store_attr_t *load_store_attr = get_sparc_load_store_attr_const(node); const sparc_load_store_attr_t *load_store_attr = get_sparc_load_store_attr_const(node);
if (! load_store_attr->is_frame_entity) if (!load_store_attr->is_frame_entity)
return; return;
if (! sparc_is_value_imm_encodeable(offset)) { if (!sparc_is_value_imm_encodeable(offset)) {
ir_node *ptr = get_irn_n(node, n_sparc_Ldf_ptr); ir_node *ptr = get_irn_n(node, n_sparc_Ldf_ptr);
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *block = get_nodes_block(node); ir_node *block = get_nodes_block(node);
...@@ -334,10 +328,10 @@ static void finish_sparc_St(ir_node *node) ...@@ -334,10 +328,10 @@ static void finish_sparc_St(ir_node *node)
int offset = attr->immediate_value; int offset = attr->immediate_value;
const sparc_load_store_attr_t *load_store_attr = get_sparc_load_store_attr_const(node); const sparc_load_store_attr_t *load_store_attr = get_sparc_load_store_attr_const(node);
if (! load_store_attr->is_frame_entity) if (!load_store_attr->is_frame_entity)