X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeinsn.c;h=4eee0429573ad920c547e3c90da9c2ff23d9ad6e;hb=b6d85190f667fe9f06e69d9cf3a3c8e004f1350b;hp=5efcb69a2746173a961860781dfb6e4fb616ffe8;hpb=0fbcef83aa6060534172bb13e71cdadb04428806;p=libfirm diff --git a/ir/be/beinsn.c b/ir/be/beinsn.c index 5efcb69a2..4eee04295 100644 --- a/ir/be/beinsn.c +++ b/ir/be/beinsn.c @@ -30,9 +30,9 @@ #include "irnode_t.h" #include "iredges.h" -#include "besched_t.h" +#include "besched.h" #include "beinsn_t.h" -#include "beirg_t.h" +#include "beirg.h" #include "beabi.h" #include "raw_bitset.h" @@ -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); @@ -105,7 +105,7 @@ be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn) if (arch_irn_consider_in_reg_alloc(env->cls, p)) { /* found a def: create a new operand */ - o.req = arch_get_register_req(p, -1); + o.req = arch_get_register_req_out(p); o.carrier = p; o.irn = irn; o.pos = -(get_Proj_proj(p) + 1); @@ -119,7 +119,7 @@ be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn) } } else if (arch_irn_consider_in_reg_alloc(env->cls, irn)) { /* only one def, create one operand */ - o.req = arch_get_register_req(irn, -1); + o.req = arch_get_register_req_out(irn); o.carrier = irn; o.irn = irn; o.pos = -1; @@ -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; -}