This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
Re: how to implement general macro-insn expansion?
- To: greg at mcgary dot org
- Subject: Re: how to implement general macro-insn expansion?
- From: Nick Clifton <nickc at redhat dot com>
- Date: Wed, 27 Dec 2000 10:39:16 -0800
- CC: dje at transmeta dot com, cgen at sourceware dot cygnus dot com, binutils at sourceware dot cygnus dot com
Hi Greg,
: I see no way around the need to change the md_assemble() interface.
: Somehow md_assemble() needs to return a `sb' (string block)
: representing the expansion of a macro-insn so that read_a_source_file()
: can push it as a nested input source and continue assembling. A
: sneaky way to do this that doesn't require changing any of the
: zillions of instances of md_assemble is to pass a zeroed sb as a
: second argument, then detect macro-insn by whether or not the sb's
: fields come back filled-in. However, I don't like sneakiness and gas
: is sourceware, so I'm content to hack all instances of md_assmeble to
: take the second argument and return a boolean to indicate what we did.
: md_assmble() should return nonzero if it assembled an insn, and should
: return 0 if a macro expansion was deposited into `sb'.
:
: Sound reasonable?
Alternatively you could create a new target macro, say
MD_MACRO_ASSEMBLE. If this is defined, then read_a_source_file()
would invoke this macro, which is expected to return a string block,
and if it is not defined then read_a_source_file() would invoke
md_assemble() as normal. That way you do not have to modify hundreds
of ports, and you only need to define for those ports that really need
this feature.
Cheers
Nick