This is the mail archive of the binutils@sourceware.org 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]

Implementing a macro-expansion inside gas?


I've been asked to add the simulation of PUSH/POP multiple instructions following the model of the ARM push/pop; e.g.

push { reglist }

where reglist is a comma-separated set of register names.

This would expand to a variable number of instructions of the form

	move Ri,-(SP)
        move Rj,-(SP)
        ....

with a corresponding expansion of pop { reglist } into

move (SP)+,Ri

etc.

I don't see any way to make CGEN handle this - it can only handle fixed size expansions, and I don't want to add hundreds
of macros for each possible sequence of push or pop.


It would seem straightforward (if tedious) to add code to the md_assemble() main loop that recognizes, parses
and (probably recursively calls md_assemble() with the specific expansion. I can't use the .macro support in GAS
because of the need to handle curly braces.


Anyone else have a clever alternative?

-- Al



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