This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
assertify cris
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, hp at axis dot com
- Date: Fri, 29 Apr 2005 14:09:56 +0100
- Subject: assertify cris
This patch assertifies the cris target files. I built an i86 hosted
cris-none-elf cross compiler and used that to build newlib (this time
it didn't ICE :). There's not cris simulator, so I couldn't check more
than that. ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2005-04-29 Nathan Sidwell <nathan@codesourcery.com>
* config/cris/cris.c (ASSERT_PLT_UNSPEC): Use gcc_assert and
gcc_unreachable as appropriate.
(cris_op_str, cris_print_operand, cris_initial_elimination_offset,
cris_notice_update_cc, cris_expand_return, cris_gotless_symbol,
cris_got_symbol, cris_split_movdx, cris_expand_prologue,
cris_expand_epilogue, cris_gen_movem_load, cris_emit_movem_store,
cris_asm_output_symbol_ref, cris_output_addr_const_extra): Likewise.
* config/cris/cris.md (movsi, *movsi_internal, call,
call_value): Likewise.
Index: config/cris/cris.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.c,v
retrieving revision 1.74
diff -c -3 -p -r1.74 cris.c
*** config/cris/cris.c 23 Apr 2005 21:28:19 -0000 1.74
--- config/cris/cris.c 29 Apr 2005 12:51:47 -0000
*************** Boston, MA 02111-1307, USA. */
*** 52,64 ****
((size) <= 63 ? "q" : (size) <= 255 ? "u.b" : (size) <= 65535 ? "u.w" : ".d")
#define ASSERT_PLT_UNSPEC(x) \
! do \
! { \
! if (XINT (x, 1) != CRIS_UNSPEC_PLT \
! || (GET_CODE (XVECEXP (x, 0, 0)) != SYMBOL_REF \
! && GET_CODE (XVECEXP (x, 0, 0)) != LABEL_REF)) \
! abort (); \
! } while (0)
#define LOSE_AND_RETURN(msgid, x) \
do \
--- 52,60 ----
((size) <= 63 ? "q" : (size) <= 255 ? "u.b" : (size) <= 65535 ? "u.w" : ".d")
#define ASSERT_PLT_UNSPEC(x) \
! gcc_assert (XINT (x, 1) == CRIS_UNSPEC_PLT \
! && (GET_CODE (XVECEXP (x, 0, 0)) == SYMBOL_REF \
! || GET_CODE (XVECEXP (x, 0, 0)) == LABEL_REF));
#define LOSE_AND_RETURN(msgid, x) \
do \
*************** cris_op_str (rtx x)
*** 448,454 ****
an operator, for immediate output. If that ever happens for
MULT, we need to apply TARGET_MUL_BUG in the caller. Make sure
we notice. */
! abort ();
break;
case DIV:
--- 444,450 ----
an operator, for immediate output. If that ever happens for
MULT, we need to apply TARGET_MUL_BUG in the caller. Make sure
we notice. */
! gcc_unreachable ();
break;
case DIV:
*************** cris_print_operand (FILE *file, rtx x, i
*** 809,815 ****
case 'z':
/* Const_int: print b for -127 <= x <= 255,
! w for -32768 <= x <= 65535, else abort. */
if (GET_CODE (x) != CONST_INT
|| INTVAL (x) < -32768 || INTVAL (x) > 65535)
LOSE_AND_RETURN ("invalid operand for 'z' modifier", x);
--- 805,811 ----
case 'z':
/* Const_int: print b for -127 <= x <= 255,
! w for -32768 <= x <= 65535, else die. */
if (GET_CODE (x) != CONST_INT
|| INTVAL (x) < -32768 || INTVAL (x) > 65535)
LOSE_AND_RETURN ("invalid operand for 'z' modifier", x);
*************** cris_initial_elimination_offset (int fro
*** 1217,1223 ****
&& toreg == STACK_POINTER_REGNUM)
return ap_fp_offset + fp_sp_offset - 4;
! abort ();
}
/* This function looks into the pattern to see how this insn affects
--- 1213,1219 ----
&& toreg == STACK_POINTER_REGNUM)
return ap_fp_offset + fp_sp_offset - 4;
! gcc_unreachable ();
}
/* This function looks into the pattern to see how this insn affects
*************** cris_notice_update_cc (rtx exp, rtx insn
*** 1482,1488 ****
default:
/* Unknown cc_attr value. */
! abort ();
}
CC_STATUS_INIT;
--- 1478,1484 ----
default:
/* Unknown cc_attr value. */
! gcc_unreachable ();
}
CC_STATUS_INIT;
*************** cris_expand_return (bool on_stack)
*** 1534,1542 ****
to check that it doesn't change half-way through. */
emit_jump_insn (gen_rtx_RETURN (VOIDmode));
! if ((cfun->machine->return_type == CRIS_RETINSN_RET && on_stack)
! || (cfun->machine->return_type == CRIS_RETINSN_JUMP && !on_stack))
! abort ();
cfun->machine->return_type
= on_stack ? CRIS_RETINSN_JUMP : CRIS_RETINSN_RET;
--- 1530,1537 ----
to check that it doesn't change half-way through. */
emit_jump_insn (gen_rtx_RETURN (VOIDmode));
! gcc_assert (cfun->machine->return_type != CRIS_RETINSN_RET || !on_stack);
! gcc_assert (cfun->machine->return_type != CRIS_RETINSN_JUMP || on_stack);
cfun->machine->return_type
= on_stack ? CRIS_RETINSN_JUMP : CRIS_RETINSN_RET;
*************** cris_symbol (rtx x)
*** 1934,1943 ****
int
cris_gotless_symbol (rtx x)
{
! #ifdef ENABLE_CHECKING
! if (!flag_pic)
! abort ();
! #endif
switch (GET_CODE (x))
{
--- 1929,1935 ----
int
cris_gotless_symbol (rtx x)
{
! gcc_assert (flag_pic);
switch (GET_CODE (x))
{
*************** cris_gotless_symbol (rtx x)
*** 1997,2006 ****
int
cris_got_symbol (rtx x)
{
! #ifdef ENABLE_CHECKING
! if (!flag_pic)
! abort ();
! #endif
switch (GET_CODE (x))
{
--- 1989,1995 ----
int
cris_got_symbol (rtx x)
{
! gcc_assert (flag_pic);
switch (GET_CODE (x))
{
*************** cris_split_movdx (rtx *operands)
*** 2321,2328 ****
/* We used to have to handle (SUBREG (MEM)) here, but that should no
longer happen; after reload there are no SUBREGs any more, and we're
only called after reload. */
! if (GET_CODE (dest) == SUBREG || GET_CODE (src) == SUBREG)
! abort ();
start_sequence ();
if (GET_CODE (dest) == REG)
--- 2310,2316 ----
/* We used to have to handle (SUBREG (MEM)) here, but that should no
longer happen; after reload there are no SUBREGs any more, and we're
only called after reload. */
! gcc_assert (GET_CODE (dest) != SUBREG && GET_CODE (src) != SUBREG);
start_sequence ();
if (GET_CODE (dest) == REG)
*************** cris_split_movdx (rtx *operands)
*** 2413,2419 ****
}
}
else
! abort ();
}
/* Reg-to-mem copy or clear mem. */
else if (GET_CODE (dest) == MEM
--- 2401,2407 ----
}
}
else
! gcc_unreachable ();
}
/* Reg-to-mem copy or clear mem. */
else if (GET_CODE (dest) == MEM
*************** cris_split_movdx (rtx *operands)
*** 2455,2461 ****
}
else
! abort ();
val = get_insns ();
end_sequence ();
--- 2443,2449 ----
}
else
! gcc_unreachable ();
val = get_insns ();
end_sequence ();
*************** cris_expand_prologue (void)
*** 2483,2490 ****
if (!TARGET_PROLOGUE_EPILOGUE)
return;
! if (size < 0)
! abort ();
/* Align the size to what's best for the CPU model. */
if (TARGET_STACK_ALIGN)
--- 2471,2477 ----
if (!TARGET_PROLOGUE_EPILOGUE)
return;
! gcc_assert (size >= 0);
/* Align the size to what's best for the CPU model. */
if (TARGET_STACK_ALIGN)
*************** cris_expand_epilogue (void)
*** 2745,2753 ****
int pretend = current_function_pretend_args_size;
rtx mem;
bool return_address_on_stack = cris_return_address_on_stack ();
! /* A reference may have been optimized out
! (like the abort () in fde_split in unwind-dw2-fde.c, at least 3.2.1)
! so check that it's still used. */
int got_really_used = current_function_uses_pic_offset_table;
int n_movem_regs = 0;
--- 2732,2739 ----
int pretend = current_function_pretend_args_size;
rtx mem;
bool return_address_on_stack = cris_return_address_on_stack ();
! /* A reference may have been optimized out so check that it's still
! used. */
int got_really_used = current_function_uses_pic_offset_table;
int n_movem_regs = 0;
*************** cris_gen_movem_load (rtx src, rtx nregs_
*** 2931,2938 ****
if (GET_CODE (srcreg) == POST_INC)
srcreg = XEXP (srcreg, 0);
! if (!REG_P (srcreg))
! abort ();
/* Don't use movem for just one insn. The insns are equivalent except
for the pipeline hazard (on v32); movem does not forward the loaded
--- 2917,2923 ----
if (GET_CODE (srcreg) == POST_INC)
srcreg = XEXP (srcreg, 0);
! gcc_assert (REG_P (srcreg));
/* Don't use movem for just one insn. The insns are equivalent except
for the pipeline hazard (on v32); movem does not forward the loaded
*************** cris_emit_movem_store (rtx dest, rtx nre
*** 2988,2995 ****
if (GET_CODE (destreg) == POST_INC || GET_CODE (destreg) == PLUS)
destreg = XEXP (destreg, 0);
! if (!REG_P (destreg))
! abort ();
/* Don't use movem for just one insn. The insns are equivalent except
for the pipeline hazard (on v32); movem does not forward the loaded
--- 2973,2979 ----
if (GET_CODE (destreg) == POST_INC || GET_CODE (destreg) == PLUS)
destreg = XEXP (destreg, 0);
! gcc_assert (REG_P (destreg));
/* Don't use movem for just one insn. The insns are equivalent except
for the pipeline hazard (on v32); movem does not forward the loaded
*************** cris_asm_output_symbol_ref (FILE *file,
*** 3130,3137 ****
}
else if (cris_got_symbol (x))
{
! if (cris_pic_sympart_only)
! abort ();
fprintf (file, "[$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
assemble_name (file, XSTR (x, 0));
--- 3114,3120 ----
}
else if (cris_got_symbol (x))
{
! gcc_assert (!cris_pic_sympart_only);
fprintf (file, "[$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
assemble_name (file, XSTR (x, 0));
*************** cris_output_addr_const_extra (FILE *file
*** 3194,3202 ****
}
else
{
! if (TARGET_AVOID_GOTPLT)
! /* We shouldn't get here. */
! abort ();
fprintf (file, "[$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
assemble_name (file, XSTR (x, 0));
--- 3177,3183 ----
}
else
{
! gcc_assert (!TARGET_AVOID_GOTPLT);
fprintf (file, "[$%s+", reg_names [PIC_OFFSET_TABLE_REGNUM]);
assemble_name (file, XSTR (x, 0));
Index: config/cris/cris.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.md,v
retrieving revision 1.31
diff -c -3 -p -r1.31 cris.md
*** config/cris/cris.md 20 Apr 2005 22:31:29 -0000 1.31
--- config/cris/cris.md 29 Apr 2005 12:51:55 -0000
***************
*** 975,982 ****
do, and for the patterns we generate. */
if (! REG_S_P (operands[0]))
{
! if (no_new_pseudos)
! abort ();
operands[1] = force_reg (SImode, operands[1]);
}
else
--- 975,981 ----
do, and for the patterns we generate. */
if (! REG_S_P (operands[0]))
{
! gcc_assert (!no_new_pseudos);
operands[1] = force_reg (SImode, operands[1]);
}
else
***************
*** 1002,1018 ****
PIC symbols both with and without a GOT entry. And ``sym
+ offset'' is ok for local symbols, so the only thing it
could be, is a global symbol with an offset. Check and
! abort if not. */
rtx sym = get_related_value (operands[1]);
HOST_WIDE_INT offs = get_integer_term (operands[1]);
! if (sym == NULL_RTX || offs == 0)
! abort ();
emit_move_insn (operands[0], sym);
! if (expand_binop (SImode, add_optab, operands[0],
! GEN_INT (offs), operands[0], 0,
! OPTAB_LIB_WIDEN) != operands[0])
! abort ();
DONE;
}
}
--- 1001,1017 ----
PIC symbols both with and without a GOT entry. And ``sym
+ offset'' is ok for local symbols, so the only thing it
could be, is a global symbol with an offset. Check and
! die if not. */
rtx sym = get_related_value (operands[1]);
HOST_WIDE_INT offs = get_integer_term (operands[1]);
+ rtx expn;
! gcc_assert (sym && offs);
emit_move_insn (operands[0], sym);
! expn = expand_binop (SImode, add_optab, operands[0],
! GEN_INT (offs), operands[0], 0,
! OPTAB_LIB_WIDEN);
! gcc_assert (expn == operands[0]);
DONE;
}
}
***************
*** 1092,1099 ****
/* We clobber cc0 rather than set it to GOT. Should not
matter, though. */
CC_STATUS_INIT;
! if (REGNO (operands[0]) != PIC_OFFSET_TABLE_REGNUM)
! abort ();
return \"move.d $pc,%0\;sub.d .:GOTOFF,%0\";
}
--- 1091,1097 ----
/* We clobber cc0 rather than set it to GOT. Should not
matter, though. */
CC_STATUS_INIT;
! gcc_assert (REGNO (operands[0]) == PIC_OFFSET_TABLE_REGNUM);
return \"move.d $pc,%0\;sub.d .:GOTOFF,%0\";
}
***************
*** 3924,3943 ****
{
rtx op0;
! if (GET_CODE (operands[0]) != MEM)
! abort ();
if (flag_pic)
{
op0 = XEXP (operands[0], 0);
/* It might be that code can be generated that jumps to 0 (or to a
! specific address). Don't abort on that. At least there's a
testcase. */
if (CONSTANT_ADDRESS_P (op0) && GET_CODE (op0) != CONST_INT)
{
! if (no_new_pseudos)
! abort ();
/* For local symbols (non-PLT), get the plain symbol reference
into a register. For symbols that can be PLT, make them PLT. */
--- 3922,3939 ----
{
rtx op0;
! gcc_assert (GET_CODE (operands[0]) == MEM);
if (flag_pic)
{
op0 = XEXP (operands[0], 0);
/* It might be that code can be generated that jumps to 0 (or to a
! specific address). Don't die on that. At least there's a
testcase. */
if (CONSTANT_ADDRESS_P (op0) && GET_CODE (op0) != CONST_INT)
{
! gcc_assert (!no_new_pseudos);
/* For local symbols (non-PLT), get the plain symbol reference
into a register. For symbols that can be PLT, make them PLT. */
***************
*** 3953,3959 ****
gen_rtvec (1, op0),
CRIS_UNSPEC_PLT)));
else
! abort ();
operands[0] = replace_equiv_address (operands[0], op0);
}
--- 3949,3955 ----
gen_rtvec (1, op0),
CRIS_UNSPEC_PLT)));
else
! gcc_unreachable ();
operands[0] = replace_equiv_address (operands[0], op0);
}
***************
*** 3991,4010 ****
{
rtx op1;
! if (GET_CODE (operands[1]) != MEM)
! abort ();
if (flag_pic)
{
op1 = XEXP (operands[1], 0);
/* It might be that code can be generated that jumps to 0 (or to a
! specific address). Don't abort on that. At least there's a
testcase. */
if (CONSTANT_ADDRESS_P (op1) && GET_CODE (op1) != CONST_INT)
{
! if (no_new_pseudos)
! abort ();
if (cris_gotless_symbol (op1))
op1 = force_reg (Pmode, op1);
--- 3987,4004 ----
{
rtx op1;
! gcc_assert (GET_CODE (operands[1]) == MEM);
if (flag_pic)
{
op1 = XEXP (operands[1], 0);
/* It might be that code can be generated that jumps to 0 (or to a
! specific address). Don't die on that. At least there's a
testcase. */
if (CONSTANT_ADDRESS_P (op1) && GET_CODE (op1) != CONST_INT)
{
! gcc_assert (!no_new_pseudos);
if (cris_gotless_symbol (op1))
op1 = force_reg (Pmode, op1);
***************
*** 4018,4024 ****
gen_rtvec (1, op1),
CRIS_UNSPEC_PLT)));
else
! abort ();
operands[1] = replace_equiv_address (operands[1], op1);
}
--- 4012,4018 ----
gen_rtvec (1, op1),
CRIS_UNSPEC_PLT)));
else
! gcc_unreachable ();
operands[1] = replace_equiv_address (operands[1], op1);
}