This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: About EXTRA_ADDRESS_CONSTRAINT
- From: Alexandre Courbot <Alexandre dot Courbot at lifl dot fr>
- To: "Ulrich Weigand" <Ulrich dot Weigand at de dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 23 May 2003 10:54:59 +0200
- Subject: Re: About EXTRA_ADDRESS_CONSTRAINT
- References: <OFCB49638A.B264513A-ONC1256D2E.0058E640@de.ibm.com>
> >(set (reg REG) (plus (mem (symbol_ref "var")) (const_int 2)))
> >(set (mem (const (plus (symbol_ref "obj") (const_int x))))
> > (reg REG))
>
> But this is a simple reload of the value into a register; you shouldn't
> need any of the 'special stuff' for that.
Mmm. I guess I have difficulties clearly understanding the reload mechanism. I
haven't found a part in the manual that formally explains what happens there
- from what I understand, values which constraints doesn't match are just
reloaded into registers - but it look like it does a bit more actually.
> Simply define 'Q' as a normal EXTRA_CONSTRAINT, and rewrite the pattern as
>
> (set (match_operand 0 "nonimmediate_operand" "=Qr")
> (plus (match_operand 1 "general_operand" "Qr")
> (match_operand 2 "general_operand" "Qr")))
>
> so that reload will know it can reload into a register in case the 'Q'
> doesn't match exactly.
It works flawlessly. I thought it wasn't necessary to put the 'r' as my 'Q'
constraint obviously includes registers. I'm a bit confused by this. Reading
the Machine Descriptions chapter again didn't help understanding why 'r' is
needed here. Maybe it is marked in some way so the compiler knows how to
reload to it, while my Q constraint obviously isn't marked?
Anyway, thanks a lot for your help - you have been extremly helpful and I hope
to understand clearly what happens during reloading thanks to this! ;)
Alex.