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]

Re: how to implement general macro-insn expansion?


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



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