X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeinsn.c;h=4eee0429573ad920c547e3c90da9c2ff23d9ad6e;hb=b6d85190f667fe9f06e69d9cf3a3c8e004f1350b;hp=b8bc71cbb2a6da6cf39ff0ee948f0c1b8c87ffe1;hpb=d2c1b0191844c3c23731158a153838d570dcd65a;p=libfirm diff --git a/ir/be/beinsn.c b/ir/be/beinsn.c index b8bc71cbb..4eee04295 100644 --- a/ir/be/beinsn.c +++ b/ir/be/beinsn.c @@ -43,7 +43,8 @@ * @param insn the be_insn that is build * @param mach_op the machine operand for which uses are added */ -static void add_machine_operands(const be_insn_env_t *env, be_insn_t *insn, ir_node *mach_op) { +static void add_machine_operands(const be_insn_env_t *env, be_insn_t *insn, ir_node *mach_op) +{ struct obstack *obst = env->obst; int i, n; @@ -85,8 +86,7 @@ be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn) int i, n; int pre_colored = 0; - insn = obstack_alloc(obst, sizeof(insn[0])); - memset(insn, 0, sizeof(insn[0])); + insn = OALLOCZ(obst, be_insn_t); insn->irn = irn; insn->next_insn = sched_next(irn); @@ -158,7 +158,7 @@ be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn) } insn->has_constraints = insn->in_constraints | insn->out_constraints; - insn->ops = obstack_finish(obst); + insn->ops = (be_operand_t*)obstack_finish(obst); /* Compute the admissible registers bitsets. */ for (i = 0; i < insn->n_ops; ++i) { @@ -175,28 +175,14 @@ be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn) assert(cls == env->cls); - op->regs = bitset_obstack_alloc(obst, env->cls->n_regs); - if (type & arch_register_req_type_limited) { - rbitset_copy_to_bitset(req->limited, op->regs); + bitset_t *regs = bitset_obstack_alloc(obst, env->cls->n_regs); + rbitset_copy_to_bitset(req->limited, regs); + op->regs = regs; } else { - arch_put_non_ignore_regs(env->cls, op->regs); - if (env->ignore_colors) - bitset_andnot(op->regs, env->ignore_colors); + op->regs = env->allocatable_regs; } } return insn; } - -be_insn_env_t *be_insn_env_init(be_insn_env_t *ie, const be_irg_t *birg, - const arch_register_class_t *cls, - struct obstack *obst) -{ - ie->cls = cls; - ie->obst = obst; - ie->ignore_colors = bitset_obstack_alloc(obst, cls->n_regs); - be_abi_put_ignore_regs(birg->abi, cls, ie->ignore_colors); - - return ie; -}