From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Clifton To: greg@mcgary.org Cc: dje@transmeta.com, cgen@sourceware.cygnus.com, binutils@sourceware.cygnus.com Subject: Re: how to implement general macro-insn expansion? Date: Wed, 27 Dec 2000 10:39:00 -0000 Message-id: <200012271839.KAA19845@elmo.cygnus.com> X-SW-Source: 2000-q4/msg00293.html 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