X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeabi.c;h=492f8285ca6d0034bc10c5f8b6444e31dd2cd816;hb=15769c9f67d00b398ff43e013eddbe5269ba5787;hp=2f6b980e27970ca70c8f9d6966769cf525dbd998;hpb=10978e64425e6d1c4b184294f7504324cab49fa3;p=libfirm diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 2f6b980e2..492f8285c 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -49,7 +49,7 @@ #include "be.h" #include "beabi.h" #include "bearch.h" -#include "benode_t.h" +#include "benode.h" #include "belive_t.h" #include "besched.h" #include "beirg.h" @@ -815,7 +815,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) /* create the Keep for the caller save registers */ in = (ir_node **) obstack_finish(obst); - keep = be_new_Keep(NULL, bl, n, in); + keep = be_new_Keep(bl, n, in); for (i = 0; i < n; ++i) { const arch_register_t *reg = get_irn_link(in[i]); be_node_set_reg_class_in(keep, i, reg->reg_class); @@ -1208,7 +1208,7 @@ static void process_ops_in_block(ir_node *bl, void *data) if (curr_sp != env->init_sp && !(is_Proj(curr_sp) && be_is_Call(get_Proj_pred(curr_sp)))) { nodes[0] = curr_sp; - keep = be_new_Keep(env->arch_env->sp->reg_class, bl, 1, nodes); + keep = be_new_Keep(bl, 1, nodes); pmap_insert(env->keep_map, bl, keep); } } @@ -1260,7 +1260,7 @@ static ir_type *compute_arg_type(be_abi_irg_t *env, be_abi_call_t *call, ident *id = get_entity_ident(get_irg_entity(env->birg->irg)); ir_entity **map; - *param_map = map = obstack_alloc(&env->obst, n * sizeof(ir_entity *)); + *param_map = map = OALLOCN(&env->obst, ir_entity*, n); res = new_type_struct(id_mangle_u(id, new_id_from_chars("arg_type", 8))); for (i = 0; i < n; ++i, curr += inc) { ir_type *param_type = get_method_param_type(method_type, curr); @@ -1315,7 +1315,7 @@ static reg_node_map_t *reg_map_to_arr(struct obstack *obst, pmap *reg_map) pmap_entry *ent; int n = pmap_count(reg_map); int i = 0; - reg_node_map_t *res = obstack_alloc(obst, n * sizeof(res[0])); + reg_node_map_t *res = OALLOCN(obst, reg_node_map_t, n); foreach_pmap(reg_map, ent) { res[i].reg = ent->key; @@ -1353,10 +1353,10 @@ static ir_node *create_barrier(be_abi_irg_t *env, ir_node *bl, ir_node **mem, pm obstack_free(&env->obst, in); for (n = 0; n < n_regs; ++n) { - ir_node *pred = rm[n].irn; - const arch_register_t *reg = rm[n].reg; - arch_register_type_t add_type = 0; - ir_node *proj; + ir_node *pred = rm[n].irn; + const arch_register_t *reg = rm[n].reg; + arch_register_type_t add_type = 0; + ir_node *proj; /* stupid workaround for now... as not all nodes report register * requirements. */ @@ -1410,7 +1410,7 @@ static ir_node *create_be_return(be_abi_irg_t *env, ir_node *irn, ir_node *bl, ir_node **in; ir_node *stack; const arch_register_t **regs; - pmap_entry *ent ; + pmap_entry *ent; /* get the valid stack node in this block. @@ -1453,8 +1453,8 @@ static ir_node *create_be_return(be_abi_irg_t *env, ir_node *irn, ir_node *bl, */ in_max = pmap_count(reg_map) + n_res + 2; - in = obstack_alloc(&env->obst, in_max * sizeof(in[0])); - regs = obstack_alloc(&env->obst, in_max * sizeof(regs[0])); + in = OALLOCN(&env->obst, ir_node*, in_max); + regs = OALLOCN(&env->obst, arch_register_t const*, in_max); in[0] = mem; in[1] = be_abi_reg_map_get(reg_map, arch_env->sp); @@ -1836,6 +1836,7 @@ static void modify_irg(be_abi_irg_t *env) int n_params; int i, n; unsigned j; + unsigned frame_size; reg_node_map_t *rm; const arch_register_t *fp_reg; @@ -1888,12 +1889,16 @@ static void modify_irg(be_abi_irg_t *env) /* fix the frame type layout again */ set_type_state(ctx.frame_tp, layout_fixed); + /* align stackframe to 4 byte */ + frame_size = get_type_size_bytes(ctx.frame_tp); + if (frame_size % 4 != 0) { + set_type_size_bytes(ctx.frame_tp, frame_size + 4 - (frame_size % 4)); + } env->regs = pmap_create(); n_params = get_method_n_params(method_type); - args = obstack_alloc(&env->obst, n_params * sizeof(args[0])); - memset(args, 0, n_params * sizeof(args[0])); + args = OALLOCNZ(&env->obst, ir_node*, n_params); /* * for inner function we must now fix access to outer frame entities. @@ -2314,8 +2319,7 @@ be_abi_irg_t *be_abi_introduce(be_irg_t *birg) env->dce_survivor = new_survive_dce(); env->birg = birg; - sp_req = obstack_alloc(&env->obst, sizeof(*sp_req)); - memset(sp_req, 0, sizeof(*sp_req)); + sp_req = OALLOCZ(&env->obst, arch_register_req_t); env->sp_req = sp_req; sp_req->type = arch_register_req_type_limited