This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
Re: expanding 1 insn to 2
- From: Aurelien Buhrig <aurelien dot buhrig dot gcc at gmail dot com>
- To: Alan Lehotsky <apl at alum dot mit dot edu>
- Cc: cgen at sourceware dot org
- Date: Fri, 26 Aug 2011 17:06:23 +0200
- Subject: Re: expanding 1 insn to 2
- References: <1314359986.11346.ezmlm@sourceware.org> <3291F72D-A059-4CDB-B4C7-4764DA818D0E@earthlink.net>
Hi,
thanks for your reply.
> It's possible (and documented in the cgen manual to do this inside cgen -
> see section 5.4.14 Writing define-macro-insn. and section 3.17
> Macro-instructions
I've already used dnmi to define 1 pseudo insn which represents
another insn (such as push --> move -(sp)).
My problem here is to define one pseudo instruction such as
ld.a #$abs32 --> r0r1
to be expanded into 2 real instructions such as
move.w #$abs16_hi --> r0
move.w #$abs16_lo --> r1
I can't see how to emit 2 instructions using define-macro-insn, and
how to tell cgen how to fill abs16_hi and abs16_lo operands from abs32
(all 3 operands refering to 3 different bfd howtos).
> You could also do this in the assembler. ?I assume use used cgen to build a
> gas assembler from the binutils distribution.
yes
> You can either define a .macro that will do what you want assuming that your
> addressing is simple enough, or you can tweak the md_assemble() function in
> your assember to parse the operands and break them down appropriately if you
> need.
md_assemble only apply on string source and I don't know how to handle
splitting symbol references (to be correctly relocated).
Idem with .macro.
A workaround can be to define 2 instructions such as ld_hi/ld_lo,
implemented as move with different howtos for relocs. but I would like
to define only one instruction.using cgen if possible...
Aurelien