+ be_stack_attr_t *a;
+ ir_node *irn;
+ ir_node *in[1];
+
+ in[0] = old_sp;
+ irn = new_ir_node(NULL, irg, bl, op_IncSP, sp->reg_class->mode, 1, in);
+ a = init_node_attr(irn, sp->reg_class, irg, 1);
+ a->dir = dir;
+ a->offset = offset;
+
+ a->node_attr.flags |= arch_irn_flags_ignore;
+
+ /* Set output constraint to stack register. */
+ be_set_constr_single_reg(irn, -1, sp);
+ be_node_set_irn_reg(NULL, irn, sp);
+
+ return irn;
+}
+
+ir_node *be_new_AddSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *op)
+{
+ be_node_attr_t *a;
+ ir_node *irn;
+ ir_node *in[2];
+
+ in[0] = old_sp;
+ in[1] = op;
+ irn = new_ir_node(NULL, irg, bl, op_AddSP, sp->reg_class->mode, 2, in);
+ a = init_node_attr(irn, sp->reg_class, irg, 1);
+ a->flags |= arch_irn_flags_ignore;
+
+ /* Set output constraint to stack register. */
+ be_set_constr_single_reg(irn, -1, sp);
+ be_node_set_irn_reg(NULL, irn, sp);
+
+ return irn;
+}
+
+ir_node *be_new_NoReg(const arch_register_t *reg, ir_graph *irg, ir_node *bl)
+{
+ be_node_attr_t *a;
+ ir_node *irn;
+ ir_node *in[1];
+
+ irn = new_ir_node(NULL, irg, bl, op_NoReg, reg->reg_class->mode, 0, in);
+ a = init_node_attr(irn, reg->reg_class, irg, 1);
+ a->flags |= arch_irn_flags_ignore;
+ be_set_constr_single_reg(irn, -1, reg);
+ be_node_set_irn_reg(NULL, irn, reg);
+ return irn;
+}
+
+ir_node *be_new_StackParam(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_mode *mode, ir_node *frame_pointer, unsigned offset)
+{
+ be_stack_attr_t *a;
+ ir_node *irn;
+ ir_node *in[1];
+
+ in[0] = frame_pointer;
+ irn = new_ir_node(NULL, irg, bl, op_StackParam, mode, 1, in);
+ a = init_node_attr(irn, cls, irg, 1);
+ a->offset = offset;
+ return irn;
+}
+
+ir_node *be_new_RegParams(ir_graph *irg, ir_node *bl, int n_outs)
+{
+ ir_node *irn;
+ ir_node *in[1];
+
+ irn = new_ir_node(NULL, irg, bl, op_RegParams, mode_T, 0, in);
+ init_node_attr(irn, NULL, irg, n_outs);
+ return irn;
+}
+
+int be_is_Spill (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_Spill ; }
+int be_is_Reload (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_Reload ; }
+int be_is_Copy (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_Copy ; }
+int be_is_Perm (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_Perm ; }
+int be_is_Keep (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_Keep ; }
+int be_is_Call (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_Call ; }
+int be_is_IncSP (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_IncSP ; }
+int be_is_AddSP (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_AddSP ; }
+int be_is_RegParams (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_RegParams ; }
+int be_is_StackParam (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_StackParam ; }
+int be_is_NoReg (const ir_node *irn) { return get_irn_be_opcode(irn) == beo_NoReg ; }
+
+static void be_limited(void *data, bitset_t *bs)
+{
+ be_req_t *req = data;
+
+ switch(req->kind) {
+ case be_req_kind_negate_old_limited:
+ case be_req_kind_old_limited:
+ req->x.old_limited.old_limited(req->x.old_limited.old_limited_env, bs);
+ if(req->kind == be_req_kind_negate_old_limited)
+ bitset_flip_all(bs);
+ break;
+ case be_req_kind_single_reg:
+ bitset_clear_all(bs);
+ bitset_set(bs, req->x.single_reg->index);
+ break;
+ }
+}
+
+void be_set_constr_single_reg(ir_node *irn, int pos, const arch_register_t *reg)
+{
+ int idx = pos < 0 ? -(pos - 1) : pos;
+ be_node_attr_t *a = get_irn_attr(irn);
+ be_reg_data_t *rd = &a->reg_data[idx];
+ be_req_t *r = pos < 0 ? &rd->req : &rd->in_req;
+
+ assert(is_be_node(irn));
+ assert(!(pos >= 0) || pos < get_irn_arity(irn));
+ assert(!(pos < 0) || -(pos + 1) <= a->max_reg_data);
+
+ r->kind = be_req_kind_single_reg;
+ r->x.single_reg = reg;
+ r->req.limited = be_limited;
+ r->req.limited_env = r;
+ r->req.type = arch_register_req_type_limited;
+ r->req.cls = reg->reg_class;
+}
+
+void be_set_constr_limited(ir_node *irn, int pos, const arch_register_req_t *req)
+{
+ int idx = pos < 0 ? -(pos - 1) : pos;
+ be_node_attr_t *a = get_irn_attr(irn);
+ be_reg_data_t *rd = &a->reg_data[idx];
+ be_req_t *r = pos < 0 ? &rd->req : &rd->in_req;
+
+ assert(is_be_node(irn));
+ assert(!(pos >= 0) || pos < get_irn_arity(irn));
+ assert(!(pos < 0) || -(pos + 1) <= a->max_reg_data);
+ assert(arch_register_req_is(req, limited));
+
+ r->kind = be_req_kind_old_limited;
+ r->req.limited = be_limited;
+ r->req.limited_env = r;
+ r->req.type = arch_register_req_type_limited;
+ r->req.cls = req->cls;
+
+ r->x.old_limited.old_limited = req->limited;
+ r->x.old_limited.old_limited_env = req->limited_env;
+}
+
+void be_set_IncSP_offset(ir_node *irn, unsigned offset)
+{
+ be_stack_attr_t *a = get_irn_attr(irn);
+ assert(be_is_IncSP(irn));
+ a->offset = offset;
+}
+
+unsigned be_get_IncSP_offset(ir_node *irn)
+{
+ be_stack_attr_t *a = get_irn_attr(irn);
+ assert(be_is_IncSP(irn));
+ return a->offset;
+}
+
+void be_set_IncSP_direction(ir_node *irn, be_stack_dir_t dir)
+{
+ be_stack_attr_t *a = get_irn_attr(irn);
+ assert(be_is_IncSP(irn));
+ a->dir = dir;
+}
+
+be_stack_dir_t be_get_IncSP_direction(ir_node *irn)
+{
+ be_stack_attr_t *a = get_irn_attr(irn);
+ assert(be_is_IncSP(irn));
+ return a->dir;
+}
+
+void be_set_Spill_entity(ir_node *irn, entity *ent)
+{
+ be_spill_attr_t *a = get_irn_attr(irn);
+ assert(be_is_Spill(irn));
+ a->ent = ent;
+}