[committed] Convert config/mips to gcc_assert/unreachable
Richard Sandiford
rsandifo@redhat.com
Thu Sep 2 18:41:00 GMT 2004
Removes all uses of abort() in the mips backend. Some were just silly,
like checking whether the result of emit_call_insn() is a CALL_INSN,
so I just removed them rather than converting them.
Bootstrapped & regression tested on mips-sgi-irix6.5. Applied to mainline.
Richard
* config/mips/mips.c (mips_classify_symbol, mips_fetch_insns):
(mips_restore_gp, mips_set_return_address, mips_expand_prologue)
(mips16_fp_args, mips_avoid_hazard): Replace abort with gcc_assert.
(build_mips16_call_stub): Likewise. Remove daft CALL_INSN checks.
(mips_issue_rate): Remove unreachable abort.
(mips_symbolic_constant_p, mips_symbolic_address_p, mips_symbol_insns)
(mips_output_move, mips_relational_operand_ok_p, mips_arg_info)
(mips_block_move_straight, print_operand_address, mips_file_start)
(mips_initial_elimination_offset, mips16_fp_args, dump_constants_1)
(mips_output_conditional_branch, mips_expand_builtin_direct)
(mips_expand_builtin_compare): Replace abort with gcc_unreachable.
* config/mips/mips.md (rotr<mode>3, consttable_float): Replace abort
with gcc_assert.
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.464
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.464 mips.c
--- config/mips/mips.c 30 Aug 2004 18:31:03 -0000 1.464
+++ config/mips/mips.c 1 Sep 2004 20:58:57 -0000
@@ -810,8 +810,7 @@ mips_classify_symbol (rtx x)
return SYMBOL_GENERAL;
}
- if (GET_CODE (x) != SYMBOL_REF)
- abort ();
+ gcc_assert (GET_CODE (x) == SYMBOL_REF);
if (CONSTANT_POOL_ADDRESS_P (x))
{
@@ -973,7 +972,7 @@ mips_symbolic_constant_p (rtx x, enum mi
case SYMBOL_GOTOFF_LOADGP:
return false;
}
- abort ();
+ gcc_unreachable ();
}
@@ -1077,7 +1076,7 @@ mips_symbolic_address_p (enum mips_symbo
case SYMBOL_64_LOW:
return true;
}
- abort ();
+ gcc_unreachable ();
}
@@ -1204,7 +1203,7 @@ mips_symbol_insns (enum mips_symbol_type
/* Check whether the offset is a 16- or 32-bit value. */
return mips_split_p[type] ? 2 : 1;
}
- abort ();
+ gcc_unreachable ();
}
/* Return true if X is a legitimate $sp-based address for mode MDOE. */
@@ -1362,9 +1361,7 @@ mips_const_insns (rtx x)
int
mips_fetch_insns (rtx x)
{
- if (GET_CODE (x) != MEM)
- abort ();
-
+ gcc_assert (GET_CODE (x) == MEM);
return mips_address_insns (XEXP (x, 0), GET_MODE (x));
}
@@ -2407,7 +2404,7 @@ mips_output_move (rtx dest, rtx src)
retval[3] = COPNUM_AS_CHAR_FROM_REGNUM (REGNO (src));
return retval;
}
- abort ();
+ gcc_unreachable ();
}
/* Restore $gp from its save slot. Valid only when using o32 or
@@ -2418,8 +2415,7 @@ mips_restore_gp (void)
{
rtx address, slot;
- if (!TARGET_ABICALLS || !TARGET_OLDABI)
- abort ();
+ gcc_assert (TARGET_ABICALLS && TARGET_OLDABI);
address = mips_add_offset (pic_offset_table_rtx,
frame_pointer_needed
@@ -2469,7 +2465,7 @@ mips_relational_operand_ok_p (enum rtx_c
return sleu_operand (cmp1, VOIDmode);
default:
- abort ();
+ gcc_unreachable ();
}
}
@@ -2839,8 +2835,7 @@ mips_set_return_address (rtx address, rt
rtx slot_address;
compute_frame_size (get_frame_size ());
- if (((cfun->machine->frame.mask >> 31) & 1) == 0)
- abort ();
+ gcc_assert ((cfun->machine->frame.mask >> 31) & 1);
slot_address = mips_add_offset (scratch, stack_pointer_rtx,
cfun->machine->frame.gp_sp_offset);
@@ -2887,7 +2882,7 @@ mips_block_move_straight (rtx dest, rtx
{
rtx part = adjust_address (src, BLKmode, offset);
if (!mips_expand_unaligned_load (regs[i], part, bits, 0))
- abort ();
+ gcc_unreachable ();
}
}
@@ -2899,7 +2894,7 @@ mips_block_move_straight (rtx dest, rtx
{
rtx part = adjust_address (dest, BLKmode, offset);
if (!mips_expand_unaligned_store (part, regs[i], bits, 0))
- abort ();
+ gcc_unreachable ();
}
/* Mop up any left-over bytes. */
@@ -3115,7 +3110,7 @@ mips_arg_info (const CUMULATIVE_ARGS *cu
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* Now decide whether the argument must go in an even-numbered register.
@@ -4998,7 +4993,7 @@ print_operand_address (FILE *file, rtx x
output_addr_const (file, x);
return;
}
- abort ();
+ gcc_unreachable ();
}
/* When using assembler macros, keep track of all of small-data externs
@@ -5215,7 +5210,7 @@ mips_file_start (void)
case ABI_O64: abi_string = "abiO64"; break;
case ABI_EABI: abi_string = TARGET_64BIT ? "eabi64" : "eabi32"; break;
default:
- abort ();
+ gcc_unreachable ();
}
/* Note - we use fprintf directly rather than called named_section()
because in this way we can avoid creating an allocated section. We
@@ -5845,7 +5840,7 @@ mips_initial_elimination_offset (int fro
break;
default:
- abort ();
+ gcc_unreachable ();
}
if (TARGET_MIPS16 && to == HARD_FRAME_POINTER_REGNUM)
@@ -6155,9 +6150,7 @@ mips_expand_prologue (void)
from the stack pointer, so use the frame pointer as a
temporary. We should always be using a frame pointer
in this case anyway. */
- if (!frame_pointer_needed)
- abort ();
-
+ gcc_assert (frame_pointer_needed);
emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
emit_insn (gen_sub3_insn (hard_frame_pointer_rtx,
hard_frame_pointer_rtx,
@@ -7088,8 +7081,7 @@ mips16_fp_args (FILE *file, int fp_code,
unsigned int f;
/* This code only works for the original 32 bit ABI and the O64 ABI. */
- if (!TARGET_OLDABI)
- abort ();
+ gcc_assert (TARGET_OLDABI);
if (from_fp_p)
s = "mfc1";
@@ -7128,7 +7120,7 @@ mips16_fp_args (FILE *file, int fp_code,
}
}
else
- abort ();
+ gcc_unreachable ();
++gparg;
++fparg;
@@ -7285,13 +7277,12 @@ build_mips16_call_stub (rtx retval, rtx
/* This code will only work for o32 and o64 abis. The other ABI's
require more sophisticated support. */
- if (!TARGET_OLDABI)
- abort ();
+ gcc_assert (TARGET_OLDABI);
/* We can only handle SFmode and DFmode floating point return
values. */
- if (fpret && GET_MODE (retval) != SFmode && GET_MODE (retval) != DFmode)
- abort ();
+ if (fpret)
+ gcc_assert (GET_MODE (retval) == SFmode || GET_MODE (retval) == DFmode);
/* If we're calling via a function pointer, then we must always call
via a stub. There are magic stubs provided in libgcc.a for each
@@ -7324,8 +7315,6 @@ build_mips16_call_stub (rtx retval, rtx
insn = emit_call_insn (insn);
/* Put the register usage information on the CALL. */
- if (GET_CODE (insn) != CALL_INSN)
- abort ();
CALL_INSN_FUNCTION_USAGE (insn) =
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 2)),
@@ -7526,9 +7515,6 @@ build_mips16_call_stub (rtx retval, rtx
insn = gen_call_value_internal (retval, fn, arg_size);
insn = emit_call_insn (insn);
- if (GET_CODE (insn) != CALL_INSN)
- abort ();
-
CALL_INSN_FUNCTION_USAGE (insn) =
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_USE (VOIDmode, gen_rtx_REG (word_mode, 18)),
@@ -7648,7 +7634,7 @@ dump_constants_1 (enum machine_mode mode
}
default:
- abort ();
+ gcc_unreachable ();
}
}
@@ -8211,8 +8197,7 @@ mips_avoid_hazard (rtx after, rtx insn,
case HAZARD_DELAY:
set = single_set (insn);
- if (set == 0)
- abort ();
+ gcc_assert (set != 0);
*delayed_reg = SET_DEST (set);
break;
}
@@ -8706,7 +8691,7 @@ mips_output_conditional_branch (rtx insn
}
default:
- abort ();
+ gcc_unreachable ();
}
/* NOTREACHED */
@@ -9241,9 +9226,6 @@ mips_issue_rate (void)
default:
return 1;
}
-
- abort ();
-
}
/* Implements TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD. This should
@@ -9591,7 +9573,7 @@ mips_expand_builtin_direct (enum insn_co
break;
default:
- abort ();
+ gcc_unreachable ();
}
return target;
}
@@ -9665,7 +9647,7 @@ mips_expand_builtin_compare (enum mips_b
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* If the comparison sets more than one register, we define the result
Index: config/mips/mips.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.md,v
retrieving revision 1.299
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.299 mips.md
--- config/mips/mips.md 31 Aug 2004 06:54:42 -0000 1.299
+++ config/mips/mips.md 1 Sep 2004 20:59:03 -0000
@@ -4246,10 +4246,9 @@ (define_insn "rotr<mode>3"
(match_operand:SI 2 "arith_operand" "dI")))]
"ISA_HAS_ROTR_<MODE>"
{
- if ((GET_CODE (operands[2]) == CONST_INT)
- && (INTVAL (operands[2]) < 0
- || INTVAL (operands[2]) >= GET_MODE_BITSIZE (<MODE>mode)))
- abort ();
+ if (GET_CODE (operands[2]) == CONST_INT)
+ gcc_assert (INTVAL (operands[2]) >= 0
+ && INTVAL (operands[2]) < GET_MODE_BITSIZE (<MODE>mode));
return "<d>ror\t%0,%1,%2";
}
@@ -5453,8 +5452,7 @@ (define_insn "consttable_float"
{
REAL_VALUE_TYPE d;
- if (GET_CODE (operands[0]) != CONST_DOUBLE)
- abort ();
+ gcc_assert (GET_CODE (operands[0]) == CONST_DOUBLE);
REAL_VALUE_FROM_CONST_DOUBLE (d, operands[0]);
assemble_real (d, GET_MODE (operands[0]),
GET_MODE_BITSIZE (GET_MODE (operands[0])));
More information about the Gcc-patches
mailing list