Re: expanding 1 insn to 2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: expanding 1 insn to 2

Aurelien BUHRIG-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
Reply | Threaded
Open this post in threaded view
|

Re: expanding 1 insn to 2

Aurelien BUHRIG-2
Should I consider this silence as a "it's not possible" answer, as a
"cgen is not maintained anymore", or as "everybody is on Holiday" ?

Aurelien

2011/8/26 Aurelien Buhrig <[hidden email]>:

> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: expanding 1 insn to 2

Frank Ch. Eigler
Hi -

> Should I consider this silence as a "it's not possible" answer, as a
> "cgen is not maintained anymore", or as "everybody is on Holiday" ?

I believe few of us have current working memories of this area of the
code.  It does seem like something the assembler-side hand-written
code would have to do.  The complex-relocation bfd/gas facility might
be of use also.

- FChE