Added new_Keep
authorSebastian Hack <hack@ipd.info.uni-karlsruhe.de>
Tue, 17 Jan 2006 14:20:42 +0000 (14:20 +0000)
committerSebastian Hack <hack@ipd.info.uni-karlsruhe.de>
Tue, 17 Jan 2006 14:20:42 +0000 (14:20 +0000)
ir/be/benode.c
ir/be/benode_t.h

index b1ed7e6..b8e3090 100644 (file)
@@ -46,6 +46,7 @@ typedef enum _node_kind_t {
        node_kind_reload,
        node_kind_perm,
        node_kind_copy,
+       node_kind_kill,
        node_kind_last
 } node_kind_t;
 
@@ -76,6 +77,22 @@ typedef struct {
                                                   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
 };
@@ -88,6 +105,10 @@ static int templ_pos_Copy[] = {
        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 = {
@@ -140,9 +161,10 @@ static be_node_attr_t *init_node_attr(ir_node *irn,
        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;
@@ -170,6 +192,8 @@ static be_op_t *get_op(const be_node_factory_t *fact,
                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)
@@ -397,6 +421,7 @@ be_node_get_irn_reg_req(const arch_irn_ops_t *_self,
                                /* 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;
                                }
@@ -540,6 +565,7 @@ 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;
@@ -628,6 +654,7 @@ static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
                        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;
        }
index e71d775..785b788 100644 (file)
@@ -66,11 +66,15 @@ ir_node *be_reload(
                const arch_register_class_t *cls,
                ir_node *irn, int pos, ir_mode *mode, ir_node *spill);
 
+ir_node *new_Keep(ir_graph *irg, ir_node *bl, int n, ir_node *in[]);
+
 int be_is_Spill(const ir_node *irn);
 int be_is_Reload(const ir_node *irn);
 int be_is_Copy(const ir_node *irn);
 int be_is_Perm(const ir_node *irn);
 
+const arch_register_class_t *be_node_get_reg_class(const ir_node *irn);
+
 void set_Spill_offset(ir_node *irn, unsigned offset);
 unsigned get_Spill_offset(ir_node *irn);