X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeabi.c;h=5a39c296c34e03038c496cd4c4b78e89997f236c;hb=fbac84f353f42aec374c6e441782ceb60740e60f;hp=ad5d19831a0a3bce711e2b15b615f8441c101517;hpb=d4bbab11371a9c68aa2a716eaa7589b82a28691e;p=libfirm diff --git a/ir/be/beabi.c b/ir/be/beabi.c index ad5d19831..5a39c296c 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -23,9 +23,7 @@ * @author Sebastian Hack, Michael Beck * @version $Id$ */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include "obst.h" #include "offset.h" @@ -172,7 +170,7 @@ static be_abi_call_arg_t *get_or_set_call_arg(be_abi_call_t *call, int is_res, i * @param is_res true for call results, false for call arguments * @param pos position of the argument */ -static INLINE be_abi_call_arg_t *get_call_arg(be_abi_call_t *call, int is_res, int pos) +static inline be_abi_call_arg_t *get_call_arg(be_abi_call_t *call, int is_res, int pos) { return get_or_set_call_arg(call, is_res, pos, 0); } @@ -383,7 +381,7 @@ static void stack_layout_dump(FILE *file, be_stack_layout_t *frame) * Returns non-zero if the call argument at given position * is transfered on the stack. */ -static INLINE int is_on_stack(be_abi_call_t *call, int pos) +static inline int is_on_stack(be_abi_call_t *call, int pos) { be_abi_call_arg_t *arg = get_call_arg(call, 0, pos); return arg && !arg->in_reg; @@ -601,8 +599,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) /* search the greatest result proj number */ - res_projs = alloca(n_res * sizeof(res_projs[0])); - memset(res_projs, 0, n_res * sizeof(res_projs[0])); + res_projs = ALLOCANZ(ir_node*, n_res); foreach_out_edge(irn, edge) { const ir_edge_t *res_edge; @@ -669,7 +666,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) curr_sp = new_r_Proj(irg, bl, low_call, get_irn_mode(curr_sp), pn_be_Call_sp); be_set_constr_single_reg(low_call, BE_OUT_POS(pn_be_Call_sp), sp); - arch_set_irn_register(arch_env, curr_sp, sp); + arch_set_irn_register(curr_sp, sp); be_node_set_flags(low_call, BE_OUT_POS(pn_be_Call_sp), arch_irn_flags_ignore | arch_irn_flags_modify_sp); @@ -728,7 +725,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) assert(arg->in_reg); be_set_constr_single_reg(low_call, BE_OUT_POS(pn), arg->reg); - arch_set_irn_register(arch_env, proj, arg->reg); + arch_set_irn_register(proj, arg->reg); } obstack_free(obst, in); exchange(irn, low_call); @@ -759,7 +756,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) /* memorize the register in the link field. we need afterwards to set the register class of the keep correctly. */ be_set_constr_single_reg(low_call, BE_OUT_POS(curr_res_proj), reg); - arch_set_irn_register(arch_env, proj, reg); + arch_set_irn_register(proj, reg); /* a call can produce ignore registers, in this case set the flag and register for the Proj */ if (arch_register_type_is(reg, ignore)) { @@ -1364,13 +1361,13 @@ static ir_node *create_barrier(be_abi_irg_t *env, ir_node *bl, ir_node **mem, pm be_set_constr_single_reg(irn, n, reg); be_set_constr_single_reg(irn, pos, reg); be_node_set_reg_class(irn, pos, reg->reg_class); - arch_set_irn_register(env->birg->main_env->arch_env, proj, reg); + arch_set_irn_register(proj, reg); /* if the proj projects a ignore register or a node which is set to ignore, propagate this property. */ - if (arch_register_type_is(reg, ignore) || arch_irn_is(env->birg->main_env->arch_env, in[n], ignore)) + if (arch_register_type_is(reg, ignore) || arch_irn_is(in[n], ignore)) flags |= arch_irn_flags_ignore; - if (arch_irn_is(env->birg->main_env->arch_env, in[n], modify_sp)) + if (arch_irn_is(in[n], modify_sp)) flags |= arch_irn_flags_modify_sp; be_node_set_flags(irn, pos, flags); @@ -1840,7 +1837,7 @@ static void modify_irg(be_abi_irg_t *env) proj = new_r_Proj(irg, reg_params_bl, env->reg_params, mode, nr); pmap_insert(env->regs, (void *) reg, proj); be_set_constr_single_reg(env->reg_params, pos, reg); - arch_set_irn_register(env->birg->main_env->arch_env, proj, reg); + arch_set_irn_register(proj, reg); /* * If the register is an ignore register, @@ -1878,7 +1875,7 @@ static void modify_irg(be_abi_irg_t *env) create_barrier(env, start_bl, &mem, env->regs, 0); env->init_sp = be_abi_reg_map_get(env->regs, sp); - arch_set_irn_register(env->birg->main_env->arch_env, env->init_sp, sp); + arch_set_irn_register(env->init_sp, sp); frame_pointer = be_abi_reg_map_get(env->regs, fp_reg); set_irg_frame(irg, frame_pointer); @@ -2306,7 +2303,6 @@ typedef ir_node **node_array; typedef struct fix_stack_walker_env_t { node_array sp_nodes; - const arch_env_t *arch_env; } fix_stack_walker_env_t; /** @@ -2316,7 +2312,7 @@ static void collect_stack_nodes_walker(ir_node *node, void *data) { fix_stack_walker_env_t *env = data; - if (arch_irn_is(env->arch_env, node, modify_sp)) { + if (arch_irn_is(node, modify_sp)) { assert(get_irn_mode(node) != mode_M && get_irn_mode(node) != mode_T); ARR_APP1(ir_node*, env->sp_nodes, node); } @@ -2332,7 +2328,6 @@ void be_abi_fix_stack_nodes(be_abi_irg_t *env) fix_stack_walker_env_t walker_env; walker_env.sp_nodes = NEW_ARR_F(ir_node*, 0); - walker_env.arch_env = birg->main_env->arch_env; irg_walk_graph(birg->irg, collect_stack_nodes_walker, NULL, &walker_env); @@ -2366,9 +2361,9 @@ void be_abi_fix_stack_nodes(be_abi_irg_t *env) len = ARR_LEN(phis); for(i = 0; i < len; ++i) { ir_node *phi = phis[i]; - be_set_phi_reg_req(walker_env.arch_env, phi, &env->sp_req); - be_set_phi_flags(walker_env.arch_env, phi, arch_irn_flags_ignore | arch_irn_flags_modify_sp); - arch_set_irn_register(walker_env.arch_env, phi, env->arch_env->sp); + be_set_phi_reg_req(phi, &env->sp_req); + be_set_phi_flags(phi, arch_irn_flags_ignore | arch_irn_flags_modify_sp); + arch_set_irn_register(phi, env->arch_env->sp); } be_ssa_construction_destroy(&senv);