From patchwork Thu Dec 15 18:30:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 131717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 3E54D1007D4 for ; Fri, 16 Dec 2011 05:30:43 +1100 (EST) Received: (qmail 1196 invoked by alias); 15 Dec 2011 18:30:39 -0000 Received: (qmail 1186 invoked by uid 22791); 15 Dec 2011 18:30:37 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.162) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Dec 2011 18:30:24 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by smtp.strato.de (fruni mo53) (RZmta 26.15 AUTH) with ESMTPA id 20518cnBFFxJqc ; Thu, 15 Dec 2011 19:30:16 +0100 (MET) Message-ID: <4EEA3CB8.6030407@gjlay.de> Date: Thu, 15 Dec 2011 19:30:16 +0100 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: Denis Chertykov , Eric Weddington , Anatoly Sokolov Subject: [Patch,AVR]: Hookize PRINT_OPERAND* X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Implements target hooks TARGET_PRINT_OPERAND TARGET_PRINT_OPERAND_ADDRESS TARGET_PRINT_OPERAND_PUNCT_VALID_P Ok? Johann * config/avr/avr-protos.h (print_operand): Remove. (print_operand_address): Remove. * config/avr/avr.h (PRINT_OPERAND): Remove. (PRINT_OPERAND_ADDRESS): Remove. (PRINT_OPERAND_PUNCT_VALID_P): Remove. * config/avr/avr.c (TARGET_PRINT_OPERAND): New hook define. (TARGET_PRINT_OPERAND_ADDRESS): New hook define. (TARGET_PRINT_OPERAND_PUNCT_VALID_P): New hook define. (print_operand_address): Rename to... (avr_print_operand_address): ...this and make static. (print_operand): Rename to... (avr_print_operand): ...this and make static. (avr_print_operand_punct_valid_p): New static function. Index: config/avr/avr-protos.h =================================================================== --- config/avr/avr-protos.h (revision 182327) +++ config/avr/avr-protos.h (working copy) @@ -101,8 +101,6 @@ extern const char* output_reload_inhi (r extern const char* output_reload_insisf (rtx*, rtx, int*); extern const char* avr_out_reload_inpsi (rtx*, rtx, int*); extern void notice_update_cc (rtx body, rtx insn); -extern void print_operand (FILE *file, rtx x, int code); -extern void print_operand_address (FILE *file, rtx addr); extern int reg_unused_after (rtx insn, rtx reg); extern int _reg_unused_after (rtx insn, rtx reg); extern int avr_jump_mode (rtx x, rtx insn); Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 182363) +++ config/avr/avr.c (working copy) @@ -289,6 +289,13 @@ bool avr_need_copy_data_p = false; #undef TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS #define TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS avr_addr_space_legitimize_address +#undef TARGET_PRINT_OPERAND +#define TARGET_PRINT_OPERAND avr_print_operand +#undef TARGET_PRINT_OPERAND_ADDRESS +#define TARGET_PRINT_OPERAND_ADDRESS avr_print_operand_address +#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P +#define TARGET_PRINT_OPERAND_PUNCT_VALID_P avr_print_operand_punct_valid_p + /* Custom function to replace string prefix. @@ -1733,10 +1740,12 @@ cond_string (enum rtx_code code) return ""; } + +/* Implement `TARGET_PRINT_OPERAND_ADDRESS'. */ /* Output ADDR to FILE as address. */ -void -print_operand_address (FILE *file, rtx addr) +static void +avr_print_operand_address (FILE *file, rtx addr) { switch (GET_CODE (addr)) { @@ -1791,11 +1800,21 @@ print_operand_address (FILE *file, rtx a } +/* Implement `TARGET_PRINT_OPERAND_PUNCT_VALID_P'. */ + +static bool +avr_print_operand_punct_valid_p (unsigned char code) +{ + return code == '~' || code == '!'; +} + + +/* Implement `TARGET_PRINT_OPERAND'. */ /* Output X as assembler operand to file FILE. For a description of supported %-codes, see top of avr.md. */ -void -print_operand (FILE *file, rtx x, int code) +static void +avr_print_operand (FILE *file, rtx x, int code) { int abcd = 0; @@ -1889,14 +1908,14 @@ print_operand (FILE *file, rtx x, int co } else if (code == 'i') { - print_operand (file, addr, 'i'); + avr_print_operand (file, addr, 'i'); } else if (code == 'o') { if (GET_CODE (addr) != PLUS) fatal_insn ("bad address, not (reg+disp):", addr); - print_operand (file, XEXP (addr, 1), 0); + avr_print_operand (file, XEXP (addr, 1), 0); } else if (code == 'p' || code == 'r') { @@ -1904,21 +1923,21 @@ print_operand (FILE *file, rtx x, int co fatal_insn ("bad address, not post_inc or pre_dec:", addr); if (code == 'p') - print_operand_address (file, XEXP (addr, 0)); /* X, Y, Z */ + avr_print_operand_address (file, XEXP (addr, 0)); /* X, Y, Z */ else - print_operand (file, XEXP (addr, 0), 0); /* r26, r28, r30 */ + avr_print_operand (file, XEXP (addr, 0), 0); /* r26, r28, r30 */ } else if (GET_CODE (addr) == PLUS) { - print_operand_address (file, XEXP (addr,0)); + avr_print_operand_address (file, XEXP (addr,0)); if (REGNO (XEXP (addr, 0)) == REG_X) fatal_insn ("internal compiler error. Bad address:" ,addr); fputc ('+', file); - print_operand (file, XEXP (addr,1), code); + avr_print_operand (file, XEXP (addr,1), code); } else - print_operand_address (file, addr); + avr_print_operand_address (file, addr); } else if (code == 'i') { @@ -1954,7 +1973,7 @@ print_operand (FILE *file, rtx x, int co else if (code == 'k') fputs (cond_string (reverse_condition (GET_CODE (x))), file); else - print_operand_address (file, x); + avr_print_operand_address (file, x); } /* Update the condition code in the INSN. */ Index: config/avr/avr.h =================================================================== --- config/avr/avr.h (revision 182327) +++ config/avr/avr.h (working copy) @@ -497,12 +497,6 @@ typedef struct avr_args { #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop) -#define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE) - -#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~' || (CODE) == '!') - -#define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X) - #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \ { \ gcc_assert (REGNO < 32); \