From 88cb339e2fc095381098658177b8600ee151c58f Mon Sep 17 00:00:00 2001 From: "Naveen H.S" Date: Fri, 1 Apr 2011 20:47:28 +0000 Subject: [PATCH] h8300.c (print_operand_address): Rename to... * config/h8300/h8300.c (print_operand_address): Rename to... (h8300_print_operand_address): ...this. Make static. Adjust comments. 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. From-SVN: r171853 --- gcc/ChangeLog | 18 ++++++++ gcc/config/h8300/h8300-protos.h | 2 - gcc/config/h8300/h8300.c | 74 +++++++++++++++++++++++++-------- gcc/config/h8300/h8300.h | 20 --------- 4 files changed, 74 insertions(+), 40 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d5733e0e915..5d55909f179 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2011-04-01 Naveen H.S + + * config/h8300/h8300.c (print_operand_address): Rename to... + (h8300_print_operand_address): ...this. Make static. Adjust comments. + 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. + 2011-04-01 Richard Henderson PR 48400 diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index 131410172b9..bb2d5e76097 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -34,8 +34,6 @@ extern unsigned int compute_a_shift_length (rtx, rtx *); 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); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 8c721297c86..93febd1e517 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -94,9 +94,13 @@ static unsigned int h8300_asm_insn_count (const char *); 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, bool *); +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_class_t); static int h8300_and_costs (rtx); static int h8300_shift_costs (rtx); static void h8300_push_pop (int, int, bool, bool); @@ -1118,6 +1122,22 @@ h8300_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, } +/* 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 never + shortcuts. */ + +static int +h8300_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, + reg_class_t from, reg_class_t to) +{ + if (from == MAC_REGS || to == MAC_REG) + return 6; + else + return 3; +} + /* Compute the cost of an and insn. */ static int @@ -1386,8 +1406,8 @@ cond_string (enum rtx_code code) /* Print operand X using operand code CODE to assembly language output file FILE. */ -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; @@ -1466,7 +1486,7 @@ print_operand (FILE *file, rtx x, int code) if (GET_CODE (x) == 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 = -1; break; case 'Z': @@ -1499,7 +1519,7 @@ print_operand (FILE *file, rtx x, int code) 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)); @@ -1529,7 +1549,7 @@ print_operand (FILE *file, rtx x, int code) break; case MEM: x = 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); @@ -1574,7 +1594,7 @@ print_operand (FILE *file, rtx x, int code) } break; case 'o': - print_operand_address (file, x); + h8300_print_operand_address (file, x); break; case 's': if (GET_CODE (x) == CONST_INT) @@ -1691,7 +1711,7 @@ print_operand (FILE *file, rtx x, int code) case CONST: case LABEL_REF: fprintf (file, "#"); - print_operand_address (file, x); + h8300_print_operand_address (file, x); break; case CONST_DOUBLE: { @@ -1708,10 +1728,18 @@ print_operand (FILE *file, rtx x, int code) } } +/* Implements TARGET_PRINT_OPERAND_PUNCT_VALID_P. */ + +static bool +h8300_print_operand_punct_valid_p (unsigned char code) +{ + return (code == '#'); +} + /* Output assembly language output for the address ADDR to FILE. */ -void -print_operand_address (FILE *file, rtx addr) +static void +h8300_print_operand_address (FILE *file, rtx addr) { rtx index; int size; @@ -1745,37 +1773,37 @@ print_operand_address (FILE *file, rtx addr) if (GET_CODE (index) == 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; case 1: - print_operand (file, index, 'X'); + h8300_print_operand (file, index, 'X'); fputs (".b", file); break; case 2: - print_operand (file, index, 'T'); + h8300_print_operand (file, index, 'T'); fputs (".w", file); break; 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; @@ -3683,7 +3711,7 @@ h8sx_classify_shift (enum machine_mode mode, enum rtx_code code, rtx op) /* 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. */ const char * @@ -5918,12 +5946,22 @@ h8300_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt) #undef TARGET_ASM_FILE_END #define TARGET_ASM_FILE_END h8300_file_end +#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 #undef TARGET_INSERT_ATTRIBUTES #define TARGET_INSERT_ATTRIBUTES h8300_insert_attributes +#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 diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index c135183afdb..eb774587ecf 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -365,13 +365,6 @@ enum reg_class { #define CLASS_MAX_NREGS(CLASS, MODE) \ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) -/* 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 == MAC_REGS || CLASS2 == MAC_REGS ? 6 : 3) - /* Stack layout; function entry, exit and calling. */ /* Define this if pushing a word on the stack @@ -791,19 +784,6 @@ struct cum_arg #define ASM_PN_FORMAT "%s___%lu" -/* Print an instruction operand X on file FILE. - Look in h8300.c for details. */ - -#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ - ((CODE) == '#') - -#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, ADDR) - /* H8300 specific pragmas. */ #define REGISTER_TARGET_PRAGMAS() \ do \ -- 2.30.2