This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: About EXTRA_ADDRESS_CONSTRAINT


> >(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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]