From ef875e12c78e73ff2684872b25db1695b536fcd2 Mon Sep 17 00:00:00 2001 From: Anatoly Sokolov Date: Thu, 16 Dec 2010 21:41:56 +0300 Subject: [PATCH] sh.h (OUTPUT_ADDR_CONST_EXTRA): Remove. * config/sh/sh.h (OUTPUT_ADDR_CONST_EXTRA): Remove. * config/sh/sh.c (sh_asm_output_addr_const_extra): New function. (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Define. From-SVN: r167951 --- gcc/ChangeLog | 6 +++ gcc/config/sh/sh.c | 114 ++++++++++++++++++++++++++++++++++++++++++++- gcc/config/sh/sh.h | 108 ------------------------------------------ 3 files changed, 119 insertions(+), 109 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18eaa23380d..351bce86add 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-12-16 Anatoly Sokolov + + * config/sh/sh.h (OUTPUT_ADDR_CONST_EXTRA): Remove. + * config/sh/sh.c (sh_asm_output_addr_const_extra): New function. + (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Define. + 2010-12-16 Ulrich Weigand * config/spu/t-spu-elf (LIB2_SIDITI_CONV_FUNC): Define. diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 034b171711f..2fdf03a7c25 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -204,6 +204,7 @@ static tree sh_handle_renesas_attribute (tree *, tree, tree, int, bool *); static void sh_print_operand (FILE *, rtx, int); static void sh_print_operand_address (FILE *, rtx); static bool sh_print_operand_punct_valid_p (unsigned char code); +static bool sh_asm_output_addr_const_extra (FILE *file, rtx x); static void sh_output_function_epilogue (FILE *, HOST_WIDE_INT); static void sh_insert_attributes (tree, tree *); static const char *sh_check_pch_target_flags (int); @@ -372,7 +373,9 @@ static const struct default_options sh_option_optimization_table[] = #define TARGET_PRINT_OPERAND_ADDRESS sh_print_operand_address #undef TARGET_PRINT_OPERAND_PUNCT_VALID_P #define TARGET_PRINT_OPERAND_PUNCT_VALID_P sh_print_operand_punct_valid_p - +#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA +#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA sh_asm_output_addr_const_extra + #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE sh_output_function_epilogue @@ -1453,6 +1456,115 @@ sh_print_operand_punct_valid_p (unsigned char code) return (code == '.' || code == '#' || code == '@' || code == ',' || code == '$' || code == '\'' || code == '>'); } + +/* Implement TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA. */ + +static bool +sh_asm_output_addr_const_extra (FILE *file, rtx x) +{ + if (GET_CODE (x) == UNSPEC) + { + switch (XINT (x, 1)) + { + case UNSPEC_DATALABEL: + fputs ("datalabel ", file); + output_addr_const (file, XVECEXP (x, 0, 0)); + break; + case UNSPEC_PIC: + /* GLOBAL_OFFSET_TABLE or local symbols, no suffix. */ + output_addr_const (file, XVECEXP (x, 0, 0)); + break; + case UNSPEC_GOT: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputs ("@GOT", file); + break; + case UNSPEC_GOTOFF: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputs ("@GOTOFF", file); + break; + case UNSPEC_PLT: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputs ("@PLT", file); + break; + case UNSPEC_GOTPLT: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputs ("@GOTPLT", file); + break; + case UNSPEC_DTPOFF: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputs ("@DTPOFF", file); + break; + case UNSPEC_GOTTPOFF: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputs ("@GOTTPOFF", file); + break; + case UNSPEC_TPOFF: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputs ("@TPOFF", file); + break; + case UNSPEC_CALLER: + { + char name[32]; + /* LPCS stands for Label for PIC Call Site. */ + targetm.asm_out.generate_internal_label (name, "LPCS", + INTVAL (XVECEXP (x, 0, 0))); + assemble_name (file, name); + } + break; + case UNSPEC_EXTRACT_S16: + case UNSPEC_EXTRACT_U16: + { + rtx val, shift; + + val = XVECEXP (x, 0, 0); + shift = XVECEXP (x, 0, 1); + fputc ('(', file); + if (shift != const0_rtx) + fputc ('(', file); + if (GET_CODE (val) == CONST + || GET_RTX_CLASS (GET_CODE (val)) != RTX_OBJ) + { + fputc ('(', file); + output_addr_const (file, val); + fputc (')', file); + } + else + output_addr_const (file, val); + if (shift != const0_rtx) + { + fputs (" >> ", file); + output_addr_const (file, shift); + fputc (')', file); + } + fputs (" & 65535)", file); + } + break; + case UNSPEC_SYMOFF: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputc ('-', file); + if (GET_CODE (XVECEXP (x, 0, 1)) == CONST) + { + fputc ('(', file); + output_addr_const (file, XVECEXP (x, 0, 1)); + fputc (')', file); + } + else + output_addr_const (file, XVECEXP (x, 0, 1)); + break; + case UNSPEC_PCREL_SYMOFF: + output_addr_const (file, XVECEXP (x, 0, 0)); + fputs ("-(", file); + output_addr_const (file, XVECEXP (x, 0, 1)); + fputs ("-.)", file); + break; + default: + return false; + } + return true; + } + else + return false; +} /* Encode symbol attributes of a SYMBOL_REF into its diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 9960ae12bc1..c07ff083d88 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2353,114 +2353,6 @@ struct sh_args { #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \ final_prescan_insn ((INSN), (OPVEC), (NOPERANDS)) -/* Recognize machine-specific patterns that may appear within - constants. Used for PIC-specific UNSPECs. */ -#define OUTPUT_ADDR_CONST_EXTRA(STREAM, X, FAIL) \ - do \ - if (GET_CODE (X) == UNSPEC) \ - { \ - switch (XINT ((X), 1)) \ - { \ - case UNSPEC_DATALABEL: \ - fputs ("datalabel ", (STREAM)); \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - break; \ - case UNSPEC_PIC: \ - /* GLOBAL_OFFSET_TABLE or local symbols, no suffix. */ \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - break; \ - case UNSPEC_GOT: \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - fputs ("@GOT", (STREAM)); \ - break; \ - case UNSPEC_GOTOFF: \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - fputs ("@GOTOFF", (STREAM)); \ - break; \ - case UNSPEC_PLT: \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - fputs ("@PLT", (STREAM)); \ - break; \ - case UNSPEC_GOTPLT: \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - fputs ("@GOTPLT", (STREAM)); \ - break; \ - case UNSPEC_DTPOFF: \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - fputs ("@DTPOFF", (STREAM)); \ - break; \ - case UNSPEC_GOTTPOFF: \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - fputs ("@GOTTPOFF", (STREAM)); \ - break; \ - case UNSPEC_TPOFF: \ - output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ - fputs ("@TPOFF", (STREAM)); \ - break; \ - case UNSPEC_CALLER: \ - { \ - char name[32]; \ - /* LPCS stands for Label for PIC Call Site. */ \ - ASM_GENERATE_INTERNAL_LABEL \ - (name, "LPCS", INTVAL (XVECEXP ((X), 0, 0))); \ - assemble_name ((STREAM), name); \ - } \ - break; \ - case UNSPEC_EXTRACT_S16: \ - case UNSPEC_EXTRACT_U16: \ - { \ - rtx val, shift; \ - \ - val = XVECEXP (X, 0, 0); \ - shift = XVECEXP (X, 0, 1); \ - fputc ('(', STREAM); \ - if (shift != const0_rtx) \ - fputc ('(', STREAM); \ - if (GET_CODE (val) == CONST \ - || GET_RTX_CLASS (GET_CODE (val)) != RTX_OBJ) \ - { \ - fputc ('(', STREAM); \ - output_addr_const (STREAM, val); \ - fputc (')', STREAM); \ - } \ - else \ - output_addr_const (STREAM, val); \ - if (shift != const0_rtx) \ - { \ - fputs (" >> ", STREAM); \ - output_addr_const (STREAM, shift); \ - fputc (')', STREAM); \ - } \ - fputs (" & 65535)", STREAM); \ - } \ - break; \ - case UNSPEC_SYMOFF: \ - output_addr_const (STREAM, XVECEXP (X, 0, 0)); \ - fputc ('-', STREAM); \ - if (GET_CODE (XVECEXP (X, 0, 1)) == CONST) \ - { \ - fputc ('(', STREAM); \ - output_addr_const (STREAM, XVECEXP (X, 0, 1)); \ - fputc (')', STREAM); \ - } \ - else \ - output_addr_const (STREAM, XVECEXP (X, 0, 1)); \ - break; \ - case UNSPEC_PCREL_SYMOFF: \ - output_addr_const (STREAM, XVECEXP (X, 0, 0)); \ - fputs ("-(", STREAM); \ - output_addr_const (STREAM, XVECEXP (X, 0, 1)); \ - fputs ("-.)", STREAM); \ - break; \ - default: \ - goto FAIL; \ - } \ - break; \ - } \ - else \ - goto FAIL; \ - while (0) - extern struct rtx_def *sh_compare_op0; extern struct rtx_def *sh_compare_op1; -- 2.30.2