Implementing a macro-expansion inside gas?
Alan Lehotsky
qsmgmt@earthlink.net
Tue Mar 17 02:12:00 GMT 2009
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
More information about the Binutils
mailing list