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]

Re: more than 10 operands in `asm'


Another possibility which would make asms more readable is to name
operands.  I noticed it has been proposed already.

If naming is supported, then we don't have to support more than 10
numeric operands, so the meaning of existing asms can stay the same.
Large, compound asms would benefit most from added readability anyway.

I notice that `:' isn't used in constraints (according to the manual).
So how about this for a naming syntax:

   asm ("bsfl %{in},%{out}" : "out:=r" (word) : "in:r" (word));

Syntax: Names are optional, and consist of the symbol characters up to
the colon in an asm constraint string.  Named operands are referenced by
%{[A-Za-z_0-9]+}.  A name may duplicated in multiple constraints: that
means the same as a number does now (that the operand is shared between
input and output).

If `:' isn't acceptable, `"{out}=r" (word)' is the next obvious syntax.

I'm not clear what Joern Rennecke means by:
> It would also raise the question how to quote a literal {.  Note that
> { ... } nesting is used for assembler dialects.

Isn't a literal `{' simply itself, not preceded by `%'?
Or does `%{' already mean something for some targets?

-- Jamie



On Mon, Nov 09, 1998 at 04:20:51PM +0000, Joern Rennecke wrote:
> >   >   - Extend the syntax to %{[0-9]+} for multi-digit operands.
> > Ewwwww.  It may be backwards compatible, but it's butt ugly.
> 
> It would also raise the question how to quote a literal {.  Note that
> { ... } nesting is used for assembler dialects.
> 
> > Better to find any old style %digitdigit strings and fix them or define
> > a simple syntax without context rules.
> 
> But how can you output a digit after an operand?
> 
> Whatever syntax we chose, we should make it general enough so that it
> also covers %c<digit>, %n<digit>, %a<digit> and %l<digit>
> 
> Interstingly, Bernd's approach can be immediately applied to these
> variants without introducing any conflicts.
> To avoid conflicts with %{ for plain operands, we could use %o{<number>} .
> However, we then have to check for possible conflicts with target ports
> that might use this letter for something special.


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