On Thu, Mar 12, 2015 at 03:09:52PM -0700, David Wohlferd wrote:
> Ahh. So perhaps as I suspected: this is more commonly used on non-i386
> platforms. So clearly removing this is out of the question.
glibc uses it for PowerPC and s390 at least (I only grepped for "3",
quotes included -- there may be more archs that use it).
This feature was added to GCC very long ago, in 1992, SVN commit r334.
The code comment (varasm.c:decode_reg_name_and_count nowadays) makes
clear it is very much deliberate (not an implementation accident).
> This brings us to the question of documentation. Right now the docs
> only refer to register names. I expect it would be helpful for people
> to understand what it means when they come across code that uses
> indices. A few words in the 'clobbers' section and the two Reg Vars
> sections would probably cover it.
I wouldn't. Numbers *are* the register names for all platforms where
you are likely to see this used. Expecting numbers in a clobber to
work as a backref to an output constraint is a) strange, and b) fatal,
as so many errors with asm are. I think the only way to teach people
to not hurt themselves so much with asm is to let them hurt themselves
a lot, so they'll be much more careful in the future :-/
> I realize this may seem a bit redundant for people who are used to
> registers named R0,R1,R2..., but on the i386, the order is:
> ax,dx,cx,bx,si...
And that isn't even the same as the hardware numbering. No one will
or should use this on x86, and if they do, well, hurt ;-)
Segher