diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-07 15:32:16 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-07 15:32:16 +0000 |
commit | 9623efd726a94c4420dcb768b2cf7556e68efb8a (patch) | |
tree | 6bfb605d839bf5fe26d60522b3aa46964992283c /gcc/config/v850 | |
parent | 6414dd4c704e0b7198da1506dd8d0b238ca77ec4 (diff) | |
download | gcc-9623efd726a94c4420dcb768b2cf7556e68efb8a.tar.gz |
* config/v850/v850.c (print_operand): Use gcc_assert and
gcc_unreachable, as appropriate.
(print_operand_address, v850_handle_data_area_attribute,
v850_encode_data_area, construct_restore_jr, construct_save_jarl,
v850_insert_attributes, construct_prepare_instruction): Likewise.
* config/v850/v850.h (INITIAL_ELIMINATION_OFFSET): Likewise.
* config/v850/v850.md (movsicc, *sasf_1): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99351 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/v850')
-rw-r--r-- | gcc/config/v850/v850.c | 229 | ||||
-rw-r--r-- | gcc/config/v850/v850.h | 2 | ||||
-rw-r--r-- | gcc/config/v850/v850.md | 43 |
3 files changed, 122 insertions, 152 deletions
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 01c3722a569..06e26db0e1e 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -518,30 +518,40 @@ print_operand (FILE * file, rtx x, int code) fprintf (file, "l"); break; default: - abort (); + gcc_unreachable (); } break; case 'F': /* high word of CONST_DOUBLE */ - if (GET_CODE (x) == CONST_INT) - fprintf (file, "%d", (INTVAL (x) >= 0) ? 0 : -1); - else if (GET_CODE (x) == CONST_DOUBLE) + switch (GET_CODE (x)) { + case CONST_INT: + fprintf (file, "%d", (INTVAL (x) >= 0) ? 0 : -1); + break; + + case CONST_DOUBLE: const_double_split (x, &high, &low); fprintf (file, "%ld", (long) high); + break; + + default: + gcc_unreachable (); } - else - abort (); break; case 'G': /* low word of CONST_DOUBLE */ - if (GET_CODE (x) == CONST_INT) - fprintf (file, "%ld", (long) INTVAL (x)); - else if (GET_CODE (x) == CONST_DOUBLE) + switch (GET_CODE (x)) { + case CONST_INT: + fprintf (file, "%ld", (long) INTVAL (x)); + break; + + case CONST_DOUBLE: const_double_split (x, &high, &low); fprintf (file, "%ld", (long) low); + break; + + default: + gcc_unreachable (); } - else - abort (); break; case 'L': fprintf (file, "%d\n", (int)(INTVAL (x) & 0xffff)); @@ -550,54 +560,42 @@ print_operand (FILE * file, rtx x, int code) fprintf (file, "%d", exact_log2 (INTVAL (x))); break; case 'O': - if (special_symbolref_operand (x, VOIDmode)) - { - if (GET_CODE (x) == SYMBOL_REF) - ; - else if (GET_CODE (x) == CONST) - x = XEXP (XEXP (x, 0), 0); - else - abort (); - - if (SYMBOL_REF_ZDA_P (x)) - fprintf (file, "zdaoff"); - else if (SYMBOL_REF_SDA_P (x)) - fprintf (file, "sdaoff"); - else if (SYMBOL_REF_TDA_P (x)) - fprintf (file, "tdaoff"); - else - abort (); - } + gcc_assert (special_symbolref_operand (x, VOIDmode)); + + if (GET_CODE (x) == CONST) + x = XEXP (XEXP (x, 0), 0); + else + gcc_assert (GET_CODE (x) == SYMBOL_REF); + + if (SYMBOL_REF_ZDA_P (x)) + fprintf (file, "zdaoff"); + else if (SYMBOL_REF_SDA_P (x)) + fprintf (file, "sdaoff"); + else if (SYMBOL_REF_TDA_P (x)) + fprintf (file, "tdaoff"); else - abort (); + gcc_unreachable (); break; case 'P': - if (special_symbolref_operand (x, VOIDmode)) - output_addr_const (file, x); - else - abort (); + gcc_assert (special_symbolref_operand (x, VOIDmode)); + output_addr_const (file, x); break; case 'Q': - if (special_symbolref_operand (x, VOIDmode)) - { - if (GET_CODE (x) == SYMBOL_REF) - ; - else if (GET_CODE (x) == CONST) - x = XEXP (XEXP (x, 0), 0); - else - abort (); - - if (SYMBOL_REF_ZDA_P (x)) - fprintf (file, "r0"); - else if (SYMBOL_REF_SDA_P (x)) - fprintf (file, "gp"); - else if (SYMBOL_REF_TDA_P (x)) - fprintf (file, "ep"); - else - abort (); - } + gcc_assert (special_symbolref_operand (x, VOIDmode)); + + if (GET_CODE (x) == CONST) + x = XEXP (XEXP (x, 0), 0); else - abort (); + gcc_assert (GET_CODE (x) == SYMBOL_REF); + + if (SYMBOL_REF_ZDA_P (x)) + fprintf (file, "r0"); + else if (SYMBOL_REF_SDA_P (x)) + fprintf (file, "gp"); + else if (SYMBOL_REF_TDA_P (x)) + fprintf (file, "ep"); + else + gcc_unreachable (); break; case 'R': /* 2nd word of a double. */ switch (GET_CODE (x)) @@ -636,7 +634,7 @@ print_operand (FILE * file, rtx x, int code) switch (GET_MODE (x)) { default: - abort (); + gcc_unreachable (); case QImode: fputs (".b", file); break; case HImode: fputs (".h", file); break; @@ -648,12 +646,13 @@ print_operand (FILE * file, rtx x, int code) fputs (reg_names[0], file); break; case 'z': /* reg or zero */ - if (x == const0_rtx) - fputs (reg_names[0], file); - else if (GET_CODE (x) == REG) + if (GET_CODE (x) == REG) fputs (reg_names[REGNO (x)], file); else - abort (); + { + gcc_assert (x == const0_rtx); + fputs (reg_names[0], file); + } break; default: switch (GET_CODE (x)) @@ -680,7 +679,7 @@ print_operand (FILE * file, rtx x, int code) print_operand_address (file, x); break; default: - abort (); + gcc_unreachable (); } break; @@ -779,7 +778,7 @@ print_operand_address (FILE * file, rtx addr) reg_name = "ep"; } else - abort (); + gcc_unreachable (); fprintf (file, "%s(", off_name); output_addr_const (file, addr); @@ -2131,7 +2130,7 @@ v850_handle_data_area_attribute (tree* node, else if (is_attribute_p ("zda", name)) data_area = DATA_AREA_ZDA; else - abort (); + gcc_unreachable (); switch (TREE_CODE (decl)) { @@ -2246,7 +2245,7 @@ v850_encode_data_area (tree decl, rtx symbol) case DATA_AREA_ZDA: flags |= SYMBOL_FLAG_ZDA; break; case DATA_AREA_TDA: flags |= SYMBOL_FLAG_TDA; break; case DATA_AREA_SDA: flags |= SYMBOL_FLAG_SDA; break; - default: abort (); + default: gcc_unreachable (); } SYMBOL_REF_FLAGS (symbol) = flags; } @@ -2285,12 +2284,9 @@ construct_restore_jr (rtx op) /* Work out how many bytes to pop off the stack before retrieving registers. */ - if (GET_CODE (XVECEXP (op, 0, 1)) != SET) - abort (); - if (GET_CODE (SET_SRC (XVECEXP (op, 0, 1))) != PLUS) - abort (); - if (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 1)), 1)) != CONST_INT) - abort (); + gcc_assert (GET_CODE (XVECEXP (op, 0, 1)) == SET); + gcc_assert (GET_CODE (SET_SRC (XVECEXP (op, 0, 1))) == PLUS); + gcc_assert (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 1)), 1)) == CONST_INT); stack_bytes = INTVAL (XEXP (SET_SRC (XVECEXP (op, 0, 1)), 1)); @@ -2310,12 +2306,10 @@ construct_restore_jr (rtx op) { rtx vector_element = XVECEXP (op, 0, i); - if (GET_CODE (vector_element) != SET) - abort (); - if (GET_CODE (SET_DEST (vector_element)) != REG) - abort (); - if (! register_is_ok_for_epilogue (SET_DEST (vector_element), SImode)) - abort (); + gcc_assert (GET_CODE (vector_element) == SET); + gcc_assert (GET_CODE (SET_DEST (vector_element)) == REG); + gcc_assert (register_is_ok_for_epilogue (SET_DEST (vector_element), + SImode)); mask |= 1 << REGNO (SET_DEST (vector_element)); } @@ -2327,24 +2321,19 @@ construct_restore_jr (rtx op) break; } - if (first >= 32) - abort (); + gcc_assert (first < 32); /* Discover the last register to pop. */ if (mask & (1 << LINK_POINTER_REGNUM)) { - if (stack_bytes != 16) - abort (); + gcc_assert (stack_bytes == 16); last = LINK_POINTER_REGNUM; } else { - if (stack_bytes != 0) - abort (); - - if ((mask & (1 << 29)) == 0) - abort (); + gcc_assert (!stack_bytes); + gcc_assert (mask & (1 << 29)); last = 29; } @@ -2401,14 +2390,10 @@ construct_save_jarl (rtx op) } /* Paranoia. */ - if (GET_CODE (XVECEXP (op, 0, 0)) != SET) - abort (); - if (GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != PLUS) - abort (); - if (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 0)) != REG) - abort (); - if (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 1)) != CONST_INT) - abort (); + gcc_assert (GET_CODE (XVECEXP (op, 0, 0)) == SET); + gcc_assert (GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) == PLUS); + gcc_assert (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 0)) == REG); + gcc_assert (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 1)) == CONST_INT); /* Work out how many bytes to push onto the stack after storing the registers. */ @@ -2430,12 +2415,10 @@ construct_save_jarl (rtx op) { rtx vector_element = XVECEXP (op, 0, i); - if (GET_CODE (vector_element) != SET) - abort (); - if (GET_CODE (SET_SRC (vector_element)) != REG) - abort (); - if (! register_is_ok_for_epilogue (SET_SRC (vector_element), SImode)) - abort (); + gcc_assert (GET_CODE (vector_element) == SET); + gcc_assert (GET_CODE (SET_SRC (vector_element)) == REG); + gcc_assert (register_is_ok_for_epilogue (SET_SRC (vector_element), + SImode)); mask |= 1 << REGNO (SET_SRC (vector_element)); } @@ -2447,23 +2430,19 @@ construct_save_jarl (rtx op) break; } - if (first >= 32) - abort (); + gcc_assert (first < 32); /* Discover the last register to push. */ if (mask & (1 << LINK_POINTER_REGNUM)) { - if (stack_bytes != -16) - abort (); + gcc_assert (stack_bytes == -16); last = LINK_POINTER_REGNUM; } else { - if (stack_bytes != 0) - abort (); - if ((mask & (1 << 29)) == 0) - abort (); + gcc_assert (!stack_bytes); + gcc_assert (mask & (1 << 29)); last = 29; } @@ -2642,7 +2621,7 @@ v850_insert_attributes (tree decl, tree * attr_ptr ATTRIBUTE_UNUSED ) switch (v850_get_data_area (decl)) { default: - abort (); + gcc_unreachable (); case DATA_AREA_SDA: kind = ((TREE_READONLY (decl)) @@ -2711,12 +2690,9 @@ construct_dispose_instruction (rtx op) /* Work out how many bytes to pop off the stack before retrieving registers. */ - if (GET_CODE (XVECEXP (op, 0, 1)) != SET) - abort (); - if (GET_CODE (SET_SRC (XVECEXP (op, 0, 1))) != PLUS) - abort (); - if (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 1)), 1)) != CONST_INT) - abort (); + gcc_assert (GET_CODE (XVECEXP (op, 0, 1)) == SET); + gcc_assert (GET_CODE (SET_SRC (XVECEXP (op, 0, 1))) == PLUS); + gcc_assert (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 1)), 1)) == CONST_INT); stack_bytes = INTVAL (XEXP (SET_SRC (XVECEXP (op, 0, 1)), 1)); @@ -2738,12 +2714,10 @@ construct_dispose_instruction (rtx op) { rtx vector_element = XVECEXP (op, 0, i); - if (GET_CODE (vector_element) != SET) - abort (); - if (GET_CODE (SET_DEST (vector_element)) != REG) - abort (); - if (! register_is_ok_for_epilogue (SET_DEST (vector_element), SImode)) - abort (); + gcc_assert (GET_CODE (vector_element) == SET); + gcc_assert (GET_CODE (SET_DEST (vector_element)) == REG); + gcc_assert (register_is_ok_for_epilogue (SET_DEST (vector_element), + SImode)); if (REGNO (SET_DEST (vector_element)) == 2) use_callt = 1; @@ -2837,12 +2811,9 @@ construct_prepare_instruction (rtx op) /* Work out how many bytes to push onto the stack after storing the registers. */ - if (GET_CODE (XVECEXP (op, 0, 0)) != SET) - abort (); - if (GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != PLUS) - abort (); - if (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 1)) != CONST_INT) - abort (); + gcc_assert (GET_CODE (XVECEXP (op, 0, 0)) == SET); + gcc_assert (GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) == PLUS); + gcc_assert (GET_CODE (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 1)) == CONST_INT); stack_bytes = INTVAL (XEXP (SET_SRC (XVECEXP (op, 0, 0)), 1)); @@ -2863,12 +2834,10 @@ construct_prepare_instruction (rtx op) { rtx vector_element = XVECEXP (op, 0, i); - if (GET_CODE (vector_element) != SET) - abort (); - if (GET_CODE (SET_SRC (vector_element)) != REG) - abort (); - if (! register_is_ok_for_epilogue (SET_SRC (vector_element), SImode)) - abort (); + gcc_assert (GET_CODE (vector_element) == SET); + gcc_assert (GET_CODE (SET_SRC (vector_element)) == REG); + gcc_assert (register_is_ok_for_epilogue (SET_SRC (vector_element), + SImode)); if (REGNO (SET_SRC (vector_element)) == 2) use_callt = 1; diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 8aefe036868..00b542bc77f 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -554,7 +554,7 @@ enum reg_class else if ((FROM) == ARG_POINTER_REGNUM) \ (OFFSET) = compute_frame_size (get_frame_size (), (long *)0); \ else \ - abort (); \ + gcc_unreachable (); \ } /* Keep the stack pointer constant throughout the function. */ diff --git a/gcc/config/v850/v850.md b/gcc/config/v850/v850.md index b4dd0285c8d..7a3e9d2652c 100644 --- a/gcc/config/v850/v850.md +++ b/gcc/config/v850/v850.md @@ -876,6 +876,7 @@ " { rtx insn = get_last_insn_anywhere (); + rtx src; if ( (GET_CODE (operands[2]) == CONST_INT && GET_CODE (operands[3]) == CONST_INT)) @@ -903,28 +904,28 @@ if (GET_CODE (operands[3]) != REG) operands[3] = copy_to_mode_reg (SImode, operands[3]); } - if (GET_CODE (insn) == INSN - && GET_CODE (PATTERN (insn)) == SET - && SET_DEST (PATTERN (insn)) == cc0_rtx) + gcc_assert (GET_CODE (insn) == INSN + && GET_CODE (PATTERN (insn)) == SET + && SET_DEST (PATTERN (insn)) == cc0_rtx); + + src = SET_SRC (PATTERN (insn)); + + switch (GET_CODE (src)) { - rtx src = SET_SRC (PATTERN (insn)); - - if (GET_CODE (src) == COMPARE) - { - operands[4] = XEXP (src, 0); - operands[5] = XEXP (src, 1); - } - else if (GET_CODE (src) == REG - || GET_CODE (src) == SUBREG) - { - operands[4] = src; - operands[5] = const0_rtx; - } - else - abort (); + case COMPARE: + operands[4] = XEXP (src, 0); + operands[5] = XEXP (src, 1); + break; + + case REG: + case SUBREG: + operands[4] = src; + operands[5] = const0_rtx; + break; + + default: + gcc_unreachable (); } - else - abort (); }") ;; ??? Clobbering the condition codes is overkill. @@ -1002,7 +1003,7 @@ (ashift:SI (match_operand:SI 2 "register_operand" "") (const_int 1))))] "TARGET_V850E" - "* abort ();") + "* gcc_unreachable ();") (define_insn "*sasf_2" [(set (match_operand:SI 0 "register_operand" "=r") |