> if is_input and is_clobber then ...
>
> > By claiming its a dummy output the compiler will not
> > try to use that register to hold any other values across
> > the asm statement.
>
> Dummy outputs are a way to hack around the problem.
> Think about it. Doesn't it look gross to you?
Marginally gross, but it describes the situation in such a way
as to make it possible for the compiler to do the right thing.
It also more closely models how machine descriptions are written
which will improve the reliability of your asm constructs. In
fact this is *exactly* how similar situations are described in
the machine descriptions.
It also will allow for more compile-time checks of your asm statements
instead of letting the compiler silently generate incorrect code
(which is exactly what got this whole discussion started).
It also gives you the capability of allowing the compiler to select
a register which will allow the compiler to generate more efficient
code (assuming of course the asm statements are capable of using
varying registers).
It's also a tiny step in the right direction if we were to ever turn
off the SMALL_REGISTER_CLASSES hack/pessimization that is needed on
the x86 port.
Using a matching constraint and early clobber will work on more
than just the x86 port. The hack currently used on x86 Linux
isn't likely to work on any port other than the x86.
In fact, in a private message Linus even said using earlyclobbers
with matching constraints was cleaner than showing the same reg
as an input and clobber.
> > The need for the mechanism is obvious, the mechanism currently
> > used by Linux is wrong.
>
> Is it legal for any other purpose? If not, then nothing will break
> when gcc does what most developers seem to expect.
No, the mechanism currently used by Linux is not valid in any
context. You've been able to get away with it over the years, but
that doesn't make it correct or valid.
jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu