This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


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

multi-insn expansions for macro insns?


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)))

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