From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 982 invoked by alias); 27 Apr 2011 18:13:09 -0000 Received: (qmail 949 invoked by uid 22791); 27 Apr 2011 18:13:03 -0000 X-SWARE-Spam-Status: No, hits=1.4 required=5.0 tests=AWL,BAYES_05,KAM_THEBAT,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from contrabass.post.ru (HELO contrabass.corbina.net) (85.21.78.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Apr 2011 18:12:46 +0000 Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.corbina.net (Postfix) with ESMTP id 20002CC556; Wed, 27 Apr 2011 22:12:44 +0400 (MSD) Received: from [95.24.90.112] (account aesok@post.ru HELO Vista.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPA id 320936392; Wed, 27 Apr 2011 22:12:44 +0400 Date: Wed, 27 Apr 2011 18:43:00 -0000 From: Anatoly Sokolov Message-ID: <9410569723.20110427221316@post.ru> To: gcc-patches@gcc.gnu.org CC: rth@redhat.com, ebotcazou@libertysurf.fr Subject: [SPARC] Hookize PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg02146.txt.bz2 Hello. This patch removes obsolete PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P macros from SPARC back end in the GCC and=20 introduces equivalent TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS an= d=20 TARGET_PRINT_OPERAND_PUNCT_VALID_P target hooks.=20 =A0Bootstrapped and regression tested on sparc64-unknown-linux-gnu. OK to install? * config/sparc/sparc.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS, PRINT_OPERAND_PUNCT_VALID_P): Remove. * config/sparc/sparc-protos.h (print_operand): Remove declaration. * config/sparc/sparc.c (TARGET_PRINT_OPERAND_PUNCT_VALID_P, TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define. (print_operand): Rename to... (sparc_print_operand): ...this. Make static. Adjust sparc_print_operand function call. (sparc_print_operand_punct_valid_p, sparc_print_operand_address): N= ew functions. Index: gcc/config/sparc/sparc-protos.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/sparc/sparc-protos.h (revision 172733) +++ gcc/config/sparc/sparc-protos.h (working copy) @@ -76,7 +76,6 @@ extern const char *output_probe_stack_range (rtx, rtx); extern bool emit_scc_insn (rtx []); extern void emit_conditional_branch_insn (rtx []); -extern void print_operand (FILE *, rtx, int); extern int mems_ok_for_ldd_peep (rtx, rtx, rtx); extern int arith_double_4096_operand (rtx, enum machine_mode); extern int arith_4096_operand (rtx, enum machine_mode); Index: gcc/config/sparc/sparc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/sparc/sparc.c (revision 172733) +++ gcc/config/sparc/sparc.c (working copy) @@ -468,6 +468,9 @@ static void sparc_trampoline_init (rtx, tree, rtx); static enum machine_mode sparc_preferred_simd_mode (enum machine_mode); static reg_class_t sparc_preferred_reload_class (rtx x, reg_class_t rclass= ); +static bool sparc_print_operand_punct_valid_p (unsigned char); +static void sparc_print_operand (FILE *, rtx, int); +static void sparc_print_operand_address (FILE *, rtx); =0C #ifdef SUBTARGET_ATTRIBUTE_TABLE /* Table of valid machine attributes. */ @@ -663,6 +666,13 @@ #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT sparc_trampoline_init =20 +#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P +#define TARGET_PRINT_OPERAND_PUNCT_VALID_P sparc_print_operand_punct_valid= _p +#undef TARGET_PRINT_OPERAND +#define TARGET_PRINT_OPERAND sparc_print_operand +#undef TARGET_PRINT_OPERAND_ADDRESS +#define TARGET_PRINT_OPERAND_ADDRESS sparc_print_operand_address + struct gcc_target targetm =3D TARGET_INITIALIZER; =20 /* Validate and override various options, and do some machine dependent @@ -7326,12 +7336,29 @@ return 1; } =0C -/* Print operand X (an rtx) in assembler syntax to file FILE. +/* Implement TARGET_PRINT_OPERAND_PUNCT_VALID_P. */ + +static bool +sparc_print_operand_punct_valid_p (unsigned char code) +{ + if(code =3D=3D '#' + || code =3D=3D '*' + || code =3D=3D '(' + || code =3D=3D ')' + || code =3D=3D '_' + || code =3D=3D '&') + return true; + + return false; +} + +/* Implement TARGET_PRINT_OPERAND. + Print operand X (an rtx) in assembler syntax to file FILE. CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. For `%' followed by punctuation, CODE is the punctuation and X is null.= */ =20 -void -print_operand (FILE *file, rtx x, int code) +static void +sparc_print_operand (FILE *file, rtx x, int code) { switch (code) { @@ -7609,7 +7636,7 @@ } else if (GET_CODE (x) =3D=3D LO_SUM) { - print_operand (file, XEXP (x, 0), 0); + sparc_print_operand (file, XEXP (x, 0), 0); if (TARGET_CM_MEDMID) fputs ("+%l44(", file); else @@ -7633,6 +7660,89 @@ output_operand_lossage ("floating point constant not a valid immediate= operand"); else { output_addr_const (file, x); } } + +/* Implement TARGET_PRINT_OPERAND_ADDRESS. */ + +static void +sparc_print_operand_address (FILE *file, rtx x) +{ + register rtx base, index =3D 0; + int offset =3D 0; + register rtx addr =3D x; + + if (REG_P (addr)) + fputs (reg_names[REGNO (addr)], file); + else if (GET_CODE (addr) =3D=3D PLUS) + { + if (CONST_INT_P (XEXP (addr, 0))) + offset =3D INTVAL (XEXP (addr, 0)), base =3D XEXP (addr, 1); + else if (CONST_INT_P (XEXP (addr, 1))) + offset =3D INTVAL (XEXP (addr, 1)), base =3D XEXP (addr, 0); + else + base =3D XEXP (addr, 0), index =3D XEXP (addr, 1); + if (GET_CODE (base) =3D=3D LO_SUM) + { + gcc_assert (USE_AS_OFFSETABLE_LO10 + && TARGET_ARCH64 + && ! TARGET_CM_MEDMID); + output_operand (XEXP (base, 0), 0); + fputs ("+%lo(", file); + output_address (XEXP (base, 1)); + fprintf (file, ")+%d", offset); + } + else + { + fputs (reg_names[REGNO (base)], file); + if (index =3D=3D 0) + fprintf (file, "%+d", offset); + else if (REG_P (index)) + fprintf (file, "+%s", reg_names[REGNO (index)]); + else if (GET_CODE (index) =3D=3D SYMBOL_REF + || GET_CODE (index) =3D=3D LABEL_REF + || GET_CODE (index) =3D=3D CONST) + fputc ('+', file), output_addr_const (file, index); + else gcc_unreachable (); + } + } + else if (GET_CODE (addr) =3D=3D MINUS + && GET_CODE (XEXP (addr, 1)) =3D=3D LABEL_REF) + { + output_addr_const (file, XEXP (addr, 0)); + fputs ("-(", file); + output_addr_const (file, XEXP (addr, 1)); + fputs ("-.)", file); + } + else if (GET_CODE (addr) =3D=3D LO_SUM) + { + output_operand (XEXP (addr, 0), 0); + if (TARGET_CM_MEDMID) + fputs ("+%l44(", file); + else + fputs ("+%lo(", file); + output_address (XEXP (addr, 1)); + fputc (')', file); + } + else if (flag_pic + && GET_CODE (addr) =3D=3D CONST + && GET_CODE (XEXP (addr, 0)) =3D=3D MINUS + && GET_CODE (XEXP (XEXP (addr, 0), 1)) =3D=3D CONST + && GET_CODE (XEXP (XEXP (XEXP (addr, 0), 1), 0)) =3D=3D MINUS + && XEXP (XEXP (XEXP (XEXP (addr, 0), 1), 0), 1) =3D=3D pc_rtx) + { + addr =3D XEXP (addr, 0); + output_addr_const (file, XEXP (addr, 0)); + /* Group the args of the second CONST in parenthesis. */ + fputs ("-(", file); + /* Skip past the second CONST--it does nothing for us. */ + output_addr_const (file, XEXP (XEXP (addr, 1), 0)); + /* Close the parenthesis. */ + fputc (')', file); + } + else + { + output_addr_const (file, addr); + } +} =0C /* Target hook for assembling integer objects. The sparc version has special handling for aligned DI-mode objects. */ Index: gcc/config/sparc/sparc.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/sparc/sparc.h (revision 172733) +++ gcc/config/sparc/sparc.h (working copy) @@ -1922,95 +1922,6 @@ } \ } while (0) =20 -#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \ - ((CHAR) =3D=3D '#' || (CHAR) =3D=3D '*' || (CHAR) =3D=3D '(' = \ - || (CHAR) =3D=3D ')' || (CHAR) =3D=3D '_' || (CHAR) =3D=3D '&') - -/* Print operand X (an rtx) in assembler syntax to file FILE. - CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. - For `%' followed by punctuation, CODE is the punctuation and X is null.= */ - -#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) - -/* Print a memory address as an operand to reference that memory location.= */ - -#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ -{ register rtx base, index =3D 0; \ - int offset =3D 0; \ - register rtx addr =3D ADDR; \ - if (GET_CODE (addr) =3D=3D REG) \ - fputs (reg_names[REGNO (addr)], FILE); \ - else if (GET_CODE (addr) =3D=3D PLUS) \ - { \ - if (GET_CODE (XEXP (addr, 0)) =3D=3D CONST_INT) \ - offset =3D INTVAL (XEXP (addr, 0)), base =3D XEXP (addr, 1);\ - else if (GET_CODE (XEXP (addr, 1)) =3D=3D CONST_INT) \ - offset =3D INTVAL (XEXP (addr, 1)), base =3D XEXP (addr, 0);\ - else \ - base =3D XEXP (addr, 0), index =3D XEXP (addr, 1); \ - if (GET_CODE (base) =3D=3D LO_SUM) \ - { \ - gcc_assert (USE_AS_OFFSETABLE_LO10 \ - && TARGET_ARCH64 \ - && ! TARGET_CM_MEDMID); \ - output_operand (XEXP (base, 0), 0); \ - fputs ("+%lo(", FILE); \ - output_address (XEXP (base, 1)); \ - fprintf (FILE, ")+%d", offset); \ - } \ - else \ - { \ - fputs (reg_names[REGNO (base)], FILE); \ - if (index =3D=3D 0) \ - fprintf (FILE, "%+d", offset); \ - else if (GET_CODE (index) =3D=3D REG) \ - fprintf (FILE, "+%s", reg_names[REGNO (index)]); \ - else if (GET_CODE (index) =3D=3D SYMBOL_REF \ - || GET_CODE (index) =3D=3D LABEL_REF \ - || GET_CODE (index) =3D=3D CONST) \ - fputc ('+', FILE), output_addr_const (FILE, index); \ - else gcc_unreachable (); \ - } \ - } \ - else if (GET_CODE (addr) =3D=3D MINUS \ - && GET_CODE (XEXP (addr, 1)) =3D=3D LABEL_REF) \ - { \ - output_addr_const (FILE, XEXP (addr, 0)); \ - fputs ("-(", FILE); \ - output_addr_const (FILE, XEXP (addr, 1)); \ - fputs ("-.)", FILE); \ - } \ - else if (GET_CODE (addr) =3D=3D LO_SUM) \ - { \ - output_operand (XEXP (addr, 0), 0); \ - if (TARGET_CM_MEDMID) \ - fputs ("+%l44(", FILE); \ - else \ - fputs ("+%lo(", FILE); \ - output_address (XEXP (addr, 1)); \ - fputc (')', FILE); \ - } \ - else if (flag_pic && GET_CODE (addr) =3D=3D CONST = \ - && GET_CODE (XEXP (addr, 0)) =3D=3D MINUS \ - && GET_CODE (XEXP (XEXP (addr, 0), 1)) =3D=3D CONST \ - && GET_CODE (XEXP (XEXP (XEXP (addr, 0), 1), 0)) =3D=3D MINUS = \ - && XEXP (XEXP (XEXP (XEXP (addr, 0), 1), 0), 1) =3D=3D pc_rtx) = \ - { \ - addr =3D XEXP (addr, 0); \ - output_addr_const (FILE, XEXP (addr, 0)); \ - /* Group the args of the second CONST in parenthesis. */ \ - fputs ("-(", FILE); \ - /* Skip past the second CONST--it does nothing for us. */\ - output_addr_const (FILE, XEXP (XEXP (addr, 1), 0)); \ - /* Close the parenthesis. */ \ - fputc (')', FILE); \ - } \ - else \ - { \ - output_addr_const (FILE, addr); \ - } \ -} - /* TLS support defaulting to original Sun flavor. GNU extensions must be activated in separate configuration files. */ #ifdef HAVE_AS_TLS Anatoly.