Commit 7543f918 by Joern Rennecke Committed by Joern Rennecke

re PR middle-end/40154 (internal compiler error: in do_SUBST, at combine.c:681)

        PR middle-end/40154
        * emit-rtl.c (set_dst_reg_note): New function.
        * rtl.h (set_dst_reg_note): Declare.
        * optabs.c (expand_binop, expand_absneg_bit): Use set_dst_reg_note.
        (emit_libcall_block, expand_fix): Likewise.
        * function.c (assign_parm_setup_reg, expand_function_start): Likewise.
        * expmed.c (expand_mult_const, expand_divmod): Likewise.
        * reload1.c (gen_reload): Likewise.

From-SVN: r182162
parent fb550348
2011-12-09 Joern Rennecke <joern.rennecke@embecosm.com>
PR middle-end/40154
* emit-rtl.c (set_dst_reg_note): New function.
* rtl.h (set_dst_reg_note): Declare.
* optabs.c (expand_binop, expand_absneg_bit): Use set_dst_reg_note.
(emit_libcall_block, expand_fix): Likewise.
* function.c (assign_parm_setup_reg, expand_function_start): Likewise.
* expmed.c (expand_mult_const, expand_divmod): Likewise.
* reload1.c (gen_reload): Likewise.
2011-12-09 Kai Tietz <ktietz@redhat.com> 2011-12-09 Kai Tietz <ktietz@redhat.com>
* ira-color.c (print_hard_regs_subforest): Use * ira-color.c (print_hard_regs_subforest): Use
...@@ -5005,6 +5005,17 @@ set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum) ...@@ -5005,6 +5005,17 @@ set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
return REG_NOTES (insn); return REG_NOTES (insn);
} }
/* Like set_unique_reg_note, but don't do anything unless INSN sets DST. */
rtx
set_dst_reg_note (rtx insn, enum reg_note kind, rtx datum, rtx dst)
{
rtx set = single_set (insn);
if (set && SET_DEST (set) == dst)
return set_unique_reg_note (insn, kind, datum);
return NULL_RTX;
}
/* Return an indication of which type of insn should have X as a body. /* Return an indication of which type of insn should have X as a body.
The value is CODE_LABEL, INSN, CALL_INSN or JUMP_INSN. */ The value is CODE_LABEL, INSN, CALL_INSN or JUMP_INSN. */
......
...@@ -2939,6 +2939,7 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val, ...@@ -2939,6 +2939,7 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val,
&& !optimize) && !optimize)
? target : 0; ? target : 0;
rtx accum_target = optimize ? 0 : accum; rtx accum_target = optimize ? 0 : accum;
rtx accum_inner;
switch (alg->op[opno]) switch (alg->op[opno])
{ {
...@@ -3004,16 +3005,18 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val, ...@@ -3004,16 +3005,18 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val,
that. */ that. */
tem = op0, nmode = mode; tem = op0, nmode = mode;
accum_inner = accum;
if (GET_CODE (accum) == SUBREG) if (GET_CODE (accum) == SUBREG)
{ {
nmode = GET_MODE (SUBREG_REG (accum)); accum_inner = SUBREG_REG (accum);
nmode = GET_MODE (accum_inner);
tem = gen_lowpart (nmode, op0); tem = gen_lowpart (nmode, op0);
} }
insn = get_last_insn (); insn = get_last_insn ();
set_unique_reg_note (insn, REG_EQUAL, set_dst_reg_note (insn, REG_EQUAL,
gen_rtx_MULT (nmode, tem, gen_rtx_MULT (nmode, tem, GEN_INT (val_so_far)),
GEN_INT (val_so_far))); accum_inner);
} }
if (variant == negate_variant) if (variant == negate_variant)
...@@ -3823,7 +3826,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, ...@@ -3823,7 +3826,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
rtx quotient = 0, remainder = 0; rtx quotient = 0, remainder = 0;
rtx last; rtx last;
int size; int size;
rtx insn, set; rtx insn;
optab optab1, optab2; optab optab1, optab2;
int op1_is_constant, op1_is_pow2 = 0; int op1_is_constant, op1_is_pow2 = 0;
int max_cost, extra_cost; int max_cost, extra_cost;
...@@ -4127,12 +4130,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, ...@@ -4127,12 +4130,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
break; break;
insn = get_last_insn (); insn = get_last_insn ();
if (insn != last if (insn != last)
&& (set = single_set (insn)) != 0 set_dst_reg_note (insn, REG_EQUAL,
&& SET_DEST (set) == quotient) gen_rtx_UDIV (compute_mode, op0, op1),
set_unique_reg_note (insn, quotient);
REG_EQUAL,
gen_rtx_UDIV (compute_mode, op0, op1));
} }
else /* TRUNC_DIV, signed */ else /* TRUNC_DIV, signed */
{ {
...@@ -4211,18 +4212,15 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, ...@@ -4211,18 +4212,15 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
{ {
insn = get_last_insn (); insn = get_last_insn ();
if (insn != last if (insn != last
&& (set = single_set (insn)) != 0
&& SET_DEST (set) == quotient
&& abs_d < ((unsigned HOST_WIDE_INT) 1 && abs_d < ((unsigned HOST_WIDE_INT) 1
<< (HOST_BITS_PER_WIDE_INT - 1))) << (HOST_BITS_PER_WIDE_INT - 1)))
set_unique_reg_note (insn, set_dst_reg_note (insn, REG_EQUAL,
REG_EQUAL, gen_rtx_DIV (compute_mode, op0,
gen_rtx_DIV (compute_mode,
op0,
GEN_INT GEN_INT
(trunc_int_for_mode (trunc_int_for_mode
(abs_d, (abs_d,
compute_mode)))); compute_mode))),
quotient);
quotient = expand_unop (compute_mode, neg_optab, quotient = expand_unop (compute_mode, neg_optab,
quotient, quotient, 0); quotient, quotient, 0);
...@@ -4309,12 +4307,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, ...@@ -4309,12 +4307,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
break; break;
insn = get_last_insn (); insn = get_last_insn ();
if (insn != last if (insn != last)
&& (set = single_set (insn)) != 0 set_dst_reg_note (insn, REG_EQUAL,
&& SET_DEST (set) == quotient) gen_rtx_DIV (compute_mode, op0, op1),
set_unique_reg_note (insn, quotient);
REG_EQUAL,
gen_rtx_DIV (compute_mode, op0, op1));
} }
break; break;
} }
...@@ -4732,11 +4728,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, ...@@ -4732,11 +4728,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
NULL_RTX, 1); NULL_RTX, 1);
insn = get_last_insn (); insn = get_last_insn ();
set_unique_reg_note (insn, set_dst_reg_note (insn, REG_EQUAL,
REG_EQUAL,
gen_rtx_fmt_ee (unsignedp ? UDIV : DIV, gen_rtx_fmt_ee (unsignedp ? UDIV : DIV,
compute_mode, compute_mode, op0, op1),
op0, op1)); quotient);
} }
break; break;
......
...@@ -3140,9 +3140,8 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm, ...@@ -3140,9 +3140,8 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
set_unique_reg_note (sinsn, REG_EQUIV, stackr); set_unique_reg_note (sinsn, REG_EQUIV, stackr);
} }
} }
else if ((set = single_set (linsn)) != 0 else
&& SET_DEST (set) == parmreg) set_dst_reg_note (linsn, REG_EQUIV, equiv_stack_parm, parmreg);
set_unique_reg_note (linsn, REG_EQUIV, equiv_stack_parm);
} }
/* For pointer data type, suggest pointer register. */ /* For pointer data type, suggest pointer register. */
...@@ -4757,7 +4756,7 @@ expand_function_start (tree subr) ...@@ -4757,7 +4756,7 @@ expand_function_start (tree subr)
/* Mark the register as eliminable, similar to parameters. */ /* Mark the register as eliminable, similar to parameters. */
if (MEM_P (chain) if (MEM_P (chain)
&& reg_mentioned_p (arg_pointer_rtx, XEXP (chain, 0))) && reg_mentioned_p (arg_pointer_rtx, XEXP (chain, 0)))
set_unique_reg_note (insn, REG_EQUIV, chain); set_dst_reg_note (insn, REG_EQUIV, chain, local);
} }
/* If the function receives a non-local goto, then store the /* If the function receives a non-local goto, then store the
......
...@@ -2052,11 +2052,11 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1, ...@@ -2052,11 +2052,11 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
{ {
rtx temp = emit_move_insn (target, xtarget); rtx temp = emit_move_insn (target, xtarget);
set_unique_reg_note (temp, set_dst_reg_note (temp, REG_EQUAL,
REG_EQUAL,
gen_rtx_fmt_ee (binoptab->code, mode, gen_rtx_fmt_ee (binoptab->code, mode,
copy_rtx (xop0), copy_rtx (xop0),
copy_rtx (xop1))); copy_rtx (xop1)),
target);
} }
else else
target = xtarget; target = xtarget;
...@@ -2104,11 +2104,12 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1, ...@@ -2104,11 +2104,12 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
if (optab_handler (mov_optab, mode) != CODE_FOR_nothing) if (optab_handler (mov_optab, mode) != CODE_FOR_nothing)
{ {
temp = emit_move_insn (target ? target : product, product); temp = emit_move_insn (target ? target : product, product);
set_unique_reg_note (temp, set_dst_reg_note (temp,
REG_EQUAL, REG_EQUAL,
gen_rtx_fmt_ee (MULT, mode, gen_rtx_fmt_ee (MULT, mode,
copy_rtx (op0), copy_rtx (op0),
copy_rtx (op1))); copy_rtx (op1)),
target ? target : product);
} }
return product; return product;
} }
...@@ -2966,8 +2967,9 @@ expand_absneg_bit (enum rtx_code code, enum machine_mode mode, ...@@ -2966,8 +2967,9 @@ expand_absneg_bit (enum rtx_code code, enum machine_mode mode,
gen_lowpart (imode, target), 1, OPTAB_LIB_WIDEN); gen_lowpart (imode, target), 1, OPTAB_LIB_WIDEN);
target = lowpart_subreg_maybe_copy (mode, temp, imode); target = lowpart_subreg_maybe_copy (mode, temp, imode);
set_unique_reg_note (get_last_insn (), REG_EQUAL, set_dst_reg_note (get_last_insn (), REG_EQUAL,
gen_rtx_fmt_e (code, mode, copy_rtx (op0))); gen_rtx_fmt_e (code, mode, copy_rtx (op0)),
target);
} }
return target; return target;
...@@ -3899,8 +3901,7 @@ emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv) ...@@ -3899,8 +3901,7 @@ emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv)
} }
last = emit_move_insn (target, result); last = emit_move_insn (target, result);
if (optab_handler (mov_optab, GET_MODE (target)) != CODE_FOR_nothing) set_dst_reg_note (last, REG_EQUAL, copy_rtx (equiv), target);
set_unique_reg_note (last, REG_EQUAL, copy_rtx (equiv));
if (final_dest != target) if (final_dest != target)
emit_move_insn (final_dest, target); emit_move_insn (final_dest, target);
...@@ -5213,11 +5214,10 @@ expand_fix (rtx to, rtx from, int unsignedp) ...@@ -5213,11 +5214,10 @@ expand_fix (rtx to, rtx from, int unsignedp)
{ {
/* Make a place for a REG_NOTE and add it. */ /* Make a place for a REG_NOTE and add it. */
insn = emit_move_insn (to, to); insn = emit_move_insn (to, to);
set_unique_reg_note (insn, set_dst_reg_note (insn, REG_EQUAL,
REG_EQUAL, gen_rtx_fmt_e (UNSIGNED_FIX, GET_MODE (to),
gen_rtx_fmt_e (UNSIGNED_FIX, copy_rtx (from)),
GET_MODE (to), to);
copy_rtx (from)));
} }
return; return;
......
...@@ -8574,7 +8574,7 @@ gen_reload (rtx out, rtx in, int opnum, enum reload_type type) ...@@ -8574,7 +8574,7 @@ gen_reload (rtx out, rtx in, int opnum, enum reload_type type)
if (insn) if (insn)
{ {
/* Add a REG_EQUIV note so that find_equiv_reg can find it. */ /* Add a REG_EQUIV note so that find_equiv_reg can find it. */
set_unique_reg_note (insn, REG_EQUIV, in); set_dst_reg_note (insn, REG_EQUIV, in, out);
return insn; return insn;
} }
...@@ -8584,7 +8584,7 @@ gen_reload (rtx out, rtx in, int opnum, enum reload_type type) ...@@ -8584,7 +8584,7 @@ gen_reload (rtx out, rtx in, int opnum, enum reload_type type)
gcc_assert (!reg_overlap_mentioned_p (out, op0)); gcc_assert (!reg_overlap_mentioned_p (out, op0));
gen_reload (out, op1, opnum, type); gen_reload (out, op1, opnum, type);
insn = emit_insn (gen_add2_insn (out, op0)); insn = emit_insn (gen_add2_insn (out, op0));
set_unique_reg_note (insn, REG_EQUIV, in); set_dst_reg_note (insn, REG_EQUIV, in, out);
} }
#ifdef SECONDARY_MEMORY_NEEDED #ifdef SECONDARY_MEMORY_NEEDED
......
...@@ -1893,6 +1893,7 @@ extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int, ...@@ -1893,6 +1893,7 @@ extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
/* In emit-rtl.c */ /* In emit-rtl.c */
extern rtx set_unique_reg_note (rtx, enum reg_note, rtx); extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
extern rtx set_dst_reg_note (rtx, enum reg_note, rtx, rtx);
extern void set_insn_deleted (rtx); extern void set_insn_deleted (rtx);
/* Functions in rtlanal.c */ /* Functions in rtlanal.c */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment