This is the mail archive of the cgen@sourceware.org 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]
Other format: [Raw text]

Re: expanding 1 insn to 2


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


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