#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"
/* 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);
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);
}
}
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);
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;
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. */
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.
*/
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);
int n_params;
int i, n;
unsigned j;
+ unsigned frame_size;
reg_node_map_t *rm;
const arch_register_t *fp_reg;
/* 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.
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