On Mon, Feb 25, 2013 at 10:48 AM, Eric Botcazou wrote:
>> It seems to me that a REG_UNUSED note on a CLOBBER is unnecessary, and
>> it also goes against the documented purpose of a REG_UNUSED note in
>> reg-notes.def:
>>
>> /* Identifies a register set in this insn and never used. */
>> REG_NOTE (UNUSED)
>>
>> After all, a CLOBBER is not a register set, so I think a patch like
>> the one below is necessary.
>>
>> Thoughts?
>
> This looks more like a small oversight in the DF implementation than a real
> design decision, so I'd go ahead with your patch.
That's what I believe, too. Still, combine appears to add REG_UNUSED
notes for clobbers intentionally. Do you know why it does that?
Ciao!
Steven
/* Like recog, but we receive the address of a pointer to a new pattern.
...
Modifications include deletion or addition of CLOBBERs.
PNOTES is a pointer to a location where any REG_UNUSED notes added for
the CLOBBERs are placed.
... */
static int
recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes)
{
...
/* If we had any clobbers to add, make a new pattern than contains
them. Then check to make sure that all of them are dead. */
if (num_clobbers_to_add)
{
rtx newpat = gen_rtx_PARALLEL (VOIDmode,
rtvec_alloc (GET_CODE (pat) == PARALLEL
? (XVECLEN (pat, 0)
+ num_clobbers_to_add)
: num_clobbers_to_add + 1));
if (GET_CODE (pat) == PARALLEL)
for (i = 0; i < XVECLEN (pat, 0); i++)
XVECEXP (newpat, 0, i) = XVECEXP (pat, 0, i);
else
XVECEXP (newpat, 0, 0) = pat;
add_clobbers (newpat, insn_code_number);
for (i = XVECLEN (newpat, 0) - num_clobbers_to_add;
i < XVECLEN (newpat, 0); i++)
{
if (REG_P (XEXP (XVECEXP (newpat, 0, i), 0))
&& ! reg_dead_at_p (XEXP (XVECEXP (newpat, 0, i), 0), insn))
return -1;
if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) != SCRATCH)
{
gcc_assert (REG_P (XEXP (XVECEXP (newpat, 0, i), 0)));
notes = alloc_reg_note (REG_UNUSED,
XEXP (XVECEXP (newpat, 0, i), 0), notes);
}
}
pat = newpat;
}