2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief A data structure to treat nodes and node-proj collections uniformly.
9 * @author Sebastian Hack
13 #include "irgraph_t.h"
18 #include "bechordal_t.h"
22 #include "raw_bitset.h"
24 be_insn_t *be_scan_insn(be_chordal_env_t *const env, ir_node *const irn)
26 struct obstack *const obst = &env->obst;
29 be_insn_t *insn = OALLOCZ(obst, be_insn_t);
31 bool has_constraints = false;
33 const arch_register_class_t *cls = env->cls;
35 be_foreach_definition(irn, cls, p, req,
36 /* found a def: create a new operand */
37 if (arch_register_req_is(req, limited)) {
38 o.regs = req->limited;
39 has_constraints = true;
41 o.regs = env->allocatable_regs->data;
42 has_constraints |= req->width > 1;
46 obstack_grow(obst, &o, sizeof(o));
50 insn->use_start = insn->n_ops;
52 /* now collect the uses for this node */
53 be_foreach_use(irn, cls, in_req, op, op_req,
54 /* found a register use, create an operand */
55 if (arch_register_req_is(in_req, limited)) {
56 o.regs = in_req->limited;
57 has_constraints = true;
59 o.regs = env->allocatable_regs->data;
63 obstack_grow(obst, &o, sizeof(o));
70 insn->ops = (be_operand_t*)obstack_finish(obst);