From: Matthias Braun Date: Sun, 30 Sep 2012 15:23:56 +0000 (+0200) Subject: fix some missing register constraints X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=caad9fd6b4d7f38b0aee644b61eaf20705a2bfd7;p=libfirm fix some missing register constraints --- diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 376c2d0d8..5b3007dad 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -569,13 +569,15 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) throws_exception = ir_throws_exception(irn); if (env->call->flags.bits.call_has_imm && is_SymConst(call_ptr)) { /* direct call */ - low_call = be_new_Call(dbgi, irg, bl, curr_mem, curr_sp, curr_sp, + low_call = be_new_Call(dbgi, irg, bl, curr_mem, sp->single_req, curr_sp, + sp->single_req, curr_sp, n_reg_results + pn_be_Call_first_res + ARR_LEN(destroyed_regs), n_ins, in, get_Call_type(irn)); be_Call_set_entity(low_call, get_SymConst_entity(call_ptr)); } else { /* indirect call */ - low_call = be_new_Call(dbgi, irg, bl, curr_mem, curr_sp, call_ptr, + low_call = be_new_Call(dbgi, irg, bl, curr_mem, sp->single_req, curr_sp, + call->cls_addr->class_req, call_ptr, n_reg_results + pn_be_Call_first_res + ARR_LEN(destroyed_regs), n_ins, in, get_Call_type(irn)); } @@ -630,12 +632,6 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) } } - /* - Set the register class of the call address to - the backend provided class (default: stack pointer class) - */ - be_node_set_reg_class_in(low_call, n_be_Call_ptr, call->cls_addr); - DBG((dbg, LEVEL_3, "\tcreated backend call %+F\n", low_call)); /* Set the register classes and constraints of the Call parameters. */ diff --git a/ir/be/benode.c b/ir/be/benode.c index 6139c3487..26124963c 100644 --- a/ir/be/benode.c +++ b/ir/be/benode.c @@ -48,6 +48,8 @@ #include "irprintf.h" #include "irgwalk.h" #include "iropt_t.h" +#include "irbackedge_t.h" +#include "irverify_t.h" #include "be_t.h" #include "belive_t.h" @@ -478,8 +480,9 @@ void be_Keep_add_node(ir_node *keep, const arch_register_class_t *cls, ir_node * } ir_node *be_new_Call(dbg_info *dbg, ir_graph *irg, ir_node *bl, ir_node *mem, - ir_node *sp, ir_node *ptr, int n_outs, int n, ir_node *in[], - ir_type *call_tp) + const arch_register_req_t *sp_req, ir_node *sp, + const arch_register_req_t *ptr_req, ir_node *ptr, + int n_outs, int n, ir_node *in[], ir_type *call_tp) { be_call_attr_t *a; int real_n = n_be_Call_first_arg + n; @@ -499,6 +502,8 @@ ir_node *be_new_Call(dbg_info *dbg, ir_graph *irg, ir_node *bl, ir_node *mem, a->call_tp = call_tp; a->pop = 0; a->base.exc.pin_state = op_pin_state_pinned; + be_set_constr_in(irn, n_be_Call_sp, sp_req); + be_set_constr_in(irn, n_be_Call_ptr, ptr_req); return irn; } @@ -1065,7 +1070,8 @@ ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode, backend_info_t *info; int i; - ir_node *phi = new_r_Phi(block, n_ins, ins, mode); + ir_node *phi = new_ir_node(NULL, irg, block, op_Phi, mode, n_ins, ins); + phi->attr.phi.u.backedge = new_backedge_arr(irg->obst, n_ins); info = be_get_info(phi); info->out_infos = NEW_ARR_D(reg_out_info_t, obst, 1); memset(info->out_infos, 0, 1 * sizeof(info->out_infos[0])); @@ -1075,7 +1081,8 @@ ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode, for (i = 0; i < n_ins; ++i) { info->in_reqs[i] = req; } - + irn_verify_irg(phi, irg); + phi = optimize_node(phi); return phi; } diff --git a/ir/be/benode.h b/ir/be/benode.h index 65ff3357f..1acb42287 100644 --- a/ir/be/benode.h +++ b/ir/be/benode.h @@ -308,8 +308,9 @@ typedef enum { * @param call_tp the call type of this call */ ir_node *be_new_Call(dbg_info *dbg, ir_graph *irg, ir_node *block, ir_node *mem, - ir_node *sp, ir_node *ptr, int n_outs, - int n, ir_node *in[], ir_type *call_tp); + const arch_register_req_t *sp_req, ir_node *sp, + const arch_register_req_t *ptr_req, ir_node *ptr, + int n_outs, int n, ir_node *in[], ir_type *call_tp); /** * Position numbers for the be_Return inputs.