From 6e1f65b5446d38f86db908b071d4b953f5c7d7da Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 6 May 2005 13:58:17 +0000 Subject: [PATCH] mcore.c (mcore_print_operand_address): Use gcc_assert and gcc_unreachable as appropriate. * config/mcore/mcore.c (mcore_print_operand_address): Use gcc_assert and gcc_unreachable as appropriate. (mcore_print_operand, mcore_gen_compare_reg, mcore_output_call, mcore_output_andn, output_inline_const, mcore_output_move, mcore_output_movedouble, mcore_expand_block_move, layout_mcore_frame, mcore_initial_elimination_offset, mcore_expand_prolog, mcore_mark_dllexport, mcore_mark_dllimport): Likewise. * config/mcore/mcore.h (switch_to_section): Likewise. * config/mcore/mcore.md: Likewise. From-SVN: r99315 --- gcc/ChangeLog | 13 +++++ gcc/config/mcore/mcore.c | 122 +++++++++++++++++----------------------------- gcc/config/mcore/mcore.h | 2 +- gcc/config/mcore/mcore.md | 18 +++---- 4 files changed, 68 insertions(+), 87 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f337197..ccb0ffa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2005-05-06 Nathan Sidwell + + * config/mcore/mcore.c (mcore_print_operand_address): Use + gcc_assert and gcc_unreachable as appropriate. + (mcore_print_operand, mcore_gen_compare_reg, mcore_output_call, + mcore_output_andn, output_inline_const, mcore_output_move, + mcore_output_movedouble, mcore_expand_block_move, + layout_mcore_frame, mcore_initial_elimination_offset, + mcore_expand_prolog, mcore_mark_dllexport, + mcore_mark_dllimport): Likewise. + * config/mcore/mcore.h (switch_to_section): Likewise. + * config/mcore/mcore.md: Likewise. + 2005-05-06 Aldy Hernandez * config/rs6000/linux64.h: Remove MASK_PROFILE_KERNEL, and diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 35f7a60..fff8a3e 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -309,9 +309,7 @@ mcore_print_operand_address (FILE * stream, rtx x) break; default: - debug_rtx (x); - - abort (); + gcc_unreachable (); } } @@ -370,7 +368,7 @@ mcore_print_operand (FILE * stream, rtx x, int code) (stream, XEXP (adjust_address (x, SImode, 4), 0)); break; default: - abort (); + gcc_unreachable (); } break; case 'U': @@ -598,18 +596,12 @@ mcore_gen_compare_reg (enum rtx_code code) break; case GTU: /* Use inverted condition, cmple. */ - if (GET_CODE (op1) == CONST_INT && INTVAL (op1) == 0) - { - /* Unsigned > 0 is the same as != 0, but we need - to invert the condition, so we want to set - code = EQ. This cannot be done however, as the - mcore does not support such a test. Instead we - cope with this case in the "bgtu" pattern itself - so we should never reach this point. */ - /* code = EQ; */ - abort (); - break; - } + /* Unsigned > 0 is the same as != 0, but we need to invert the + condition, so we want to set code = EQ. This cannot be done + however, as the mcore does not support such a test. Instead + we cope with this case in the "bgtu" pattern itself so we + should never reach this point. */ + gcc_assert (GET_CODE (op1) != CONST_INT || INTVAL (op1) != 0); code = LEU; /* Drop through. */ @@ -666,8 +658,7 @@ mcore_output_call (rtx operands[], int index) { if (TARGET_CG_DATA) { - if (mcore_current_function_name == 0) - abort (); + gcc_assert (mcore_current_function_name); ASM_OUTPUT_CG_EDGE (asm_out_file, mcore_current_function_name, "unknown", 1); @@ -679,13 +670,11 @@ mcore_output_call (rtx operands[], int index) { if (TARGET_CG_DATA) { - if (mcore_current_function_name == 0) - abort (); - - if (GET_CODE (addr) != SYMBOL_REF) - abort (); + gcc_assert (mcore_current_function_name); + gcc_assert (GET_CODE (addr) == SYMBOL_REF); - ASM_OUTPUT_CG_EDGE (asm_out_file, mcore_current_function_name, XSTR (addr, 0), 0); + ASM_OUTPUT_CG_EDGE (asm_out_file, mcore_current_function_name, + XSTR (addr, 0), 0); } sprintf (buffer, "jbsr\t%%%d", index); @@ -1094,9 +1083,10 @@ mcore_output_andn (rtx insn ATTRIBUTE_UNUSED, rtx operands[]) rtx out_operands[3]; const char * load_op; char buf[256]; + int trick_no; - if (try_constant_tricks (INTVAL (operands[1]), &x, &y) != 2) - abort (); + trick_no = try_constant_tricks (INTVAL (operands[1]), &x, &y); + gcc_assert (trick_no == 2); out_operands[0] = operands[0]; out_operands[1] = GEN_INT(x); @@ -1136,15 +1126,13 @@ output_inline_const (enum machine_mode mode, rtx operands[]) int value; value = INTVAL (operands[1]); - - if ((trick_no = try_constant_tricks (value, &x, &y)) == 0) - { - /* lrw's are handled separately: Large inlinable constants - never get turned into lrw's. Our caller uses try_constant_tricks - to back off to an lrw rather than calling this routine. */ - abort (); - } + trick_no = try_constant_tricks (value, &x, &y); + /* lrw's are handled separately: Large inlinable constants never get + turned into lrw's. Our caller uses try_constant_tricks to back + off to an lrw rather than calling this routine. */ + gcc_assert (trick_no != 0); + if (trick_no == 1) x = value; @@ -1252,7 +1240,7 @@ mcore_output_move (rtx insn ATTRIBUTE_UNUSED, rtx operands[], case QImode: return "ld.b\t%0,%1"; default: - abort (); + gcc_unreachable (); } } else if (GET_CODE (src) == CONST_INT) @@ -1283,10 +1271,10 @@ mcore_output_move (rtx insn ATTRIBUTE_UNUSED, rtx operands[], case QImode: return "st.b\t%1,%0"; default: - abort (); + gcc_unreachable (); } - abort (); + gcc_unreachable (); } /* Return a sequence of instructions to perform DI or DF move. @@ -1329,10 +1317,10 @@ mcore_output_movedouble (rtx operands[], enum machine_mode mode ATTRIBUTE_UNUSED else if (GET_CODE (XEXP (memexp, 1)) == REG) basereg = REGNO (XEXP (memexp, 1)); else - abort (); + gcc_unreachable (); } else - abort (); + gcc_unreachable (); /* ??? length attribute is wrong here. */ if (dstreg == basereg) @@ -1359,7 +1347,7 @@ mcore_output_movedouble (rtx operands[], enum machine_mode mode ATTRIBUTE_UNUSED else if (CONST_OK_FOR_N (INTVAL (src))) output_asm_insn ("bmaski %0,%N1", operands); else - abort (); + gcc_unreachable (); if (INTVAL (src) < 0) return "bmaski %R0,32"; @@ -1377,7 +1365,7 @@ mcore_output_movedouble (rtx operands[], enum machine_mode mode ATTRIBUTE_UNUSED else if (CONST_OK_FOR_N (INTVAL (src))) output_asm_insn ("bmaski %R0,%N1", operands); else - abort (); + gcc_unreachable (); if (INTVAL (src) < 0) return "bmaski %0,32"; @@ -1386,12 +1374,12 @@ mcore_output_movedouble (rtx operands[], enum machine_mode mode ATTRIBUTE_UNUSED } } else - abort (); + gcc_unreachable (); } else if (GET_CODE (dst) == MEM && GET_CODE (src) == REG) return "stw\t%1,%0\n\tstw\t%R1,%R0"; else - abort (); + gcc_unreachable (); } /* Predicates used by the templates. */ @@ -1624,7 +1612,7 @@ mcore_expand_block_move (rtx *operands) max = 4*1; break; default: - abort (); + gcc_unreachable (); } if (bytes <= max) @@ -1859,14 +1847,7 @@ layout_mcore_frame (struct mcore_frame * infp) assert (growths <= MAX_STACK_GROWS); for (i = 0; i < growths; i++) - { - if (infp->growth[i] % STACK_BYTES) - { - fprintf (stderr,"stack growth of %d is not %d aligned\n", - infp->growth[i], STACK_BYTES); - abort (); - } - } + gcc_assert (!(infp->growth[i] % STACK_BYTES)); } /* Define the offset between two registers, one to be eliminated, and @@ -1895,9 +1876,7 @@ mcore_initial_elimination_offset (int from, int to) if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM) return below_frame; - abort (); - - return 0; + gcc_unreachable (); } /* Keep track of some information about varargs for the prolog. */ @@ -1946,13 +1925,11 @@ mcore_expand_prolog (void) x = DECL_RTL (current_function_decl); - if (GET_CODE (x) != MEM) - abort (); + gcc_assert (GET_CODE (x) == MEM); x = XEXP (x, 0); - if (GET_CODE (x) != SYMBOL_REF) - abort (); + gcc_assert (GET_CODE (x) == SYMBOL_REF); if (mcore_current_function_name) free (mcore_current_function_name); @@ -2866,13 +2843,10 @@ mcore_mark_dllexport (tree decl) rtlname = XEXP (DECL_RTL (decl), 0); - if (GET_CODE (rtlname) == SYMBOL_REF) - oldname = XSTR (rtlname, 0); - else if ( GET_CODE (rtlname) == MEM - && GET_CODE (XEXP (rtlname, 0)) == SYMBOL_REF) - oldname = XSTR (XEXP (rtlname, 0), 0); - else - abort (); + if (GET_CODE (rtlname) == MEM) + rtlname = XEXP (rtlname, 0); + gcc_assert (GET_CODE (rtlname) == SYMBOL_REF); + oldname = XSTR (rtlname, 0); if (mcore_dllexport_name_p (oldname)) return; /* Already done. */ @@ -2904,17 +2878,13 @@ mcore_mark_dllimport (tree decl) rtlname = XEXP (DECL_RTL (decl), 0); - if (GET_CODE (rtlname) == SYMBOL_REF) - oldname = XSTR (rtlname, 0); - else if ( GET_CODE (rtlname) == MEM - && GET_CODE (XEXP (rtlname, 0)) == SYMBOL_REF) - oldname = XSTR (XEXP (rtlname, 0), 0); - else - abort (); + if (GET_CODE (rtlname) == MEM) + rtlname = XEXP (rtlname, 0); + gcc_assert (GET_CODE (rtlname) == SYMBOL_REF); + oldname = XSTR (rtlname, 0); - if (mcore_dllexport_name_p (oldname)) - abort (); /* This shouldn't happen. */ - else if (mcore_dllimport_name_p (oldname)) + gcc_assert (!mcore_dllexport_name_p (oldname)); + if (mcore_dllimport_name_p (oldname)) return; /* Already done. */ /* ??? One can well ask why we're making these checks here, diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index 61d154f..2e2d865 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -885,7 +885,7 @@ switch_to_section (enum in_section section, tree decl) \ case in_data: data_section (); break; \ case in_named: named_section (decl, NULL, 0); break; \ SUBTARGET_SWITCH_SECTIONS \ - default: abort (); break; \ + default: gcc_unreachable (); \ } \ } diff --git a/gcc/config/mcore/mcore.md b/gcc/config/mcore/mcore.md index 5515874..e79f80b 100644 --- a/gcc/config/mcore/mcore.md +++ b/gcc/config/mcore/mcore.md @@ -384,7 +384,7 @@ case 2: return \"and %0,%1\"; /* case -1: return \"bclri %0,%Q2\"; will not happen */ case 3: return mcore_output_bclri (operands[0], INTVAL (operands[2])); - default: abort (); + default: gcc_unreachable (); } }") @@ -404,7 +404,7 @@ case 1: return \"andi %0,%2\"; case 2: return \"and %0,%1\"; case 3: return mcore_output_bclri (operands[0], INTVAL (operands[2])); - default: abort (); + default: gcc_unreachable (); } }") @@ -439,7 +439,7 @@ case 0: return \"or %0,%2\"; case 1: return \"bseti %0,%P2\"; case 2: return mcore_output_bseti (operands[0], INTVAL (operands[2])); - default: abort (); + default: gcc_unreachable (); } }") @@ -455,7 +455,7 @@ case 0: return \"or %0,%2\"; case 1: return \"bseti %0,%P2\"; case 2: return mcore_output_bseti (operands[0], INTVAL (operands[2])); - default: abort (); + default: gcc_unreachable (); } }") @@ -928,8 +928,7 @@ && INTVAL (operands[2]) > 0 && ! (INTVAL (operands[2]) & 0x80000000)" "* { - if (GET_MODE (operands[2]) != SImode) - abort (); + gcc_assert (GET_MODE (operands[2]) == SImode); if (TARGET_LITTLE_END) return \"addu %0,%2\;cmphs %0,%2\;incf %R0\"; return \"addu %R0,%2\;cmphs %R0,%2\;incf %0\"; @@ -3072,7 +3071,7 @@ else if ((ofs = mcore_halfword_offset (INTVAL (operands[3]))) > -1) mode = HImode; else - abort (); + gcc_unreachable (); if (ofs > 0) operands[4] = gen_rtx_MEM (mode, @@ -3148,15 +3147,14 @@ return \"btsti %1,%2\\n\\tmovt %0,%4\"; } - abort (); + gcc_unreachable (); } else if (GET_CODE (operands[3]) == CONST_INT && INTVAL (operands[3]) == 0 && GET_CODE (operands[4]) == REG) return \"btsti %1,%2\\n\\tclrt %0\"; - abort (); - return \"\"; + gcc_unreachable (); }") ; experimental - do the constant folding ourselves. note that this isn't -- 2.7.4