From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doug Evans To: Greg McGary Cc: cgen@sourceware.cygnus.com, ian@airs.com Subject: multi-insn expansions for macro insns? Date: Mon, 18 Dec 2000 13:09:00 -0000 Message-id: <14910.31997.701815.400981@casey.transmeta.com> References: <200012182002.NAA03245@kayak.mcgary.org> X-SW-Source: 2000-q4/msg00277.html Greg McGary writes: > 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. It has always been the plan to allow multi-insn expansions of macro-insns. > I ask because perhaps CGEN architects consider this (and other > "advanced" features of MIPS assemblers) to overstep the proper role of > an assembler. Well, depends on where you draw the line. IMO there are aspects of the MIPS assembler that don't belong there. [Maybe Ian can elaborate, I tend to forget the details.] On the other hand, simple expansions are completely reasonable IMO. e.g. in sparc there is the `set' pseudo-insn that assigns an immediate value to a register. It expands to an appropriate number of insns to accomplish the job. I wouldn't have a problem with supporting that kind of thing in cgen. > If it's a go, how about this as a multi-expansion syntax?: > (sequence () (emit ...) (emit ...)) That's the plan. Note that the intent here is to also allow specification of runtime determination of what gets emitted. e.g. (sequence () (if (foo) (emit this) (emit that)))