This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Implementing a macro-expansion inside gas?
- From: Alan Lehotsky <qsmgmt at earthlink dot net>
- To: binutils at sourceware dot org
- Date: Mon, 16 Mar 2009 22:12:23 -0400
- Subject: 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