This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

assertify pdp11


This patch assertifies the pdp11 target.  I built i686 hosted binutils
and cross compiler, but I cannot build newlib, as that does not support
pdp11.  There aren't many aborts in the pdp backend.

ok?

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-05-09  Nathan Sidwell  <nathan@codesourcery.com>

	* config/pdp11/pdp11.c (pdp11_output_function_prologue): Use
	gcc_assert and gcc_unreachable as appropriate.
	(pdp11_output_function_epilogue, output_move_double,
	output_move_quad, print_operand_address, output_jump,
	output_addr_const_pdp11): Likewise.
	* config/pdp11/pdp11.h (FUNCTION_PROFILER,
	ASM_OUTPUT_ALIGN): Likewise.
	* config/pdp11/pdp11.md: Likewise.
	(extendhisi2, subhi3, subqi3): Likewise.

Index: config/pdp11/pdp11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pdp11/pdp11.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 pdp11.c
*** config/pdp11/pdp11.c	28 Apr 2005 05:38:45 -0000	1.43
--- config/pdp11/pdp11.c	9 May 2005 11:55:43 -0000
*************** pdp11_output_function_prologue (FILE *st
*** 315,325 ****
  	    && regs_ever_live[regno]
  	    && ! call_used_regs[regno])
  	{
! 	    if (via_ac == -1)
! 		abort();
! 	    
! 	    fprintf (stream, "\tldd %s, %s\n", reg_names[regno], reg_names[via_ac]);
! 	    fprintf (stream, "\tstd %s, -(sp)\n", reg_names[via_ac]);
  	}
      }
  
--- 315,324 ----
  	    && regs_ever_live[regno]
  	    && ! call_used_regs[regno])
  	{
! 	  gcc_assert (via_ac != -1);
! 	  fprintf (stream, "\tldd %s, %s\n",
! 		   reg_names[regno], reg_names[via_ac]);
! 	  fprintf (stream, "\tstd %s, -(sp)\n", reg_names[via_ac]);
  	}
      }
  
*************** pdp11_output_function_epilogue (FILE *st
*** 410,417 ****
  		&& regs_ever_live[i]
  		&& ! call_used_regs[i])
  	    {
! 		if (! LOAD_FPU_REG_P(via_ac))
! 		    abort();
  		    
  		fprintf(stream, "\tldd %#o(r5), %s\n", (-fsize-k)&0xffff, reg_names[via_ac]);
  		fprintf(stream, "\tstd %s, %s\n", reg_names[via_ac], reg_names[i]);
--- 409,415 ----
  		&& regs_ever_live[i]
  		&& ! call_used_regs[i])
  	    {
! 	        gcc_assert (LOAD_FPU_REG_P(via_ac));
  		    
  		fprintf(stream, "\tldd %#o(r5), %s\n", (-fsize-k)&0xffff, reg_names[via_ac]);
  		fprintf(stream, "\tstd %s, %s\n", reg_names[via_ac], reg_names[i]);
*************** pdp11_output_function_epilogue (FILE *st
*** 442,449 ****
  		&& regs_ever_live[i]
  		&& ! call_used_regs[i])
  	    {
! 		if (! LOAD_FPU_REG_P(via_ac))
! 		    abort();
  		    
  		fprintf(stream, "\tldd (sp)+, %s\n", reg_names[via_ac]);
  		fprintf(stream, "\tstd %s, %s\n", reg_names[via_ac], reg_names[i]);
--- 440,446 ----
  		&& regs_ever_live[i]
  		&& ! call_used_regs[i])
  	    {
! 	        gcc_assert (LOAD_FPU_REG_P(via_ac));
  		    
  		fprintf(stream, "\tldd (sp)+, %s\n", reg_names[via_ac]);
  		fprintf(stream, "\tstd %s, %s\n", reg_names[via_ac], reg_names[i]);
*************** output_move_double (rtx *operands)
*** 524,531 ****
       supposed to allow to happen.  Abort if we get one,
       because generating code for these cases is painful.  */
  
!   if (optype0 == RNDOP || optype1 == RNDOP)
!     abort ();
  
    /* If one operand is decrementing and one is incrementing
       decrement the former register explicitly
--- 521,527 ----
       supposed to allow to happen.  Abort if we get one,
       because generating code for these cases is painful.  */
  
!   gcc_assert (optype0 != RNDOP && optype1 != RNDOP);
  
    /* If one operand is decrementing and one is incrementing
       decrement the former register explicitly
*************** output_move_double (rtx *operands)
*** 585,595 ****
  	    latehalf[1] = GEN_INT (INTVAL(operands[1]) >> 16);
  	    operands[1] = GEN_INT (INTVAL(operands[1]) & 0xff);
  	}
!       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
! 	{
! 	    /* immediate 32 bit values not allowed */
! 	    abort();
! 	}
      }
    else
      latehalf[1] = operands[1];
--- 581,589 ----
  	    latehalf[1] = GEN_INT (INTVAL(operands[1]) >> 16);
  	    operands[1] = GEN_INT (INTVAL(operands[1]) & 0xff);
  	}
! 	else
! 	  /* immediate 32 bit values not allowed */
! 	  gcc_assert (GET_CODE (operands[1]) != CONST_DOUBLE);
      }
    else
      latehalf[1] = operands[1];
*************** output_move_quad (rtx *operands)
*** 699,713 ****
       supposed to allow to happen.  Abort if we get one,
       because generating code for these cases is painful.  */
  
!   if (optype0 == RNDOP || optype1 == RNDOP)
!     abort ();
    
    /* check if we move a CPU reg to an FPU reg, or vice versa! */
    if (optype0 == REGOP && optype1 == REGOP)
        /* bogus - 64 bit cannot reside in CPU! */
!       if (CPU_REG_P(REGNO(operands[0]))
! 	  || CPU_REG_P (REGNO(operands[1])))
! 	  abort();
    
    if (optype0 == REGOP || optype1 == REGOP)
    {
--- 693,705 ----
       supposed to allow to happen.  Abort if we get one,
       because generating code for these cases is painful.  */
  
!   gcc_assert (optype0 != RNDOP && optype1 != RNDOP);
    
    /* check if we move a CPU reg to an FPU reg, or vice versa! */
    if (optype0 == REGOP && optype1 == REGOP)
        /* bogus - 64 bit cannot reside in CPU! */
!       gcc_assert (!CPU_REG_P(REGNO(operands[0]))
! 		  && !CPU_REG_P (REGNO(operands[1])));
    
    if (optype0 == REGOP || optype1 == REGOP)
    {
*************** output_move_quad (rtx *operands)
*** 801,807 ****
  	  latehalf[1] = const0_rtx;
  	}
        else
! 	abort();
      }
    else
      latehalf[1] = operands[1];
--- 793,799 ----
  	  latehalf[1] = const0_rtx;
  	}
        else
! 	gcc_unreachable ();
      }
    else
      latehalf[1] = operands[1];
*************** print_operand_address (FILE *file, regis
*** 995,1001 ****
  	}
        if (offset != 0)
  	{
! 	  if (addr != 0) abort ();
  	  addr = offset;
  	}
        if (reg1 != 0 && GET_CODE (reg1) == MULT)
--- 987,993 ----
  	}
        if (offset != 0)
  	{
! 	  gcc_assert (!addr);
  	  addr = offset;
  	}
        if (reg1 != 0 && GET_CODE (reg1) == MULT)
*************** print_operand_address (FILE *file, regis
*** 1022,1038 ****
  	output_address (addr);
        if (breg != 0)
  	{
! 	  if (GET_CODE (breg) != REG)
! 	    abort ();
  	  fprintf (file, "(%s)", reg_names[REGNO (breg)]);
  	}
        if (ireg != 0)
  	{
  	  if (GET_CODE (ireg) == MULT)
  	    ireg = XEXP (ireg, 0);
! 	  if (GET_CODE (ireg) != REG)
! 	    abort ();
! 	  abort();
  	  fprintf (file, "[%s]", reg_names[REGNO (ireg)]);
  	}
        break;
--- 1014,1028 ----
  	output_address (addr);
        if (breg != 0)
  	{
! 	  gcc_assert (GET_CODE (breg) == REG);
  	  fprintf (file, "(%s)", reg_names[REGNO (breg)]);
  	}
        if (ireg != 0)
  	{
  	  if (GET_CODE (ireg) == MULT)
  	    ireg = XEXP (ireg, 0);
! 	  gcc_assert (GET_CODE (ireg) == REG);
! 	  gcc_unreachable(); /* ??? */
  	  fprintf (file, "[%s]", reg_names[REGNO (ireg)]);
  	}
        break;
*************** pdp11_rtx_costs (rtx x, int code, int ou
*** 1203,1209 ****
  }
  
  const char *
! output_jump(const char *pos, const char *neg, int length)
  {
      static int x = 0;
      
--- 1193,1199 ----
  }
  
  const char *
! output_jump (const char *pos, const char *neg, int length)
  {
      static int x = 0;
      
*************** output_jump(const char *pos, const char 
*** 1238,1244 ****
  	
        default:
  	
! 	abort();
      }
      
  }
--- 1228,1234 ----
  	
        default:
  	
! 	gcc_unreachable ();
      }
      
  }
*************** output_addr_const_pdp11 (FILE *file, rtx
*** 1667,1676 ****
    switch (GET_CODE (x))
      {
      case PC:
!       if (flag_pic)
! 	putc ('.', file);
!       else
! 	abort ();
        break;
  
      case SYMBOL_REF:
--- 1657,1664 ----
    switch (GET_CODE (x))
      {
      case PC:
!       gcc_assert (flag_pic);
!       putc ('.', file);
        break;
  
      case SYMBOL_REF:
*************** output_addr_const_pdp11 (FILE *file, rtx
*** 1703,1712 ****
        if (GET_MODE (x) == VOIDmode)
  	{
  	  /* We can use %o if the number is one word and positive.  */
! 	  if (CONST_DOUBLE_HIGH (x))
! 	    abort (); /* Should we just silently drop the high part?  */
! 	  else
! 	    fprintf (file, "%#ho", (unsigned short) CONST_DOUBLE_LOW (x));
  	}
        else
  	/* We can't handle floating point constants;
--- 1691,1698 ----
        if (GET_MODE (x) == VOIDmode)
  	{
  	  /* We can use %o if the number is one word and positive.  */
! 	  gcc_assert (!CONST_DOUBLE_HIGH (x));
! 	  fprintf (file, "%#ho", (unsigned short) CONST_DOUBLE_LOW (x));
  	}
        else
  	/* We can't handle floating point constants;
Index: config/pdp11/pdp11.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pdp11/pdp11.h,v
retrieving revision 1.65
diff -c -3 -p -r1.65 pdp11.h
*** config/pdp11/pdp11.h	28 Apr 2005 05:38:45 -0000	1.65
--- config/pdp11/pdp11.h	9 May 2005 11:55:45 -0000
*************** maybe ac0 ? - as option someday! */
*** 550,556 ****
     for profiling a function entry.  */
  
  #define FUNCTION_PROFILER(FILE, LABELNO)  \
!    abort ();
  
  /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
     the stack pointer does not matter.  The value is tested only in
--- 550,556 ----
     for profiling a function entry.  */
  
  #define FUNCTION_PROFILER(FILE, LABELNO)  \
!    gcc_unreachable ();
  
  /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
     the stack pointer does not matter.  The value is tested only in
*************** extern struct rtx_def *cc0_reg_rtx;
*** 944,950 ****
  	fprintf (FILE, "\t.even\n");	\
  	break;				\
        default:				\
! 	abort ();			\
      }
  
  #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
--- 944,950 ----
  	fprintf (FILE, "\t.even\n");	\
  	break;				\
        default:				\
! 	gcc_unreachable ();		\
      }
  
  #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
*************** JMP	FUNCTION	0x0058  0x0000 <- FUNCTION
*** 1016,1023 ****
  
  #define TRAMPOLINE_TEMPLATE(FILE)	\
  {					\
!   if (TARGET_SPLIT)			\
!     abort();				\
  					\
    assemble_aligned_integer (2, GEN_INT (0x9400+STATIC_CHAIN_REGNUM));	\
    assemble_aligned_integer (2, const0_rtx);				\
--- 1016,1022 ----
  
  #define TRAMPOLINE_TEMPLATE(FILE)	\
  {					\
!   gcc_assert (!TARGET_SPLIT);		\
  					\
    assemble_aligned_integer (2, GEN_INT (0x9400+STATIC_CHAIN_REGNUM));	\
    assemble_aligned_integer (2, const0_rtx);				\
*************** JMP	FUNCTION	0x0058  0x0000 <- FUNCTION
*** 1034,1041 ****
  
  #define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT)	\
  {					\
!   if (TARGET_SPLIT)			\
!     abort();				\
  					\
    emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 2)), CXT); \
    emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), FNADDR); \
--- 1033,1039 ----
  
  #define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT)	\
  {					\
!   gcc_assert (!TARGET_SPLIT);		\
  					\
    emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 2)), CXT); \
    emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), FNADDR); \
Index: config/pdp11/pdp11.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pdp11/pdp11.md,v
retrieving revision 1.23
diff -c -3 -p -r1.23 pdp11.md
*** config/pdp11/pdp11.md	24 Oct 2004 01:42:49 -0000	1.23
--- config/pdp11/pdp11.md	9 May 2005 11:55:52 -0000
***************
*** 124,131 ****
    rtx br_insn = NEXT_INSN (insn);
    RTX_CODE br_code;
  
!   if (GET_CODE (br_insn) != JUMP_INSN)
!     abort();
    br_code =  GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
    
    switch(br_code)
--- 124,130 ----
    rtx br_insn = NEXT_INSN (insn);
    RTX_CODE br_code;
  
!   gcc_assert (GET_CODE (br_insn) == JUMP_INSN);
    br_code =  GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
    
    switch(br_code)
***************
*** 148,154 ****
  
      default:
  
!       abort();
    }
  }"
    [(set_attr "length" "4")])
--- 147,153 ----
  
      default:
  
!       gcc_unreachable ();
    }
  }"
    [(set_attr "length" "4")])
***************
*** 872,878 ****
  
      default:
  
!       abort();
    }
  }"
    [(set_attr "length" "5,3,3")])
--- 871,877 ----
  
      default:
  
!       gcc_unreachable ();
    }
  }"
    [(set_attr "length" "5,3,3")])
***************
*** 1131,1138 ****
    ""
    "*
  {
!   if (GET_CODE (operands[2]) == CONST_INT)
!     abort();
  
    return \"sub %2, %0\";
  }"
--- 1130,1136 ----
    ""
    "*
  {
!   gcc_assert (GET_CODE (operands[2]) != CONST_INT);
  
    return \"sub %2, %0\";
  }"
***************
*** 1145,1152 ****
    ""
    "*
  {
!   if (GET_CODE (operands[2]) == CONST_INT)
!     abort();
  
    return \"sub %2, %0\";
  }"
--- 1143,1149 ----
    ""
    "*
  {
!   gcc_assert (GET_CODE (operands[2]) != CONST_INT);
  
    return \"sub %2, %0\";
  }"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]