node_kind_reload,
node_kind_perm,
node_kind_copy,
+ node_kind_kill,
node_kind_last
} node_kind_t;
in the spill area. */
} be_spill_attr_t;
+
+ir_node *new_Keep(ir_graph *irg, ir_node *bl, int n, ir_node *in[])
+{
+ static ir_op *keep_op = NULL;
+ ir_node *irn;
+
+ if(!keep_op)
+ keep_op = new_ir_op(get_next_ir_opcode(), "Keep", op_pin_state_pinned,
+ irop_flag_keep, oparity_variable, 0, 0, NULL);
+
+ irn = new_ir_node(NULL, irg, bl, keep_op, mode_ANY, n, in);
+ keep_alive(irn);
+
+ return irn;
+}
+
static int templ_pos_Spill[] = {
0
};
0, -1
};
+static int templ_pos_Kill[] = {
+ 0
+};
+
static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason);
static const ir_op_ops be_node_ops = {
for(i = 0; i < n_regs; ++i) {
be_reg_data_t *rd = attr->reg_data + i;
- rd->reg = NULL;
- rd->req.cls = cls;
- rd->req.type = arch_register_req_type_normal;
+ memset(&rd->req, 0, sizeof(rd->req));
+ rd->reg = NULL;
+ rd->req.cls = cls;
+ rd->req.type = arch_register_req_type_normal;
}
return attr;
HASH_PTR(cls) + 7 * kind);
}
+
+
ir_node *new_Spill(const be_node_factory_t *factory,
const arch_register_class_t *cls,
ir_graph *irg, ir_node *bl, ir_node *node_to_spill, ir_node *ctx)
ir_node *bl = get_nodes_block(irn);
ir_graph *irg = get_irn_irg(bl);
- assert(is_Spill(spill)
+ assert(be_is_Spill(spill)
|| (is_Phi(spill) && get_irn_mode(spill) == mode_M));
reload = new_Reload(factory, cls, irg, bl, mode, spill);
return reload;
}
-static INLINE arch_register_req_t *get_Perm_reqs(ir_node *perm)
-{
- be_node_attr_t *attr = (be_node_attr_t *) &perm->attr;
- char *ptr = (char *) &perm->attr;
-
- ptr += sizeof(be_node_attr_t);
- ptr += sizeof(arch_register_t *) * attr->n_regs;
-
- return (arch_register_req_t *) ptr;
-}
-
/**
* If the node is a proj, reset the node to the proj's target and return
* the proj number.
be_node_get_irn_reg_req(const arch_irn_ops_t *_self,
arch_register_req_t *req, const ir_node *irn, int pos)
{
- be_op_t *bo;
- const be_node_factory_t *factory =
- container_of(_self, const be_node_factory_t, irn_ops);
-
/* We cannot get output requirements for tuple nodes. */
if(get_irn_mode(irn) == mode_T && pos < 0)
return NULL;
if(pos < 0)
pos = redir_proj((const ir_node **) &irn, pos);
- /* look if the node is one of ours. */
- bo = pmap_get(factory->irn_op_map, get_irn_op(irn));
-
- if(bo) {
+ if(is_be_node(irn)) {
+ const be_node_attr_t *a = (const be_node_attr_t *) &irn->attr;
+ const be_op_t *bo = a->op;
int i;
for(i = 0; i < bo->n_pos; ++i) {
/* be nodes have no input constraints.
so return normal register requirements. */
if(pos >= 0) {
+ memset(req, 0, sizeof(req[0]));
req->cls = bo->cls;
req->type = arch_register_req_type_normal;
}
* if an output requirement is requested,
* return the one stored in the node.
*/
- else {
- be_node_attr_t *attr = (be_node_attr_t *) &irn->attr;
- *req = attr->reg_data[pos].req;
- }
+ else
+ *req = a->reg_data[-pos - 1].req;
return req;
}
void be_set_Perm_out_req(ir_node *irn, int pos, const arch_register_req_t *req)
{
be_node_attr_t *a = get_attr_and_check(irn, node_kind_perm);
-
assert(pos >= 0 && pos < get_irn_arity(irn) && "position out of range");
- assert(a->op->kind == node_kind_perm && "node must be a perm node");
-
a->reg_data[pos].req = *req;
}
return &f->handler;
}
-int is_Spill(const ir_node *irn)
+int be_is_Spill(const ir_node *irn)
{
return is_be_kind(irn, node_kind_spill);
}
-int is_Perm(const ir_node *irn)
+int be_is_Reload(const ir_node *irn)
+{
+ return is_be_kind(irn, node_kind_reload);
+}
+
+int be_is_Copy(const ir_node *irn)
+{
+ return is_be_kind(irn, node_kind_copy);
+}
+
+int be_is_Perm(const ir_node *irn)
{
return is_be_kind(irn, node_kind_perm);
}
+
be_node_factory_t *be_node_factory_init(be_node_factory_t *factory, const arch_isa_t *isa)
{
int i, j, n;
if(bo->kind == node_kind_spill) {
be_spill_attr_t *a = (be_spill_attr_t *) at;
ir_fprintf(f, "spill context: %+F\n", a->spill_ctx);
+ ir_fprintf(f, "spill offset: %u\n", a->offset);
}
break;
}
ir_node *bl = is_Block(pos) ? pos : get_nodes_block(pos);
ir_graph *irg = get_irn_irg(bl);
pset *live = pset_new_ptr_default();
- firm_dbg_module_t *dbg = firm_dbg_register("firm.be.node");
+ firm_dbg_module_t *dbg = firm_dbg_register("be.node");
irn_live_t *li;
ir_node *curr, *irn, *perm, **nodes;
int i, n;
- firm_dbg_set_mask(dbg, DBG_LEVEL);
DBG((dbg, LEVEL_1, "Insert Perm after: %+F\n", pos));