From 954c74461753eae9270f0c489877fa7ea21a912b Mon Sep 17 00:00:00 2001 From: Joern Rennecke Date: Wed, 10 Nov 2010 09:16:19 +0000 Subject: [PATCH] re PR target/44760 (iq2000.md warnings) PR target/44760 * config/iq2000/iq2000.h (REGISTER_NAMES): Remove trailing semicolon. (REGNO_MODE_OK_FOR_BASE_P): Cast REGNO to int before passing it to GP_REG_OR_PSEUDO_STRICT_P. * config/iq2000/iq2000.md (andsi3+1): Add gcc_unreachable for unexpected alternative. (*movsf_internal): Likewise. (indirect_jump): Replace call to non-existant function with call to internal_error. (tablejump): Likewise. * config/iq2000/iq2000.c: Include df.h . (iq2000_function_arg_advance): Use CONST_CAST2. (compute_frame_size, iq2000_expand_prologue): Remove unused variables. (iq2000_can_eliminate): Call leaf_function_p instead of testing for a non-zero function address. (iq2000_initial_elimination_offset): Add gcc_unreachable for unexpected value of FROM. (symbolic_expression_p): Delete. (iq2000_function_value): Constify func. (expand_one_builtin): Use expand_normal. (iq2000_print_operand): Don't print VALUE if calculating it failed. From-SVN: r166523 --- gcc/ChangeLog | 24 +++++++++++++++++++++ gcc/config/iq2000/iq2000.c | 43 ++++++++++--------------------------- gcc/config/iq2000/iq2000.h | 4 ++-- gcc/config/iq2000/iq2000.md | 8 +++++-- 4 files changed, 43 insertions(+), 36 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df5195ce178b..d4218885a2d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +2010-11-10 Joern Rennecke + + PR target/44760 + * config/iq2000/iq2000.h (REGISTER_NAMES): Remove trailing semicolon. + (REGNO_MODE_OK_FOR_BASE_P): Cast REGNO to int before passing it to + GP_REG_OR_PSEUDO_STRICT_P. + * config/iq2000/iq2000.md (andsi3+1): Add gcc_unreachable for + unexpected alternative. + (*movsf_internal): Likewise. + (indirect_jump): Replace call to non-existant function with call to + internal_error. + (tablejump): Likewise. + * config/iq2000/iq2000.c: Include df.h . + (iq2000_function_arg_advance): Use CONST_CAST2. + (compute_frame_size, iq2000_expand_prologue): Remove unused variables. + (iq2000_can_eliminate): Call leaf_function_p instead of testing for + a non-zero function address. + (iq2000_initial_elimination_offset): Add gcc_unreachable for + unexpected value of FROM. + (symbolic_expression_p): Delete. + (iq2000_function_value): Constify func. + (expand_one_builtin): Use expand_normal. + (iq2000_print_operand): Don't print VALUE if calculating it failed. + 2010-11-10 Laurynas Biveinis PR/46268 diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 5661fd4eb8f5..5f9049dc82ac 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "target-def.h" #include "langhooks.h" +#include "df.h" /* Enumeration for all of the relational tests, so that we can build arrays indexed by the test type, and not worry about the order @@ -1150,7 +1151,7 @@ iq2000_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, "function_adv({gp reg found = %d, arg # = %2d, words = %2d}, %4s, ", cum->gp_reg_found, cum->arg_number, cum->arg_words, GET_MODE_NAME (mode)); - fprintf (stderr, "%p", (void *) type); + fprintf (stderr, "%p", CONST_CAST2 (void *, const_tree, type)); fprintf (stderr, ", %d )\n\n", named); } @@ -1632,8 +1633,6 @@ compute_frame_size (HOST_WIDE_INT size) HOST_WIDE_INT gp_reg_size; /* # bytes needed to store gp regs. */ HOST_WIDE_INT fp_reg_size; /* # bytes needed to store fp regs. */ long mask; /* mask of saved gp registers. */ - int fp_inc; /* 1 or 2 depending on the size of fp regs. */ - long fp_bits; /* bitmask to use for each fp register. */ gp_reg_size = 0; fp_reg_size = 0; @@ -1674,8 +1673,6 @@ compute_frame_size (HOST_WIDE_INT size) } } - fp_inc = 2; - fp_bits = 3; gp_reg_rounded = IQ2000_STACK_ALIGN (gp_reg_size); total_size += gp_reg_rounded + IQ2000_STACK_ALIGN (fp_reg_size); @@ -1730,7 +1727,7 @@ iq2000_can_eliminate (const int from, const int to) { return (from == RETURN_ADDRESS_POINTER_REGNUM && (! leaf_function_p () - || (to == GP_REG_FIRST + 31 && leaf_function_p))) + || (to == GP_REG_FIRST + 31 && leaf_function_p ()))) || (from != RETURN_ADDRESS_POINTER_REGNUM && (to == HARD_FRAME_POINTER_REGNUM || (to == STACK_POINTER_REGNUM @@ -1759,6 +1756,8 @@ iq2000_initial_elimination_offset (int from, int to ATTRIBUTE_UNUSED) + ((UNITS_PER_WORD - (POINTER_SIZE / BITS_PER_UNIT)) * (BYTES_BIG_ENDIAN != 0)); } + else + gcc_unreachable (); return offset; } @@ -2002,7 +2001,7 @@ iq2000_expand_prologue (void) for (i = 0; i < num; i++) { - rtx insn, pattern; + rtx pattern; pattern = RTVEC_ELT (adjust, i); if (GET_CODE (pattern) != SET @@ -2010,7 +2009,7 @@ iq2000_expand_prologue (void) abort_with_insn (pattern, "Insn is not a shift"); PUT_CODE (SET_SRC (pattern), ASHIFTRT); - insn = emit_insn (pattern); + emit_insn (pattern); } } @@ -2165,27 +2164,6 @@ iq2000_can_use_return_insn (void) return compute_frame_size (get_frame_size ()) == 0; } -/* Returns nonzero if X contains a SYMBOL_REF. */ - -static int -symbolic_expression_p (rtx x) -{ - if (GET_CODE (x) == SYMBOL_REF) - return 1; - - if (GET_CODE (x) == CONST) - return symbolic_expression_p (XEXP (x, 0)); - - if (UNARY_P (x)) - return symbolic_expression_p (XEXP (x, 0)); - - if (ARITHMETIC_P (x)) - return (symbolic_expression_p (XEXP (x, 0)) - || symbolic_expression_p (XEXP (x, 1))); - - return 0; -} - /* Choose the section to use for the constant rtx expression X that has mode MODE. */ @@ -2251,7 +2229,7 @@ iq2000_function_value (const_tree valtype, int reg = GP_RETURN; enum machine_mode mode = TYPE_MODE (valtype); int unsignedp = TYPE_UNSIGNED (valtype); - tree func = fn_decl_or_type; + const_tree func = fn_decl_or_type; if (fn_decl_or_type && !DECL_P (fn_decl_or_type)) @@ -2651,7 +2629,7 @@ expand_one_builtin (enum insn_code icode, rtx target, tree exp, for (i = 0; i < argcount; i++) { arg[i] = CALL_EXPR_ARG (exp, i); - op[i] = expand_expr (arg[i], NULL_RTX, VOIDmode, 0); + op[i] = expand_normal (arg[i]); mode[i] = insn_data[icode].operand[i].mode; if (code[i] == CONST_INT && GET_CODE (op[i]) != CONST_INT) error ("argument %qd is not a constant", i + 1); @@ -3198,7 +3176,8 @@ iq2000_print_operand (FILE *file, rtx op, int letter) if (code != CONST_INT || (value = exact_log2 (INTVAL (op))) < 0) output_operand_lossage ("invalid %%p value"); - fprintf (file, "%d", value); + else + fprintf (file, "%d", value); } else if (letter == 'Z') diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index 716be5b7a671..87ae17a5de42 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -509,7 +509,7 @@ typedef struct iq2000_args "%8", "%9", "%10", "%11", "%12", "%13", "%14", "%15", \ "%16", "%17", "%18", "%19", "%20", "%21", "%22", "%23", \ "%24", "%25", "%26", "%27", "%28", "%29", "%30", "%31", "%rap" \ -}; +} #define ADDITIONAL_REGISTER_NAMES \ { \ @@ -832,7 +832,7 @@ enum processor_type (((regno) >= FIRST_PSEUDO_REGISTER) || (BASE_REG_P ((regno), (mode)))) #define REGNO_MODE_OK_FOR_BASE_P(regno, mode) \ - GP_REG_OR_PSEUDO_STRICT_P ((regno), (mode)) + GP_REG_OR_PSEUDO_STRICT_P ((int) (regno), (mode)) /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. diff --git a/gcc/config/iq2000/iq2000.md b/gcc/config/iq2000/iq2000.md index 61275f2c6714..4552fc63a350 100644 --- a/gcc/config/iq2000/iq2000.md +++ b/gcc/config/iq2000/iq2000.md @@ -365,6 +365,8 @@ return \"andoi\\t%0,%1,%x2\"; } } + else + gcc_unreachable (); }" [(set_attr "type" "arith") (set_attr "mode" "SI")]) @@ -889,6 +891,8 @@ return \"lw\\t%0,%1\"; else if (which_alternative == 2) return \"sw\\t%1,%0\"; + else + gcc_unreachable (); }" [(set_attr "length" "4,4,4") (set_attr "type" "arith,load,store")] @@ -1340,7 +1344,7 @@ if (!(Pmode == DImode)) emit_jump_insn (gen_indirect_jump_internal1 (operands[0])); else - emit_jump_insn (gen_indirect_jump_internal2 (operands[0])); + internal_error (\"unimplemented functionality\"); DONE; } @@ -1367,7 +1371,7 @@ if (!(Pmode == DImode)) emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1])); else - emit_jump_insn (gen_tablejump_internal2 (operands[0], operands[1])); + internal_error (\"unimplemented functionality\"); DONE; }