This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GAS macro formals as expression


Hi Ian,

On Wed, Sep 10, 2003 at 08:21:41AM -0700, Ian Lance Taylor wrote:
> Fruhwirth Clemens <clemens-dated-1064070224.93d5@endorphin.org> writes:
> 
> > For instance this masm macro:
> > 
> > ldCache macro addr,byteCnt,cpuName
> > NN=0
> >   rept (byteCnt+63)/64                  ;force cache line load (Pentium only)
> >     irp QQ,<%(NN)>
> >     mov         eax,addr[QQ]
> >         endm
> >    if (NN+32) lt byteCnt
> >     irp QQ,<%(NN+36)>
> >       mov       ebx,addr[QQ]
> >         endm
> >    endif
> > NN=NN+64
> >   endm
> > endm
> > 
> > I reimplemented this loop with this recursive gas macro:
> 
> Why didn't you use the gas rept and irp pseudo-ops?  Would they not
> work for this application?

Because it's impossible to access the current counter value of the rept
expansion and reassigning macro formals is not possible either.

> Another possibility is to use a preprocessor, like m4, instead of
> using gas macros.

Well the source is aimed for the Linux kernel and those guys used to be
picky about the things they have in their tool chain :)... so I would prefer
just to rely on gas features. 

Regards, Clemens

Attachment: pgp00000.pgp
Description: PGP signature


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