From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1688 invoked by alias); 26 Aug 2011 15:06:46 -0000 Received: (qmail 1655 invoked by uid 22791); 26 Aug 2011 15:06:41 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_DN X-Spam-Check-By: sourceware.org Received: from mail-ey0-f169.google.com (HELO mail-ey0-f169.google.com) (209.85.215.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Aug 2011 15:06:25 +0000 Received: by eye22 with SMTP id 22so3050283eye.0 for ; Fri, 26 Aug 2011 08:06:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.14.3.146 with SMTP id 18mr488978eeh.74.1314371183357; Fri, 26 Aug 2011 08:06:23 -0700 (PDT) Received: by 10.14.119.69 with HTTP; Fri, 26 Aug 2011 08:06:23 -0700 (PDT) In-Reply-To: <3291F72D-A059-4CDB-B4C7-4764DA818D0E@earthlink.net> References: <1314359986.11346.ezmlm@sourceware.org> <3291F72D-A059-4CDB-B4C7-4764DA818D0E@earthlink.net> Date: Fri, 26 Aug 2011 15:06:00 -0000 Message-ID: Subject: Re: expanding 1 insn to 2 From: Aurelien Buhrig To: Alan Lehotsky Cc: cgen@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2011-q3/txt/msg00007.txt.bz2 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. =A0I assume use used cgen to bui= ld a > gas assembler from the binutils distribution. yes > You can either define a .macro that will do what you want assuming that y= our > 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