Use backtracking in find_original_value() for the flags emitter.
[libfirm] / ir / be / benode.c
index 91d021b..dc215ac 100644 (file)
@@ -439,17 +439,18 @@ ir_node *be_new_Perm(const arch_register_class_t *cls, ir_graph *irg, ir_node *b
 
 void be_Perm_reduce(ir_node *perm, int new_size, int *map)
 {
-       ir_graph *irg           = get_irn_irg(perm);
-       int            arity    = get_irn_arity(perm);
-       be_reg_data_t *old_data = alloca(arity * sizeof(old_data[0]));
-       be_node_attr_t *attr    = get_irn_attr(perm);
-       ir_node **new_in        = NEW_ARR_D(ir_node *, irg->obst, new_size);
+       int            arity     = get_irn_arity(perm);
+       be_reg_data_t  *old_data = alloca(arity * sizeof(old_data[0]));
+       be_node_attr_t *attr     = get_irn_attr(perm);
+       ir_node        **new_in;
 
        int i;
 
        assert(be_is_Perm(perm));
        assert(new_size <= arity);
 
+       NEW_ARR_A(ir_node *, new_in, new_size);
+
        /* save the old register data */
        memcpy(old_data, attr->reg_data, arity * sizeof(old_data[0]));
 
@@ -469,7 +470,7 @@ ir_node *be_new_MemPerm(const arch_env_t *arch_env, ir_graph *irg, ir_node *bl,
        ir_node *frame = get_irg_frame(irg);
        const arch_register_class_t *cls_frame = arch_get_irn_reg_class(arch_env, frame, -1);
        ir_node *irn;
-       const arch_register_t *sp = arch_env->isa->sp;
+       const arch_register_t *sp = arch_env->sp;
        be_memperm_attr_t *attr;
        ir_node **real_in;
 
@@ -699,7 +700,7 @@ ir_node *be_new_AddSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_
        be_node_attr_t *a;
        ir_node *irn;
        ir_node *in[be_pos_AddSP_last];
-       const arch_register_class_t *class;
+       const arch_register_class_t *cls;
 
        in[be_pos_AddSP_old_sp] = old_sp;
        in[be_pos_AddSP_size]   = sz;
@@ -716,8 +717,8 @@ ir_node *be_new_AddSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_
        be_set_constr_single_reg(irn, OUT_POS(pn_be_AddSP_sp), sp);
        a->reg_data[pn_be_AddSP_sp].reg = sp;
 
-       class = arch_register_get_class(sp);
-       be_node_set_reg_class(irn, OUT_POS(pn_be_AddSP_res), class);
+       cls = arch_register_get_class(sp);
+       be_node_set_reg_class(irn, OUT_POS(pn_be_AddSP_res), cls);
 
        return irn;
 }
@@ -984,7 +985,7 @@ void be_set_constr_limited(ir_node *node, int pos, const arch_register_req_t *re
        arch_register_req_t *r = get_req(node, pos);
 
        assert(arch_register_req_is(req, limited));
-       assert(! (req->type & (arch_register_req_type_should_be_same | arch_register_req_type_should_be_different)));
+       assert(!(req->type & (arch_register_req_type_should_be_same | arch_register_req_type_must_be_different)));
        memcpy(r, req, sizeof(r[0]));
        r->limited = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
 }
@@ -1454,7 +1455,7 @@ static const arch_irn_ops_t phi_irn_ops = {
 
 void be_phi_handler_new(be_main_env_t *env)
 {
-       phi_handler.arch_env  = &env->arch_env;
+       phi_handler.arch_env  = env->arch_env;
        phi_handler.phi_attrs = pmap_create();
        op_Phi->ops.be_ops    = &phi_irn_ops;
 }
@@ -1678,6 +1679,10 @@ static void copy_attr(const ir_node *old_node, ir_node *new_node)
 }
 
 static const ir_op_ops be_node_op_ops = {
+       firm_default_hash,
+       NULL,
+       NULL,
+       NULL,
        NULL,
        NULL,
        NULL,