asm constraint rule change
Mon Oct 19 01:21:00 GMT 1998
On Mon, Oct 19, 1998 at 12:31:14AM +0200, Horst von Brand wrote:
> Andi Kleen <email@example.com> said:
> > In article < firstname.lastname@example.org >,
> > Jeffrey A Law <email@example.com> writes:
> > > In message < 19981016193609.A4141@dot.cygnus.com >you write:
> > >> The recent asm checking patches have tightened the rules such that output
> > >> constraints like "r=" are no longer valid. The problem is that there is
> > >> a largish body of code that writes things that way. More to the point,
> > >> despite all the examples running about the documentation, it does not ever
> > >> come out and specify this as a rule. It merely says
> > >>
> > >> ... all output operands' constraints must use `='.
> > >>
> > >> So this change is gonna piss some folks off, and with reason.
> > >>
> > >> I suggest we adopt the following patch to loosen this rule again.
> > >> * stmt.c (expand_asm_operands): Accept `=' or `+' at any position.
> > > How about let's make it a warning instead of a hard error.
> > > I wouldn't be suprised if some code handles them wrong if the '=' or
> > > '+' are not first. We need to get folks to fix their code.
> > Richard's patch moves them automagically to the beginning (with the bcopy).
> > Don't you think that is enough, why bother the programmer with another
> > warning if the compiler can fix it without problems? Also the requirement
> > wasn't documented.
> Better force people to do it _right_ than add "just another tiny special
> case fix" to gcc. Note that many people are turned away from gcc as it
> stands, claiming it's just a gigantic mess.
You call such an arbitary rule "right" ? For me it smells like the old
Fortran brain damage of giving the first columns some special meaning. For
internal interfaces inside the compiler it might be acceptable to have
such arbitary limitations, but for interfaces exposed to the user there
has to be a little bit more care. Adding such arbitary rules to the language
isn't a good idea imho, especially when the compiler can easily handle all
forms (by simply moving it), without bothering the user.
First the '+' in __asm__ statements is mostly redundant anyways, because
when I put an argument into the output section of the asm it is clear that
I want it as output argument. I think in these cases the compiler should
silently add the '+'.
More information about the Gcc-patches