From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28553 invoked by alias); 1 Apr 2011 17:25:57 -0000 Received: (qmail 28534 invoked by uid 22791); 1 Apr 2011 17:25:54 -0000 X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=AWL,BAYES_00,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; Fri, 01 Apr 2011 17:25:48 +0000 Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.corbina.net (Postfix) with ESMTP id B9BA4CD7CC; Fri, 1 Apr 2011 21:25:46 +0400 (MSD) Received: from [95.26.119.89] (account aesok@post.ru HELO Vista.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPA id 313577590; Fri, 01 Apr 2011 21:25:46 +0400 Date: Fri, 01 Apr 2011 17:25:00 -0000 From: Anatoly Sokolov Message-ID: <307633434.20110401212547@post.ru> To: "Naveen H. S" CC: "law@redhat.com" , "gcc-patches@gcc.gnu.org" , Richard Henderson , Prafulla Thakare , kazu@codesourcery.com Subject: Re: [PING]RE: [H8300] Hookize target macros In-Reply-To: <371569CBCFB2E745B891DBB88B2DFDDD19E530D70B@KCINPUNHJCMS01.kpit.com> References: <371569CBCFB2E745B891DBB88B2DFDDD19E0A0E4D8@KCINPUNHJCMS01.kpit.com> <4C810E79.6060600@redhat.com> <371569CBCFB2E745B891DBB88B2DFDDD19E530D70B@KCINPUNHJCMS01.kpit.com> 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/msg00063.txt.bz2 Hi. On 09/17/2010 12:54:36, Naveen H. S wrote: > Can you please commit the patch if it's OK? > Thanks & Regards, > Naveen > -----Original Message----- > From: Richard Henderson [mailto:rth@redhat.com]=20 > Sent: Friday, September 03, 2010 8:34 PM > To: Naveen H. S > Cc: gcc-patches@gcc.gnu.org; Prafulla Thakare > Subject: Re: [H8300] Hookize target macros > On 09/01/2010 02:39 AM, Naveen H. S wrote: >> * config/h8300/h8300.c (h8300_print_operand_address): Make static. >> Adjust comments. Declare. >> (h8300_print_operand): Likewise. >> (h8300_print_operand_punct_valid_p): Moved from h8300.h file.=20 >> (h8300_function_value): Likewise. >> (h8300_function_value_regno_p): Likewise. >> (h8300_register_move_cost): Likewise. >> (TARGET_PRINT_OPERAND_PUNCT_VALID_P, TARGET_PRINT_OPERAND >> TARGET_PRINT_OPERAND_ADDRESS, TARGET_REGISTER_MOVE_COST >> TARGET_FUNCTION_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Define. >> * config/h8300/h8300.h (PRINT_OPERAND_ADDRESS, PRINT_OPERAND >> PRINT_OPERAND_PUNCT_VALID_P, REGISTER_MOVE_COST, FUNCTION_VALUE >> FUNCTION_VALUE_REGNO_P): Delete. >> * config/h8300/h8300-protos.h (print_operand): Delete. >> (print_operand_address): Delete. > Ok. > r~ Since TARGET_FUNCTION_VALUE and TARGET_FUNCTION_VALUE_REGNO_P macros already transformed in to target hooks, they are removed from this patch. Also I add mark 'mode' argument in h8300_register_move_cost function as=20 unused and slightly corrected ChangeLog entry. Because old patch is approved I will commit new version in four days is n= o=20 objection. Regression tested on h8300-unknown-elf with no new failure. 2011-04-01 Naveen H.S * config/h8300/h8300.c (print_operand_address): Rename to... (h8300_print_operand_address): ...this. Make static. Adjust comment= s. Call h8300_print_operand and h8300_print_operand_address instead of print_operand and print_operand_address. Declare. (print_operand): Renake to... (h8300_print_operand): ...this. Make static. Adjust comments. Call h8300_print_operand instead of print_operand. Declare. (h8300_print_operand_punct_valid_p): Moved from h8300.h file. (h8300_register_move_cost): Likewise. (TARGET_PRINT_OPERAND_PUNCT_VALID_P, TARGET_PRINT_OPERAND TARGET_PRINT_OPERAND_ADDRESS, TARGET_REGISTER_MOVE_COST): Define. * config/h8300/h8300.h (PRINT_OPERAND_ADDRESS, PRINT_OPERAND PRINT_OPERAND_PUNCT_VALID_P, REGISTER_MOVE_COST): Delete. * config/h8300/h8300-protos.h (print_operand): Delete. (print_operand_address): Delete Index: gcc/config/h8300/h8300.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/h8300/h8300.c (revision 171793) +++ gcc/config/h8300/h8300.c (working copy) @@ -93,9 +93,13 @@ static tree h8300_handle_fndecl_attribute (tree *, tree, tree, int, bool *= ); static tree h8300_handle_eightbit_data_attribute (tree *, tree, tree, int,= bool *); static tree h8300_handle_tiny_data_attribute (tree *, tree, tree, int, boo= l *); +static void h8300_print_operand_address (FILE *, rtx); +static void h8300_print_operand (FILE *, rtx, int); +static bool h8300_print_operand_punct_valid_p (unsigned char code); #ifndef OBJECT_FORMAT_ELF static void h8300_asm_named_section (const char *, unsigned int, tree); #endif +static int h8300_register_move_cost (enum machine_mode, reg_class_t, reg_c= lass_t); static int h8300_and_costs (rtx); static int h8300_shift_costs (rtx); static void h8300_push_pop (int, int, bool, bool); @@ -1182,6 +1188,22 @@ } =20 =0C +/* Implements TARGET_REGISTER_MOVE_COST. + + Any SI register-to-register move may need to be reloaded, + so inmplement h8300_register_move_cost to return > 2 so that reload nev= er + shortcuts. */ + +static int +h8300_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, + reg_class_t from, reg_class_t to) +{ + if (from =3D=3D MAC_REGS || to =3D=3D MAC_REG) + return 6; + else + return 3; +} + /* Compute the cost of an and insn. */ =20 static int @@ -1450,8 +1472,8 @@ /* Print operand X using operand code CODE to assembly language output file FILE. */ =20 -void -print_operand (FILE *file, rtx x, int code) +static void +h8300_print_operand (FILE *file, rtx x, int code) { /* This is used for communication between codes V,W,Z and Y. */ static int bitint; @@ -1530,7 +1552,7 @@ if (GET_CODE (x) =3D=3D REG) fprintf (file, "%s%c", names_big[REGNO (x)], bitint > 7 ? 'h' : 'l'= ); else - print_operand (file, x, 'R'); + h8300_print_operand (file, x, 'R'); bitint =3D -1; break; case 'Z': @@ -1563,7 +1585,7 @@ fprintf (file, "%s", names_upper_extended[REGNO (x)]); break; case MEM: - print_operand (file, x, 0); + h8300_print_operand (file, x, 0); break; case CONST_INT: fprintf (file, "#%ld", ((INTVAL (x) >> 16) & 0xffff)); @@ -1593,7 +1615,7 @@ break; case MEM: x =3D adjust_address (x, HImode, 2); - print_operand (file, x, 0); + h8300_print_operand (file, x, 0); break; case CONST_INT: fprintf (file, "#%ld", INTVAL (x) & 0xffff); @@ -1638,7 +1660,7 @@ } break; case 'o': - print_operand_address (file, x); + h8300_print_operand_address (file, x); break; case 's': if (GET_CODE (x) =3D=3D CONST_INT) @@ -1755,7 +1777,7 @@ case CONST: case LABEL_REF: fprintf (file, "#"); - print_operand_address (file, x); + h8300_print_operand_address (file, x); break; case CONST_DOUBLE: { @@ -1772,10 +1794,18 @@ } } =20 +/* Implements TARGET_PRINT_OPERAND_PUNCT_VALID_P. */ + +static bool +h8300_print_operand_punct_valid_p (unsigned char code) +{ + return (code =3D=3D '#'); +} + /* Output assembly language output for the address ADDR to FILE. */ =20 -void -print_operand_address (FILE *file, rtx addr) +static void +h8300_print_operand_address (FILE *file, rtx addr) { rtx index; int size; @@ -1809,37 +1839,37 @@ if (GET_CODE (index) =3D=3D REG) { /* reg,foo */ - print_operand_address (file, XEXP (addr, 1)); + h8300_print_operand_address (file, XEXP (addr, 1)); fprintf (file, ","); switch (size) { case 0: - print_operand_address (file, index); + h8300_print_operand_address (file, index); break; =20 case 1: - print_operand (file, index, 'X'); + h8300_print_operand (file, index, 'X'); fputs (".b", file); break; =20 case 2: - print_operand (file, index, 'T'); + h8300_print_operand (file, index, 'T'); fputs (".w", file); break; =20 case 4: - print_operand (file, index, 'S'); + h8300_print_operand (file, index, 'S'); fputs (".l", file); break; } - /* print_operand_address (file, XEXP (addr, 0)); */ + /* h8300_print_operand_address (file, XEXP (addr, 0)); */ } else { /* foo+k */ - print_operand_address (file, XEXP (addr, 0)); + h8300_print_operand_address (file, XEXP (addr, 0)); fprintf (file, "+"); - print_operand_address (file, XEXP (addr, 1)); + h8300_print_operand_address (file, XEXP (addr, 1)); } fprintf (file, ")"); break; @@ -3747,7 +3777,7 @@ /* Return the asm template for a single h8sx shift instruction. OPERANDS[0] and OPERANDS[1] are the destination, OPERANDS[2] is the source and OPERANDS[3] is the shift. SUFFIX is the - size suffix ('b', 'w' or 'l') and OPTYPE is the print_operand + size suffix ('b', 'w' or 'l') and OPTYPE is the h8300_print_operand prefix for the destination operand. */ =20 const char * @@ -5982,12 +6012,22 @@ #undef TARGET_ASM_FILE_END #define TARGET_ASM_FILE_END h8300_file_end =20 +#undef TARGET_PRINT_OPERAND +#define TARGET_PRINT_OPERAND h8300_print_operand +#undef TARGET_PRINT_OPERAND_ADDRESS +#define TARGET_PRINT_OPERAND_ADDRESS h8300_print_operand_address +#undef TARGET_PRINT_OPERAND_PUNCT_VALID_P +#define TARGET_PRINT_OPERAND_PUNCT_VALID_P h8300_print_operand_punct_valid= _p + #undef TARGET_ENCODE_SECTION_INFO #define TARGET_ENCODE_SECTION_INFO h8300_encode_section_info =20 #undef TARGET_INSERT_ATTRIBUTES #define TARGET_INSERT_ATTRIBUTES h8300_insert_attributes =20 +#undef TARGET_REGISTER_MOVE_COST +#define TARGET_REGISTER_MOVE_COST h8300_register_move_cost + #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS h8300_rtx_costs =20 Index: gcc/config/h8300/h8300.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/h8300/h8300.h (revision 171793) +++ gcc/config/h8300/h8300.h (working copy) @@ -435,13 +435,6 @@ #define CLASS_MAX_NREGS(CLASS, MODE) \ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) =20 -/* Any SI register-to-register move may need to be reloaded, - so define REGISTER_MOVE_COST to be > 2 so that reload never - shortcuts. */ - -#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \ - (CLASS1 =3D=3D MAC_REGS || CLASS2 =3D=3D MAC_REGS ? 6 : 3) -=0C /* Stack layout; function entry, exit and calling. */ =20 /* Define this if pushing a word on the stack @@ -977,19 +970,6 @@ =20 #define ASM_PN_FORMAT "%s___%lu" =20 -/* Print an instruction operand X on file FILE. - Look in h8300.c for details. */ - -#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ - ((CODE) =3D=3D '#') - -#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) - -/* Print a memory operand whose address is X, on file FILE. - This uses a function in h8300.c. */ - -#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADD= R) - /* H8300 specific pragmas. */ #define REGISTER_TARGET_PRAGMAS() \ do \ Index: gcc/config/h8300/h8300-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/h8300/h8300-protos.h (revision 171793) +++ gcc/config/h8300/h8300-protos.h (working copy) @@ -34,8 +34,6 @@ extern const char *output_a_rotate (enum rtx_code, rtx *); extern unsigned int compute_a_rotate_length (rtx *); extern const char *output_simode_bld (int, rtx[]); -extern void print_operand_address (FILE *, rtx); -extern void print_operand (FILE *, rtx, int); extern void final_prescan_insn (rtx, rtx *, int); extern int h8300_expand_movsi (rtx[]); extern void notice_update_cc (rtx, rtx); Anatoly.