This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Disallow side-effects in inline asm operands unless (a new) _ constraint modifier is used (PR middle-end/44492)
On Sun, Jun 20, 2010 at 09:20:15AM -0400, Hans-Peter Nilsson wrote:
> > while _ allows it but doesn't require (and, allows also PRE/POST_MODIFY).
>
> So "_" would be less restrictive than "m<>".
> BTW, is it "_m" or "_"?
It is "_m", or "_g", or "_o" etc. The address mode needs to pass the given
constraint test and missing _ just means that in addition to that test
side-effects are rejected.
For PRE_MODIFY/POST_MODIFY, targets often don't allow arbitrary adjustment
constants and have other restrictions, so we just can't allow those two in
< (or >) constraint (and which one?) without having some target constrain
routine for that.
With < and > in inline-asm, what worries me is that before reload
asm_operand_ok doesn't require anything for the mem, so reload often has to
fix it up (could result in worse code).
Anyway, I guess I can live with not adding _ and saying that side-effects in
inline-asm memory is not allowed unless the constraint contains < or >.
Then PRE_MODIFY resp. POST_MODIFY would be allowed in
"m<>" or even just "m<" or "m>", assuming PRE_MODIFY resp. POST_MODIFY
is allowed in memory_address.
The implementation would be roughly the same as the patch I've posted, just
</> would set incdec_ok instead of _.
Advantage of doing it that way is backwards compatibility, "m<>" can be used
even with older gccs.
If you prefer to do it that way, I can write a patch.
Jakub