public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* Re: how to implement general macro-insn expansion?
@ 2000-12-27 10:39 Nick Clifton
  0 siblings, 0 replies; 9+ messages in thread
From: Nick Clifton @ 2000-12-27 10:39 UTC (permalink / raw)
  To: greg; +Cc: dje, cgen, binutils

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


^ permalink raw reply	[flat|nested] 9+ messages in thread
* multi-insn expansions for macro insns?
@ 2000-12-18 12:02 Greg McGary
  2000-12-18 13:09 ` Doug Evans
  0 siblings, 1 reply; 9+ messages in thread
From: Greg McGary @ 2000-12-18 12:02 UTC (permalink / raw)
  To: cgen

define-macro-insn currently allows only a simple 1:1 expansion.

I would like to have it handle 1:n expansions.

E.g., for a MIPS-like CPU which has a `bltz' insn (branch if less than
zero), we would need a two insn sequence to support the more general
2-register `blt' (branch if less than):

blt $s1, $s2, label => sub $at, $s1, $s2
                       bltz $at, label

Is this a desired feature of CGEN?  If so, I'll work on it.

I ask because perhaps CGEN architects consider this (and other
"advanced" features of MIPS assemblers) to overstep the proper role of
an assembler.

If it's a go, how about this as a multi-expansion syntax?:
    (sequence () (emit ...) (emit ...))

Greg

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-01-09 15:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-27 10:39 how to implement general macro-insn expansion? Nick Clifton
  -- strict thread matches above, loose matches on Subject: below --
2000-12-18 12:02 multi-insn expansions for macro insns? Greg McGary
2000-12-18 13:09 ` Doug Evans
2000-12-19 22:54   ` how to implement general macro-insn expansion? Greg McGary
2000-12-20  0:48     ` Greg McGary
2000-12-20  7:39       ` Doug Evans
2000-12-26 17:43         ` Greg McGary
2000-12-27 11:28           ` Doug Evans
2000-12-27 12:09             ` Greg McGary
2000-12-27 14:21               ` Doug Evans
2001-01-09 15:23                 ` Greg McGary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).