This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: supression of 'matching constraint does not allow a register' warning
- From: Daniel Jacobowitz <drow at false dot org>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 3 May 2004 12:56:53 -0400
- Subject: Re: supression of 'matching constraint does not allow a register' warning
- References: <20040430161027.83EF798C8A@baradas.org> <yf2smelige0.fsf@hawaii.kealia.com> <20040430180953.GA23976@nevyn.them.org> <409343B3.2050605@specifixinc.com>
On Fri, Apr 30, 2004 at 11:29:07PM -0700, Jim Wilson wrote:
> Daniel Jacobowitz wrote:
> >Er, except I'm not sure that's right; something was said about operands
> >unreferenced in the asm text being a bad idea.
>
> The optimizer never looks at the asm text, so whether an operand is used
> has no effect on how the compiler will optimize. The asm text is only
> used when we emit assembly to the .s file.
>
> If this really matters, one could always add "; %2" assuming ; is the
> assembler comment character, but I doubt that will do anything useful.
>
> The only thing I can think of is that if an operand has side effects,
> and the compiler makes assuptions about those side-effects, then whether
> an operand is used could make a difference. However, there are so many
> other issues here, the operand could be used multiple times, the operand
> might not actually be used by the instruction, or we might be using the
> operand in a special way. The optimizer really can't make any
> assumptions about what is happening here, so it shouldn't make any
> difference whether or not the operand is used.
>
> The only thing I can immediately think of that has side-effects is
> auto-inc addresses, and you could avoid them if necessary by using an o
> constraint instead of a m constraint.
>
> In the absence of an actual bug report, I don't think there is anything
> wrong with unreferenced operands.
Thanks - that does make sense to me. I thought I remembered Richard
saying something to the contrary, but he denies it, so I have no idea
what I was thinking!
--
Daniel Jacobowitz