This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
assertify mcore
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Nick Clifton <nickc at redhat dot com>
- Date: Fri, 06 May 2005 13:31:11 +0100
- Subject: assertify mcore
this patch assertifies the mcore target. I tested with i686 hosted
cross tools. The compiler builds, but newlib fails -- but it
fails without the patch too.
../../../../../../src/newlib/libc/stdlib/dtoa.c:854: error: unrecognizable insn:
(insn 168 167 169 18 ../../../../../../src/newlib/libc/stdlib/dtoa.c:287 (set (reg:SI 198)
(const:SI (plus:SI (symbol_ref/f:SI ("*.LC3") [flags 0x2] <string_cst 0x40240200>)
(const_int 1 [0x1])))) -1 (nil)
(nil))
../../../../../../src/newlib/libc/stdlib/dtoa.c:854: internal compiler error: in extract_insn, at recog.c:2082
That seems an unrelated failure. ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2005-05-06 Nathan Sidwell <nathan@codesourcery.com>
* 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.
Index: config/mcore/mcore.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mcore/mcore.c,v
retrieving revision 1.81
diff -c -3 -p -r1.81 mcore.c
*** config/mcore/mcore.c 28 Apr 2005 05:38:41 -0000 1.81
--- config/mcore/mcore.c 6 May 2005 12:26:09 -0000
*************** mcore_print_operand_address (FILE * stre
*** 309,317 ****
break;
default:
! debug_rtx (x);
!
! abort ();
}
}
--- 309,315 ----
break;
default:
! gcc_unreachable ();
}
}
*************** mcore_print_operand (FILE * stream, rtx
*** 370,376 ****
(stream, XEXP (adjust_address (x, SImode, 4), 0));
break;
default:
! abort ();
}
break;
case 'U':
--- 368,374 ----
(stream, XEXP (adjust_address (x, SImode, 4), 0));
break;
default:
! gcc_unreachable ();
}
break;
case 'U':
*************** mcore_gen_compare_reg (enum rtx_code cod
*** 598,615 ****
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;
! }
code = LEU;
/* Drop through. */
--- 596,607 ----
break;
case GTU: /* Use inverted condition, cmple. */
! /* 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. */
*************** mcore_output_call (rtx operands[], int i
*** 666,673 ****
{
if (TARGET_CG_DATA)
{
! if (mcore_current_function_name == 0)
! abort ();
ASM_OUTPUT_CG_EDGE (asm_out_file, mcore_current_function_name,
"unknown", 1);
--- 658,664 ----
{
if (TARGET_CG_DATA)
{
! gcc_assert (mcore_current_function_name);
ASM_OUTPUT_CG_EDGE (asm_out_file, mcore_current_function_name,
"unknown", 1);
*************** mcore_output_call (rtx operands[], int i
*** 679,691 ****
{
if (TARGET_CG_DATA)
{
! if (mcore_current_function_name == 0)
! abort ();
!
! if (GET_CODE (addr) != SYMBOL_REF)
! abort ();
! ASM_OUTPUT_CG_EDGE (asm_out_file, mcore_current_function_name, XSTR (addr, 0), 0);
}
sprintf (buffer, "jbsr\t%%%d", index);
--- 670,680 ----
{
if (TARGET_CG_DATA)
{
! 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);
}
sprintf (buffer, "jbsr\t%%%d", index);
*************** mcore_output_andn (rtx insn ATTRIBUTE_UN
*** 1094,1102 ****
rtx out_operands[3];
const char * load_op;
char buf[256];
! if (try_constant_tricks (INTVAL (operands[1]), &x, &y) != 2)
! abort ();
out_operands[0] = operands[0];
out_operands[1] = GEN_INT(x);
--- 1083,1092 ----
rtx out_operands[3];
const char * load_op;
char buf[256];
+ int trick;
! trick = try_constant_tricks (INTVAL (operands[1]), &x, &y);
! gcc_assert (trick == 2);
out_operands[0] = operands[0];
out_operands[1] = GEN_INT(x);
*************** output_inline_const (enum machine_mode m
*** 1136,1150 ****
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 ();
- }
if (trick_no == 1)
x = value;
--- 1126,1138 ----
int value;
value = INTVAL (operands[1]);
+ 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;
*************** mcore_output_move (rtx insn ATTRIBUTE_UN
*** 1252,1258 ****
case QImode:
return "ld.b\t%0,%1";
default:
! abort ();
}
}
else if (GET_CODE (src) == CONST_INT)
--- 1240,1246 ----
case QImode:
return "ld.b\t%0,%1";
default:
! gcc_unreachable ();
}
}
else if (GET_CODE (src) == CONST_INT)
*************** mcore_output_move (rtx insn ATTRIBUTE_UN
*** 1283,1292 ****
case QImode:
return "st.b\t%1,%0";
default:
! abort ();
}
! abort ();
}
/* Return a sequence of instructions to perform DI or DF move.
--- 1271,1280 ----
case QImode:
return "st.b\t%1,%0";
default:
! gcc_unreachable ();
}
! gcc_unreachable ();
}
/* Return a sequence of instructions to perform DI or DF move.
*************** mcore_output_movedouble (rtx operands[],
*** 1329,1338 ****
else if (GET_CODE (XEXP (memexp, 1)) == REG)
basereg = REGNO (XEXP (memexp, 1));
else
! abort ();
}
else
! abort ();
/* ??? length attribute is wrong here. */
if (dstreg == basereg)
--- 1317,1326 ----
else if (GET_CODE (XEXP (memexp, 1)) == REG)
basereg = REGNO (XEXP (memexp, 1));
else
! gcc_unreachable ();
}
else
! gcc_unreachable ();
/* ??? length attribute is wrong here. */
if (dstreg == basereg)
*************** mcore_output_movedouble (rtx operands[],
*** 1359,1365 ****
else if (CONST_OK_FOR_N (INTVAL (src)))
output_asm_insn ("bmaski %0,%N1", operands);
else
! abort ();
if (INTVAL (src) < 0)
return "bmaski %R0,32";
--- 1347,1353 ----
else if (CONST_OK_FOR_N (INTVAL (src)))
output_asm_insn ("bmaski %0,%N1", operands);
else
! gcc_unreachable ();
if (INTVAL (src) < 0)
return "bmaski %R0,32";
*************** mcore_output_movedouble (rtx operands[],
*** 1377,1383 ****
else if (CONST_OK_FOR_N (INTVAL (src)))
output_asm_insn ("bmaski %R0,%N1", operands);
else
! abort ();
if (INTVAL (src) < 0)
return "bmaski %0,32";
--- 1365,1371 ----
else if (CONST_OK_FOR_N (INTVAL (src)))
output_asm_insn ("bmaski %R0,%N1", operands);
else
! gcc_unreachable ();
if (INTVAL (src) < 0)
return "bmaski %0,32";
*************** mcore_output_movedouble (rtx operands[],
*** 1386,1397 ****
}
}
else
! abort ();
}
else if (GET_CODE (dst) == MEM && GET_CODE (src) == REG)
return "stw\t%1,%0\n\tstw\t%R1,%R0";
else
! abort ();
}
/* Predicates used by the templates. */
--- 1374,1385 ----
}
}
else
! gcc_unreachable ();
}
else if (GET_CODE (dst) == MEM && GET_CODE (src) == REG)
return "stw\t%1,%0\n\tstw\t%R1,%R0";
else
! gcc_unreachable ();
}
/* Predicates used by the templates. */
*************** mcore_expand_block_move (rtx *operands)
*** 1624,1630 ****
max = 4*1;
break;
default:
! abort ();
}
if (bytes <= max)
--- 1612,1618 ----
max = 4*1;
break;
default:
! gcc_unreachable ();
}
if (bytes <= max)
*************** layout_mcore_frame (struct mcore_frame *
*** 1859,1872 ****
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 ();
! }
! }
}
/* Define the offset between two registers, one to be eliminated, and
--- 1847,1853 ----
assert (growths <= MAX_STACK_GROWS);
for (i = 0; i < growths; i++)
! gcc_assert (!(infp->growth[i] % STACK_BYTES));
}
/* Define the offset between two registers, one to be eliminated, and
*************** mcore_initial_elimination_offset (int fr
*** 1895,1901 ****
if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
return below_frame;
! abort ();
return 0;
}
--- 1876,1882 ----
if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
return below_frame;
! gcc_unreachable ();
return 0;
}
*************** mcore_expand_prolog (void)
*** 1946,1958 ****
x = DECL_RTL (current_function_decl);
! if (GET_CODE (x) != MEM)
! abort ();
x = XEXP (x, 0);
! if (GET_CODE (x) != SYMBOL_REF)
! abort ();
if (mcore_current_function_name)
free (mcore_current_function_name);
--- 1927,1937 ----
x = DECL_RTL (current_function_decl);
! gcc_assert (GET_CODE (x) == MEM);
x = XEXP (x, 0);
! gcc_assert (GET_CODE (x) == SYMBOL_REF);
if (mcore_current_function_name)
free (mcore_current_function_name);
*************** mcore_mark_dllexport (tree decl)
*** 2866,2878 ****
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 (mcore_dllexport_name_p (oldname))
return; /* Already done. */
--- 2845,2854 ----
rtlname = XEXP (DECL_RTL (decl), 0);
! 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. */
*************** mcore_mark_dllimport (tree decl)
*** 2904,2920 ****
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 (mcore_dllexport_name_p (oldname))
! abort (); /* This shouldn't happen. */
! else if (mcore_dllimport_name_p (oldname))
return; /* Already done. */
/* ??? One can well ask why we're making these checks here,
--- 2880,2892 ----
rtlname = XEXP (DECL_RTL (decl), 0);
! if (GET_CODE (rtlname) == MEM)
! rtlname = XEXP (rtlname, 0);
! gcc_assert (GET_CODE (rtlname) == SYMBOL_REF);
! oldname = XSTR (rtlname, 0);
! 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,
Index: config/mcore/mcore.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mcore/mcore.h,v
retrieving revision 1.75
diff -c -3 -p -r1.75 mcore.h
*** config/mcore/mcore.h 28 Apr 2005 05:38:41 -0000 1.75
--- config/mcore/mcore.h 6 May 2005 12:26:14 -0000
*************** switch_to_section (enum in_section secti
*** 885,891 ****
case in_data: data_section (); break; \
case in_named: named_section (decl, NULL, 0); break; \
SUBTARGET_SWITCH_SECTIONS \
! default: abort (); break; \
} \
}
--- 885,891 ----
case in_data: data_section (); break; \
case in_named: named_section (decl, NULL, 0); break; \
SUBTARGET_SWITCH_SECTIONS \
! default: gcc_unreachable (); \
} \
}
Index: config/mcore/mcore.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mcore/mcore.md,v
retrieving revision 1.21
diff -c -3 -p -r1.21 mcore.md
*** config/mcore/mcore.md 4 Apr 2005 15:17:10 -0000 1.21
--- config/mcore/mcore.md 6 May 2005 12:26:20 -0000
***************
*** 384,390 ****
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 ();
}
}")
--- 384,390 ----
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: gcc_unreachable ();
}
}")
***************
*** 404,410 ****
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 ();
}
}")
--- 404,410 ----
case 1: return \"andi %0,%2\";
case 2: return \"and %0,%1\";
case 3: return mcore_output_bclri (operands[0], INTVAL (operands[2]));
! default: gcc_unreachable ();
}
}")
***************
*** 439,445 ****
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 ();
}
}")
--- 439,445 ----
case 0: return \"or %0,%2\";
case 1: return \"bseti %0,%P2\";
case 2: return mcore_output_bseti (operands[0], INTVAL (operands[2]));
! default: gcc_unreachable ();
}
}")
***************
*** 455,461 ****
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 ();
}
}")
--- 455,461 ----
case 0: return \"or %0,%2\";
case 1: return \"bseti %0,%P2\";
case 2: return mcore_output_bseti (operands[0], INTVAL (operands[2]));
! default: gcc_unreachable ();
}
}")
***************
*** 928,935 ****
&& INTVAL (operands[2]) > 0 && ! (INTVAL (operands[2]) & 0x80000000)"
"*
{
! if (GET_MODE (operands[2]) != SImode)
! abort ();
if (TARGET_LITTLE_END)
return \"addu %0,%2\;cmphs %0,%2\;incf %R0\";
return \"addu %R0,%2\;cmphs %R0,%2\;incf %0\";
--- 928,934 ----
&& INTVAL (operands[2]) > 0 && ! (INTVAL (operands[2]) & 0x80000000)"
"*
{
! 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,3078 ****
else if ((ofs = mcore_halfword_offset (INTVAL (operands[3]))) > -1)
mode = HImode;
else
! abort ();
if (ofs > 0)
operands[4] = gen_rtx_MEM (mode,
--- 3071,3077 ----
else if ((ofs = mcore_halfword_offset (INTVAL (operands[3]))) > -1)
mode = HImode;
else
! gcc_unreachable ();
if (ofs > 0)
operands[4] = gen_rtx_MEM (mode,
***************
*** 3148,3161 ****
return \"btsti %1,%2\\n\\tmovt %0,%4\";
}
! abort ();
}
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 \"\";
}")
--- 3147,3160 ----
return \"btsti %1,%2\\n\\tmovt %0,%4\";
}
! 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\";
! gcc_unreachable ();
return \"\";
}")