From patchwork Sun Jul 24 20:35:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Sokolov X-Patchwork-Id: 106572 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 7B5F7B6F82 for ; Mon, 25 Jul 2011 06:35:17 +1000 (EST) Received: (qmail 8336 invoked by alias); 24 Jul 2011 20:35:15 -0000 Received: (qmail 8091 invoked by uid 22791); 24 Jul 2011 20:35:14 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=BAYES_00, KAM_THEBAT, RCVD_IN_DNSWL_NONE, 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; Sun, 24 Jul 2011 20:34:46 +0000 Received: from corbina.ru (violin.corbina.net [195.14.50.30]) by contrabass.corbina.net (Postfix) with ESMTP id 0D0D5CB869; Mon, 25 Jul 2011 00:34:45 +0400 (MSD) Received: from [95.28.37.227] (account aesok@post.ru HELO Vista.beeline) by fe1-mc.corbina.ru (CommuniGate Pro SMTP 5.4.0) with ESMTPA id 19651881; Mon, 25 Jul 2011 00:34:44 +0400 Date: Mon, 25 Jul 2011 00:35:07 +0400 From: Anatoly Sokolov Message-ID: <455836624.20110725003507@post.ru> To: gcc-patches CC: hp@bitrange.com Subject: [MMIX] Hookize PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P MIME-Version: 1.0 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 Hi. This patch removes obsolete PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P macros from MMIX back end in the GCC and introduces equivalent TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS and TARGET_PRINT_OPERAND_PUNCT_VALID_P target hooks. Regression tested on mmix-knuth-mmixware. OK to install? * config/mmix/mmix.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS, PRINT_OPERAND_PUNCT_VALID_P): Remove macro. * config/mmix/mmix-protos.h (mmix_print_operand_punct_valid_p, mmix_print_operand, mmix_print_operand_address): Remove. * config/mmix/mmix.c (mmix_print_operand_punct_valid_p): Make static. Change return type to bool. Change argument type to bool. (mmix_print_operand, mmix_print_operand_address): Make static. (mmix_intval, mmix_output_condition): Change 'x' argument type to const_rtx. (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS, TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define. Anatoly. Index: gcc/config/mmix/mmix.h =================================================================== --- gcc/config/mmix/mmix.h (revision 176649) +++ gcc/config/mmix/mmix.h (working copy) @@ -793,15 +793,6 @@ {{"sp", 254}, {":sp", 254}, {"rD", 256}, {"rE", 257}, \ {"rH", 258}, {"rJ", MMIX_rJ_REGNUM}, {"rO", MMIX_rO_REGNUM}} -#define PRINT_OPERAND(STREAM, X, CODE) \ - mmix_print_operand (STREAM, X, CODE) - -#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ - mmix_print_operand_punct_valid_p (CODE) - -#define PRINT_OPERAND_ADDRESS(STREAM, X) \ - mmix_print_operand_address (STREAM, X) - #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \ mmix_asm_output_reg_push (STREAM, REGNO) Index: gcc/config/mmix/mmix-protos.h =================================================================== --- gcc/config/mmix/mmix-protos.h (revision 176649) +++ gcc/config/mmix/mmix-protos.h (working copy) @@ -38,7 +38,6 @@ extern void mmix_asm_weaken_label (FILE *, const char *); extern void mmix_asm_output_labelref (FILE *, const char *); extern void mmix_asm_output_def (FILE *, const char *, const char *); -extern int mmix_print_operand_punct_valid_p (int); extern void mmix_asm_output_reg_push (FILE *, int); extern void mmix_asm_output_reg_pop (FILE *, int); extern void mmix_asm_output_skip (FILE *, int); @@ -73,8 +72,6 @@ extern rtx mmix_eh_return_stackadj_rtx (void); extern rtx mmix_eh_return_handler_rtx (void); extern int mmix_constant_address_p (rtx); -extern void mmix_print_operand (FILE *, rtx, int); -extern void mmix_print_operand_address (FILE *, rtx); extern void mmix_expand_prologue (void); extern void mmix_expand_epilogue (void); extern rtx mmix_get_hard_reg_initial_val (enum machine_mode, int); Index: gcc/config/mmix/mmix.c =================================================================== --- gcc/config/mmix/mmix.c (revision 176649) +++ gcc/config/mmix/mmix.c (working copy) @@ -118,8 +118,8 @@ static void mmix_output_shiftvalue_op_from_str (FILE *, const char *, HOST_WIDEST_INT); static void mmix_output_shifted_value (FILE *, HOST_WIDEST_INT); -static void mmix_output_condition (FILE *, rtx, int); -static HOST_WIDEST_INT mmix_intval (rtx); +static void mmix_output_condition (FILE *, const_rtx, int); +static HOST_WIDEST_INT mmix_intval (const_rtx); static void mmix_output_octa (FILE *, HOST_WIDEST_INT, int); static bool mmix_assemble_integer (rtx, unsigned int, int); static struct machine_function *mmix_init_machine_status (void); @@ -159,6 +159,9 @@ static bool mmix_frame_pointer_required (void); static void mmix_asm_trampoline_template (FILE *); static void mmix_trampoline_init (rtx, tree, rtx); +static void mmix_print_operand (FILE *, rtx, int); +static void mmix_print_operand_address (FILE *, rtx); +static bool mmix_print_operand_punct_valid_p (unsigned char); static void mmix_conditional_register_usage (void); /* Target structure macros. Listed by node. See `Using and Porting GCC' @@ -186,6 +189,13 @@ #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE mmix_target_asm_function_epilogue +#undef TARGET_PRINT_OPERAND +#define TARGET_PRINT_OPERAND mmix_print_operand +#undef TARGET_PRINT_OPERAND_ADDRESS +#define TARGET_PRINT_OPERAND_ADDRESS mmix_print_operand_address +#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P +#define TARGET_PRINT_OPERAND_PUNCT_VALID_P mmix_print_operand_punct_valid_p + #undef TARGET_ENCODE_SECTION_INFO #define TARGET_ENCODE_SECTION_INFO mmix_encode_section_info #undef TARGET_STRIP_NAME_ENCODING @@ -1552,9 +1562,9 @@ fputc ('\n', stream); } -/* PRINT_OPERAND. */ +/* TARGET_PRINT_OPERAND. */ -void +static void mmix_print_operand (FILE *stream, rtx x, int code) { /* When we add support for different codes later, we can, when needed, @@ -1779,10 +1789,10 @@ } } -/* PRINT_OPERAND_PUNCT_VALID_P. */ +/* TARGET_PRINT_OPERAND_PUNCT_VALID_P. */ -int -mmix_print_operand_punct_valid_p (int code ATTRIBUTE_UNUSED) +static bool +mmix_print_operand_punct_valid_p (unsigned char code) { /* A '+' is used for branch prediction, similar to other ports. */ return code == '+' @@ -1790,9 +1800,9 @@ || code == '.'; } -/* PRINT_OPERAND_ADDRESS. */ +/* TARGET_PRINT_OPERAND_ADDRESS. */ -void +static void mmix_print_operand_address (FILE *stream, rtx x) { if (REG_P (x)) @@ -2619,7 +2629,7 @@ same as swapping the arguments). */ static void -mmix_output_condition (FILE *stream, rtx x, int reversed) +mmix_output_condition (FILE *stream, const_rtx x, int reversed) { struct cc_conv { @@ -2724,7 +2734,7 @@ /* Return the bit-value for a const_int or const_double. */ static HOST_WIDEST_INT -mmix_intval (rtx x) +mmix_intval (const_rtx x) { unsigned HOST_WIDEST_INT retval;