public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Aurelien Buhrig <aurelien.buhrig.gcc@gmail.com>
To: Alan Lehotsky <apl@alum.mit.edu>
Cc: cgen@sourceware.org
Subject: Re: expanding 1 insn to 2
Date: Fri, 26 Aug 2011 15:06:00 -0000	[thread overview]
Message-ID: <CAJ-J9_XEeuR8xkxA5EsYJ-PxrchDAUYz894M1mvPAubNq7V4Ng@mail.gmail.com> (raw)
In-Reply-To: <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

       reply	other threads:[~2011-08-26 15:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1314359986.11346.ezmlm@sourceware.org>
     [not found] ` <3291F72D-A059-4CDB-B4C7-4764DA818D0E@earthlink.net>
2011-08-26 15:06   ` Aurelien Buhrig [this message]
2011-08-30 13:38     ` Aurelien Buhrig
2011-08-30 13:57       ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ-J9_XEeuR8xkxA5EsYJ-PxrchDAUYz894M1mvPAubNq7V4Ng@mail.gmail.com \
    --to=aurelien.buhrig.gcc@gmail.com \
    --cc=apl@alum.mit.edu \
    --cc=cgen@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).