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 sh


This patch assertifies the sh target.  built and tested with i686 hosted
cross tools and simulator.

I replaced a couple of aborts with sorrys, as they were checking for
trying unimplemented functionality.

ok?

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

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

	* config/sh/sh.c (print_operand_address): Use gcc_assert and
	gcc_unreachable as appropriate.
	(print_operand, prepare_move_operands, prepare_scc_operands,
	output_movedouble, output_branch, shift_insns_rtx, gen_shifty_op,
	gen_shl_and, shl_sext_kind, gen_datalabel_ref, dump_table,
	fixup_mova, gen_far_branch, sh_reorg, split_branches,
	final_prescan_insn, output_stack_adjust, sh_expand_epilogue,
	sh_set_return_address, sh_setup_incoming_varargs,
	initial_elimination_offset, sh_pch_valid_p, get_free_reg,
	sh_expand_builtin, sh_output_mi_thunk, extract_sfunc_addr,
	check_use_sfunc_addr): Likewise.
	* config/sh/netbsd-elf.h (FUNCTION_PROFILER): Likewise.
	* config/sh/sh.h (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Likewise.
	* config/sh/symbian.c (sh_symbian_mark_dllexport,
	sh_symbian_mark_dllimport): Likewise.
	* config/sh/sh.md: Likewise.
	(movdicc, call_pop, call_value_pop, casesi_worker_1,
	casesi_worker_2, casesi_shift_media, casesi_load_media,
	return_media): Likewise.

Index: config/sh/netbsd-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/netbsd-elf.h,v
retrieving revision 1.10
diff -c -3 -p -r1.10 netbsd-elf.h
*** config/sh/netbsd-elf.h	21 Jun 2004 18:18:40 -0000	1.10
--- config/sh/netbsd-elf.h	8 May 2005 19:43:47 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 89,103 ****
  #define FUNCTION_PROFILER(STREAM,LABELNO)				\
  do									\
    {									\
!     if (TARGET_SHMEDIA32)						\
        {									\
  	/* FIXME */							\
! 	abort ();							\
!       }									\
!     else if (TARGET_SHMEDIA64)						\
!       {									\
! 	/* FIXME */							\
! 	abort ();							\
        }									\
      else								\
        {									\
--- 89,98 ----
  #define FUNCTION_PROFILER(STREAM,LABELNO)				\
  do									\
    {									\
!     if (TARGET_SHMEDIA32 || TARGET_SHMEDIA64)				\
        {									\
  	/* FIXME */							\
! 	sorry ("unimplemented-shmedia profiling");			\
        }									\
      else								\
        {									\
Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.321
diff -c -3 -p -r1.321 sh.c
*** config/sh/sh.c	5 May 2005 21:19:19 -0000	1.321
--- config/sh/sh.c	8 May 2005 19:44:08 -0000
*************** print_operand_address (FILE *stream, rtx
*** 518,525 ****
  	    }
  
  	  default:
! 	    debug_rtx (x);
! 	    abort ();
  	  }
        }
        break;
--- 518,524 ----
  	    }
  
  	  default:
! 	    gcc_unreachable ();
  	  }
        }
        break;
*************** print_operand (FILE *stream, rtx x, int 
*** 646,653 ****
        break;
  
      case 'm':
!       if (GET_CODE (x) != MEM)
! 	abort ();
        x = XEXP (x, 0);
        switch (GET_CODE (x))
  	{
--- 645,651 ----
        break;
  
      case 'm':
!       gcc_assert (GET_CODE (x) == MEM);
        x = XEXP (x, 0);
        switch (GET_CODE (x))
  	{
*************** print_operand (FILE *stream, rtx x, int 
*** 664,676 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
        break;
  
      case 'd':
!       if (GET_CODE (x) != REG || GET_MODE (x) != V2SFmode)
! 	abort ();
  
        fprintf ((stream), "d%s", reg_names[REGNO (x)] + 1);
        break;
--- 662,673 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
        break;
  
      case 'd':
!       gcc_assert (GET_CODE (x) == REG && GET_MODE (x) == V2SFmode);
  
        fprintf ((stream), "d%s", reg_names[REGNO (x)] + 1);
        break;
*************** print_operand (FILE *stream, rtx x, int 
*** 700,708 ****
  	     subreg:SI of the DImode register.  Maybe reload should be
  	     fixed so as to apply alter_subreg to such loads?  */
  	case SUBREG:
! 	  if (SUBREG_BYTE (x) != 0
! 	      || GET_CODE (SUBREG_REG (x)) != REG)
! 	    abort ();
  
  	  x = SUBREG_REG (x);
  	  /* Fall through.  */
--- 697,704 ----
  	     subreg:SI of the DImode register.  Maybe reload should be
  	     fixed so as to apply alter_subreg to such loads?  */
  	case SUBREG:
! 	  gcc_assert (SUBREG_BYTE (x) == 0
! 		      && GET_CODE (SUBREG_REG (x)) == REG);
  
  	  x = SUBREG_REG (x);
  	  /* Fall through.  */
*************** prepare_move_operands (rtx operands[], e
*** 1078,1084 ****
  	      break;
  
  	    default:
! 	      abort ();
  	    }
  	  operands[1] = op1;
  	}
--- 1074,1080 ----
  	      break;
  
  	    default:
! 	      gcc_unreachable ();
  	    }
  	  operands[1] = op1;
  	}
*************** prepare_scc_operands (enum rtx_code code
*** 1101,1107 ****
      {
      case NE:
        /* It isn't possible to handle this case.  */
!       abort ();
      case LT:
        code = GT;
        break;
--- 1097,1103 ----
      {
      case NE:
        /* It isn't possible to handle this case.  */
!       gcc_unreachable ();
      case LT:
        code = GT;
        break;
*************** output_movedouble (rtx insn ATTRIBUTE_UN
*** 1239,1250 ****
        int dreg = REGNO (dst);
        rtx inside = XEXP (src, 0);
  
!       if (GET_CODE (inside) == REG)
! 	ptrreg = REGNO (inside);
!       else if (GET_CODE (inside) == SUBREG)
! 	ptrreg = subreg_regno (inside);
!       else if (GET_CODE (inside) == PLUS)
  	{
  	  ptrreg = REGNO (XEXP (inside, 0));
  	  /* ??? A r0+REG address shouldn't be possible here, because it isn't
  	     an offsettable address.  Unfortunately, offsettable addresses use
--- 1235,1251 ----
        int dreg = REGNO (dst);
        rtx inside = XEXP (src, 0);
  
!       switch (GET_CODE (inside))
  	{
+ 	case REG:
+ 	  ptrreg = REGNO (inside);
+ 	  break;
+ 
+ 	case SUBREG:
+ 	  ptrreg = subreg_regno (inside);
+ 	  break;
+ 
+ 	case PLUS:
  	  ptrreg = REGNO (XEXP (inside, 0));
  	  /* ??? A r0+REG address shouldn't be possible here, because it isn't
  	     an offsettable address.  Unfortunately, offsettable addresses use
*************** output_movedouble (rtx insn ATTRIBUTE_UN
*** 1253,1267 ****
  	     supported, so we can't use the 'o' constraint.
  	     Thus we must check for and handle r0+REG addresses here.
  	     We punt for now, since this is likely very rare.  */
! 	  if (GET_CODE (XEXP (inside, 1)) == REG)
! 	    abort ();
  	}
-       else if (GET_CODE (inside) == LABEL_REF)
- 	return "mov.l	%1,%0\n\tmov.l	%1+4,%T0";
-       else if (GET_CODE (inside) == POST_INC)
- 	return "mov.l	%1,%0\n\tmov.l	%1,%T0";
-       else
- 	abort ();
  
        /* Work out the safe way to copy.  Copy into the second half first.  */
        if (dreg == ptrreg)
--- 1254,1269 ----
  	     supported, so we can't use the 'o' constraint.
  	     Thus we must check for and handle r0+REG addresses here.
  	     We punt for now, since this is likely very rare.  */
! 	  gcc_assert (GET_CODE (XEXP (inside, 1)) != REG);
! 	  break;
! 	  
! 	case LABEL_REF:
! 	  return "mov.l	%1,%0\n\tmov.l	%1+4,%T0";
! 	case POST_INC:
! 	  return "mov.l	%1,%0\n\tmov.l	%1,%T0";
! 	default:
! 	  gcc_unreachable ();
  	}
  
        /* Work out the safe way to copy.  Copy into the second half first.  */
        if (dreg == ptrreg)
*************** output_branch (int logic, rtx insn, rtx 
*** 1430,1438 ****
  	{
  	  int label = lf++;
  
! 	  if (final_sequence
! 	      && INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)))
! 	    abort ();
  	  asm_fprintf (asm_out_file, "b%s%ss\t%LLF%d\n",
  		       logic ? "f" : "t",
  		       ASSEMBLER_DIALECT ? "/" : ".", label);
--- 1432,1440 ----
  	{
  	  int label = lf++;
  
! 	  gcc_assert (!final_sequence
! 		      || !(INSN_ANNULLED_BRANCH_P
! 			   (XVECEXP (final_sequence, 0, 0))));
  	  asm_fprintf (asm_out_file, "b%s%ss\t%LLF%d\n",
  		       logic ? "f" : "t",
  		       ASSEMBLER_DIALECT ? "/" : ".", label);
*************** output_branch (int logic, rtx insn, rtx 
*** 1459,1465 ****
        /* There should be no longer branches now - that would
  	 indicate that something has destroyed the branches set
  	 up in machine_dependent_reorg.  */
!       abort ();
      }
  }
  
--- 1461,1467 ----
        /* There should be no longer branches now - that would
  	 indicate that something has destroyed the branches set
  	 up in machine_dependent_reorg.  */
!       gcc_unreachable ();
      }
  }
  
*************** shift_insns_rtx (rtx insn)
*** 1663,1669 ****
      case ASHIFT:
        return shift_insns[shift_count];
      default:
!       abort ();
      }
  }
  
--- 1665,1671 ----
      case ASHIFT:
        return shift_insns[shift_count];
      default:
!       gcc_unreachable ();
      }
  }
  
*************** gen_shifty_op (int code, rtx *operands)
*** 2023,2029 ****
    else if (value == 0)
      {
        /* This can happen when not optimizing.  We must output something here
! 	 to prevent the compiler from aborting in final.c after the try_split
  	 call.  */
        emit_insn (gen_nop ());
        return;
--- 2025,2031 ----
    else if (value == 0)
      {
        /* This can happen when not optimizing.  We must output something here
! 	 to prevent the compiler from dieing in final.c after the try_split
  	 call.  */
        emit_insn (gen_nop ());
        return;
*************** gen_shl_and (rtx dest, rtx left_rtx, rtx
*** 2389,2396 ****
  
  	  /* Cases 3 and 4 should be handled by this split
  	     only while combining  */
! 	  if (kind > 2)
! 	    abort ();
  	  if (right)
  	    {
  	      emit_insn (gen_lshrsi3 (dest, source, GEN_INT (right)));
--- 2391,2397 ----
  
  	  /* Cases 3 and 4 should be handled by this split
  	     only while combining  */
! 	  gcc_assert (kind <= 2);
  	  if (right)
  	    {
  	      emit_insn (gen_lshrsi3 (dest, source, GEN_INT (right)));
*************** shl_sext_kind (rtx left_rtx, rtx size_rt
*** 2457,2464 ****
    left = INTVAL (left_rtx);
    size = INTVAL (size_rtx);
    insize = size - left;
!   if (insize <= 0)
!     abort ();
    /* Default to left / right shift.  */
    kind = 0;
    best_cost = shift_insns[32 - insize] + ashiftrt_insns[32 - size];
--- 2458,2464 ----
    left = INTVAL (left_rtx);
    size = INTVAL (size_rtx);
    insize = size - left;
!   gcc_assert (insize > 0);
    /* Default to left / right shift.  */
    kind = 0;
    best_cost = shift_insns[32 - insize] + ashiftrt_insns[32 - size];
*************** gen_datalabel_ref (rtx sym)
*** 2686,2693 ****
  					  gen_rtvec (1, sym),
  					  UNSPEC_DATALABEL));
  
!   if (GET_CODE (sym) != SYMBOL_REF)
!     abort ();
  
    return sym;
  }
--- 2686,2692 ----
  					  gen_rtvec (1, sym),
  					  UNSPEC_DATALABEL));
  
!   gcc_assert (GET_CODE (sym) == SYMBOL_REF);
  
    return sym;
  }
*************** dump_table (rtx start, rtx barrier)
*** 2965,2972 ****
  				      scan);
  	      break;
  	    default:
! 	      abort ();
! 	      break;
  	    }
  
  	  if (p->mode != HImode)
--- 2964,2970 ----
  				      scan);
  	      break;
  	    default:
! 	      gcc_unreachable ();
  	    }
  
  	  if (p->mode != HImode)
*************** dump_table (rtx start, rtx barrier)
*** 3018,3025 ****
  				  scan);
  	  break;
  	default:
! 	  abort ();
! 	  break;
  	}
  
        if (p->mode != HImode)
--- 3016,3022 ----
  				  scan);
  	  break;
  	default:
! 	  gcc_unreachable ();
  	}
  
        if (p->mode != HImode)
*************** fixup_mova (rtx mova)
*** 3130,3139 ****
        do
  	{
  	  worker = NEXT_INSN (worker);
! 	  if (! worker
! 	      || GET_CODE (worker) == CODE_LABEL
! 	      || GET_CODE (worker) == JUMP_INSN)
! 	    abort ();
  	} while (recog_memoized (worker) != CODE_FOR_casesi_worker_1);
        wpat = PATTERN (worker);
        wpat0 = XVECEXP (wpat, 0, 0);
--- 3127,3135 ----
        do
  	{
  	  worker = NEXT_INSN (worker);
! 	  gcc_assert (worker
! 		      && GET_CODE (worker) != CODE_LABEL
! 		      && GET_CODE (worker) != JUMP_INSN);
  	} while (recog_memoized (worker) != CODE_FOR_casesi_worker_1);
        wpat = PATTERN (worker);
        wpat0 = XVECEXP (wpat, 0, 0);
*************** gen_far_branch (struct far_branch *bp)
*** 3772,3777 ****
--- 3768,3774 ----
    rtx insn = bp->insert_place;
    rtx jump;
    rtx label = gen_label_rtx ();
+   int ok;
  
    emit_label_after (label, insn);
    if (bp->far_label)
*************** gen_far_branch (struct far_branch *bp)
*** 3790,3797 ****
      emit_barrier_after (jump);
    emit_label_after (bp->near_label, insn);
    JUMP_LABEL (jump) = bp->far_label;
!   if (! invert_jump (insn, label, 1))
!     abort ();
    /* If we are branching around a jump (rather than a return), prevent
       reorg from using an insn from the jump target as the delay slot insn -
       when reorg did this, it pessimized code (we rather hide the delay slot)
--- 3787,3795 ----
      emit_barrier_after (jump);
    emit_label_after (bp->near_label, insn);
    JUMP_LABEL (jump) = bp->far_label;
!   ok = invert_jump (insn, label, 1);
!   gcc_assert (ok);
!   
    /* If we are branching around a jump (rather than a return), prevent
       reorg from using an insn from the jump target as the delay slot insn -
       when reorg did this, it pessimized code (we rather hide the delay slot)
*************** sh_reorg (void)
*** 4365,4373 ****
  						- 1);
  		      rtx clobber = *clobberp;
  
! 		      if (GET_CODE (clobber) != CLOBBER
! 			  || ! rtx_equal_p (XEXP (clobber, 0), r0_rtx))
! 			abort ();
  
  		      if (last_float
  			  && reg_set_between_p (r0_rtx, last_float_move, scan))
--- 4363,4370 ----
  						- 1);
  		      rtx clobber = *clobberp;
  
! 		      gcc_assert (GET_CODE (clobber) == CLOBBER
! 				  && rtx_equal_p (XEXP (clobber, 0), r0_rtx));
  
  		      if (last_float
  			  && reg_set_between_p (r0_rtx, last_float_move, scan))
*************** split_branches (rtx first)
*** 4501,4506 ****
--- 4498,4504 ----
    rtx insn;
    struct far_branch **uid_branch, *far_branch_list = 0;
    int max_uid = get_max_uid ();
+   int ok;
  
    /* Find out which branches are out of range.  */
    shorten_branches (first);
*************** split_branches (rtx first)
*** 4590,4597 ****
  		    bp->insert_place = insn;
  		    bp->address = addr;
  		  }
! 		if (! redirect_jump (insn, label, 1))
! 		  abort ();
  	      }
  	    else
  	      {
--- 4588,4595 ----
  		    bp->insert_place = insn;
  		    bp->address = addr;
  		  }
! 		ok = redirect_jump (insn, label, 1);
! 		gcc_assert (ok);
  	      }
  	    else
  	      {
*************** final_prescan_insn (rtx insn, rtx *opvec
*** 4737,4755 ****
  	  rtx pattern;
  
  	  pattern = PATTERN (insn);
! 	  if (GET_CODE (pattern) == PARALLEL)
! 	    pattern = XVECEXP (pattern, 0, 0);
! 	  if (GET_CODE (pattern) == CALL
! 	      || (GET_CODE (pattern) == SET
! 		  && (GET_CODE (SET_SRC (pattern)) == CALL
! 		      || get_attr_type (insn) == TYPE_SFUNC)))
! 	    asm_fprintf (asm_out_file, "\t.uses %LL%d\n",
! 			 CODE_LABEL_NUMBER (XEXP (note, 0)));
! 	  else if (GET_CODE (pattern) == SET)
! 	    (*targetm.asm_out.internal_label) (asm_out_file, "L",
! 				       CODE_LABEL_NUMBER (XEXP (note, 0)));
! 	  else
! 	    abort ();
  	}
      }
  }
--- 4735,4763 ----
  	  rtx pattern;
  
  	  pattern = PATTERN (insn);
! 	  switch (GET_CODE (pattern))
! 	    {
! 	    case PARALLEL:
! 	      pattern = XVECEXP (pattern, 0, 0);
! 	      break;
! 
! 	    case SET:
! 	      if (GET_CODE (SET_SRC (pattern)) != CALL
! 		  && get_attr_type (insn) != TYPE_SFUNC)
! 		{
! 		  targetm.asm_out.internal_label
! 		    (asm_out_file, "L", CODE_LABEL_NUMBER (XEXP (note, 0)));
! 		  break;
! 		}
! 	      /* else FALLTHROUGH */
! 	    case CALL:
! 	      asm_fprintf (asm_out_file, "\t.uses %LL%d\n",
! 			   CODE_LABEL_NUMBER (XEXP (note, 0)));
! 	      break;
! 
! 	    default:
! 	      gcc_unreachable ();
! 	    }
  	}
      }
  }
*************** output_stack_adjust (int size, rtx reg, 
*** 4819,4826 ****
  /* This test is bogus, as output_stack_adjust is used to re-align the
     stack.  */
  #if 0
!       if (size % align)
! 	abort ();
  #endif
  
        if (CONST_OK_FOR_ADD (size))
--- 4827,4833 ----
  /* This test is bogus, as output_stack_adjust is used to re-align the
     stack.  */
  #if 0
!       gcc_assert (!(size % align));
  #endif
  
        if (CONST_OK_FOR_ADD (size))
*************** output_stack_adjust (int size, rtx reg, 
*** 4843,4849 ****
  
  	  /* If TEMP is invalid, we could temporarily save a general
  	     register to MACL.  However, there is currently no need
! 	     to handle this case, so just abort when we see it.  */
  	  if (epilogue_p < 0
  	      || current_function_interrupt
  	      || ! call_really_used_regs[temp] || fixed_regs[temp])
--- 4850,4856 ----
  
  	  /* If TEMP is invalid, we could temporarily save a general
  	     register to MACL.  However, there is currently no need
! 	     to handle this case, so just die when we see it.  */
  	  if (epilogue_p < 0
  	      || current_function_interrupt
  	      || ! call_really_used_regs[temp] || fixed_regs[temp])
*************** output_stack_adjust (int size, rtx reg, 
*** 4890,4942 ****
  	    temp = scavenge_reg (live_regs_mask);
  	  if (temp < 0)
  	    {
  	      /* If we reached here, the most likely case is the (sibcall)
  		 epilogue for non SHmedia.  Put a special push/pop sequence
  		 for such case as the last resort.  This looks lengthy but
! 		 would not be problem because it seems to be very rare.  */
! 	      if (! TARGET_SHMEDIA && epilogue_p)
! 		{
! 		  rtx adj_reg, tmp_reg, mem;
! 
! 		  /* ??? There is still the slight possibility that r4 or r5
! 		     have been reserved as fixed registers or assigned as
! 		     global registers, and they change during an interrupt.
! 		     There are possible ways to handle this:
! 		     - If we are adjusting the frame pointer (r14), we can do
! 		       with a single temp register and an ordinary push / pop
! 		       on the stack.
! 		     - Grab any call-used or call-saved registers (i.e. not
! 		       fixed or globals) for the temps we need.  We might
! 		       also grab r14 if we are adjusting the stack pointer.
! 		       If we can't find enough available registers, issue
! 		       a diagnostic and abort - the user must have reserved
! 		       way too many registers.
! 		     But since all this is rather unlikely to happen and
! 		     would require extra testing, we just abort if r4 / r5
! 		     are not available.  */
! 		  if (fixed_regs[4] || fixed_regs[5]
! 		      || global_regs[4] || global_regs[5])
! 		    abort ();
! 
! 		  adj_reg = gen_rtx_REG (GET_MODE (reg), 4);
! 		  tmp_reg = gen_rtx_REG (GET_MODE (reg), 5);
! 		  emit_move_insn (gen_rtx_MEM (Pmode, reg), adj_reg);
! 		  emit_insn (GEN_MOV (adj_reg, GEN_INT (size)));
! 		  emit_insn (GEN_ADD3 (adj_reg, adj_reg, reg));
! 		  mem = gen_rtx_MEM (Pmode, gen_rtx_PRE_DEC (Pmode, adj_reg));
! 		  emit_move_insn (mem, tmp_reg);
! 		  emit_move_insn (tmp_reg, gen_rtx_MEM (Pmode, reg));
! 		  mem = gen_rtx_MEM (Pmode, gen_rtx_PRE_DEC (Pmode, adj_reg));
! 		  emit_move_insn (mem, tmp_reg);
! 		  emit_move_insn (reg, adj_reg);
! 		  mem = gen_rtx_MEM (Pmode, gen_rtx_POST_INC (Pmode, reg));
! 		  emit_move_insn (adj_reg, mem);
! 		  mem = gen_rtx_MEM (Pmode, gen_rtx_POST_INC (Pmode, reg));
! 		  emit_move_insn (tmp_reg, mem);
! 		  return;
! 		}
! 	      else
! 		abort ();
  	    }
  	  const_reg = gen_rtx_REG (GET_MODE (reg), temp);
  
--- 4897,4949 ----
  	    temp = scavenge_reg (live_regs_mask);
  	  if (temp < 0)
  	    {
+ 	      rtx adj_reg, tmp_reg, mem;
+ 	      
  	      /* If we reached here, the most likely case is the (sibcall)
  		 epilogue for non SHmedia.  Put a special push/pop sequence
  		 for such case as the last resort.  This looks lengthy but
! 		 would not be problem because it seems to be very
! 		 rare.  */
! 	      
! 	      gcc_assert (!TARGET_SHMEDIA && epilogue_p);
! 	      
! 
! 	       /* ??? There is still the slight possibility that r4 or
! 		  r5 have been reserved as fixed registers or assigned
! 		  as global registers, and they change during an
! 		  interrupt.  There are possible ways to handle this:
! 		     
! 		  - If we are adjusting the frame pointer (r14), we can do
! 		    with a single temp register and an ordinary push / pop
! 		    on the stack.
! 		  - Grab any call-used or call-saved registers (i.e. not
! 		    fixed or globals) for the temps we need.  We might
! 		    also grab r14 if we are adjusting the stack pointer.
! 		    If we can't find enough available registers, issue
! 		    a diagnostic and die - the user must have reserved
! 		    way too many registers.
! 		 But since all this is rather unlikely to happen and
! 		 would require extra testing, we just die if r4 / r5
! 		 are not available.  */
! 	      gcc_assert (!fixed_regs[4] && !fixed_regs[5]
! 			  && !global_regs[4] && !global_regs[5]);
! 
! 	      adj_reg = gen_rtx_REG (GET_MODE (reg), 4);
! 	      tmp_reg = gen_rtx_REG (GET_MODE (reg), 5);
! 	      emit_move_insn (gen_rtx_MEM (Pmode, reg), adj_reg);
! 	      emit_insn (GEN_MOV (adj_reg, GEN_INT (size)));
! 	      emit_insn (GEN_ADD3 (adj_reg, adj_reg, reg));
! 	      mem = gen_rtx_MEM (Pmode, gen_rtx_PRE_DEC (Pmode, adj_reg));
! 	      emit_move_insn (mem, tmp_reg);
! 	      	emit_move_insn (tmp_reg, gen_rtx_MEM (Pmode, reg));
! 		mem = gen_rtx_MEM (Pmode, gen_rtx_PRE_DEC (Pmode, adj_reg));
! 		emit_move_insn (mem, tmp_reg);
! 		emit_move_insn (reg, adj_reg);
! 		mem = gen_rtx_MEM (Pmode, gen_rtx_POST_INC (Pmode, reg));
! 		emit_move_insn (adj_reg, mem);
! 		mem = gen_rtx_MEM (Pmode, gen_rtx_POST_INC (Pmode, reg));
! 		emit_move_insn (tmp_reg, mem);
! 		return;
  	    }
  	  const_reg = gen_rtx_REG (GET_MODE (reg), temp);
  
*************** sh_expand_prologue (void)
*** 5590,5597 ****
  
  	  GO_IF_LEGITIMATE_ADDRESS (mode, XEXP (mem_rtx, 0), try_pre_dec);
  
! 	  if (! r0)
! 	    abort ();
  	  mem_rtx = NULL_RTX;
  
  	try_pre_dec:
--- 5597,5603 ----
  
  	  GO_IF_LEGITIMATE_ADDRESS (mode, XEXP (mem_rtx, 0), try_pre_dec);
  
! 	  gcc_assert (r0);
  	  mem_rtx = NULL_RTX;
  
  	try_pre_dec:
*************** sh_expand_prologue (void)
*** 5661,5671 ****
  	     registers or for special registers without pre-dec
  	     memory addresses, since we store their values in r0
  	     first.  */
! 	  if (TARGET_REGISTER_P (reg)
! 	      || ((reg == PR_REG || SPECIAL_REGISTER_P (reg))
! 		  && mem_rtx != pre_dec))
! 	    abort ();
! 
  	addr_ok:
  	  orig_reg_rtx = reg_rtx;
  	  if (TARGET_REGISTER_P (reg)
--- 5667,5676 ----
  	     registers or for special registers without pre-dec
  	     memory addresses, since we store their values in r0
  	     first.  */
! 	  gcc_assert (!TARGET_REGISTER_P (reg)
! 		      && ((reg != PR_REG && !SPECIAL_REGISTER_P (reg))
! 			  || mem_rtx == pre_dec));
! 	  
  	addr_ok:
  	  orig_reg_rtx = reg_rtx;
  	  if (TARGET_REGISTER_P (reg)
*************** sh_expand_prologue (void)
*** 5680,5687 ****
  		{
  		  offset_in_r0 = -1;
  		  sp_in_r0 = 0;
! 		  if (refers_to_regno_p (R0_REG, R0_REG+1, mem_rtx, (rtx *) 0))
! 		    abort ();
  		}
  
  	      if (*++tmp_pnt <= 0)
--- 5685,5692 ----
  		{
  		  offset_in_r0 = -1;
  		  sp_in_r0 = 0;
! 		  gcc_assert (!refers_to_regno_p
! 			      (R0_REG, R0_REG+1, mem_rtx, (rtx *) 0));
  		}
  
  	      if (*++tmp_pnt <= 0)
*************** sh_expand_prologue (void)
*** 5729,5736 ****
  	  }
  	}
  
!       if (entry->offset != d_rounding)
! 	abort ();
      }
    else
      push_regs (&live_regs_mask, current_function_interrupt);
--- 5734,5740 ----
  	  }
  	}
  
!       gcc_assert (entry->offset == d_rounding);
      }
    else
      push_regs (&live_regs_mask, current_function_interrupt);
*************** sh_expand_epilogue (bool sibcall_p)
*** 5974,5982 ****
  						 stack_pointer_rtx,
  						 r0));
  
! 	  if ((reg == PR_REG || SPECIAL_REGISTER_P (reg))
! 	      && mem_rtx != post_inc)
! 	    abort ();
  
  	addr_ok:
  	  if ((reg == PR_REG || SPECIAL_REGISTER_P (reg))
--- 5978,5985 ----
  						 stack_pointer_rtx,
  						 r0));
  
! 	  gcc_assert ((reg != PR_REG && !SPECIAL_REGISTER_P (reg))
! 		      || mem_rtx == post_inc);
  
  	addr_ok:
  	  if ((reg == PR_REG || SPECIAL_REGISTER_P (reg))
*************** sh_expand_epilogue (bool sibcall_p)
*** 6005,6012 ****
  						  REG_NOTES (insn));
  	}
  
!       if (entry->offset + offset_base != d + d_rounding)
! 	abort ();
      }
    else /* ! TARGET_SH5 */
      {
--- 6008,6014 ----
  						  REG_NOTES (insn));
  	}
  
!       gcc_assert (entry->offset + offset_base == d + d_rounding);
      }
    else /* ! TARGET_SH5 */
      {
*************** sh_set_return_address (rtx ra, rtx tmp)
*** 6121,6127 ****
  	  goto found;
  
        /* We can't find pr register.  */
!       abort ();
  
      found:
        offset = entry->offset - offset;
--- 6123,6129 ----
  	  goto found;
  
        /* We can't find pr register.  */
!       gcc_unreachable ();
  
      found:
        offset = entry->offset - offset;
*************** sh_setup_incoming_varargs (CUMULATIVE_AR
*** 6989,6996 ****
  			   int *pretend_arg_size,
  			   int second_time ATTRIBUTE_UNUSED)
  {
!   if (! current_function_stdarg)
!     abort ();
    if (TARGET_VARARGS_PRETEND_ARGS (current_function_decl))
      {
        int named_parm_regs, anon_parm_regs;
--- 6991,6997 ----
  			   int *pretend_arg_size,
  			   int second_time ATTRIBUTE_UNUSED)
  {
!   gcc_assert (current_function_stdarg);
    if (TARGET_VARARGS_PRETEND_ARGS (current_function_decl))
      {
        int named_parm_regs, anon_parm_regs;
*************** initial_elimination_offset (int from, in
*** 7064,7101 ****
    if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
      return 0;
  
!   if (from == RETURN_ADDRESS_POINTER_REGNUM
!       && (to == FRAME_POINTER_REGNUM || to == STACK_POINTER_REGNUM))
      {
!       if (TARGET_SH5)
! 	{
! 	  int n = total_saved_regs_space;
! 	  int pr_reg = TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG;
! 	  save_schedule schedule;
! 	  save_entry *entry;
! 
! 	  n += total_auto_space;
! 
! 	  /* If it wasn't saved, there's not much we can do.  */
! 	  if (! TEST_HARD_REG_BIT (live_regs_mask, pr_reg))
! 	    return n;
! 
! 	  target_flags = copy_flags;
! 
! 	  sh5_schedule_saves (&live_regs_mask, &schedule, n);
! 	  for (entry = &schedule.entries[1]; entry->mode != VOIDmode; entry++)
! 	    if (entry->reg == pr_reg)
! 	      {
! 		target_flags = save_flags;
! 		return entry->offset;
! 	      }
! 	  abort ();
! 	}
!       else
! 	return total_auto_space;
      }
! 
!   abort ();
  }
  
  /* Handle machine specific pragmas to be semi-compatible with Renesas
--- 7065,7098 ----
    if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
      return 0;
  
!   gcc_assert (from == RETURN_ADDRESS_POINTER_REGNUM
! 	      && (to == FRAME_POINTER_REGNUM || to == STACK_POINTER_REGNUM));
!   if (TARGET_SH5)
      {
!       int n = total_saved_regs_space;
!       int pr_reg = TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG;
!       save_schedule schedule;
!       save_entry *entry;
!       
!       n += total_auto_space;
!       
!       /* If it wasn't saved, there's not much we can do.  */
!       if (! TEST_HARD_REG_BIT (live_regs_mask, pr_reg))
! 	return n;
!       
!       target_flags = copy_flags;
!       
!       sh5_schedule_saves (&live_regs_mask, &schedule, n);
!       for (entry = &schedule.entries[1]; entry->mode != VOIDmode; entry++)
! 	if (entry->reg == pr_reg)
! 	  {
! 	    target_flags = save_flags;
! 	    return entry->offset;
! 	  }
!       gcc_unreachable ();
      }
!   else
!     return total_auto_space;
  }
  
  /* Handle machine specific pragmas to be semi-compatible with Renesas
*************** sh_pch_valid_p (const void *data_p, size
*** 7353,7359 ****
  	      goto make_message;
  	    }
  	}
!       abort ();
      }
    data += sizeof (target_flags);
    len -= sizeof (target_flags);
--- 7350,7356 ----
  	      goto make_message;
  	    }
  	}
!       gcc_unreachable ();
      }
    data += sizeof (target_flags);
    len -= sizeof (target_flags);
*************** get_free_reg (HARD_REG_SET regs_live)
*** 8260,8269 ****
  
    /* Hard reg 1 is live; since this is a SMALL_REGISTER_CLASSES target,
       there shouldn't be anything but a jump before the function end.  */
!   if (! TEST_HARD_REG_BIT (regs_live, 7))
!     return gen_rtx_REG (Pmode, 7);
! 
!   abort ();
  }
  
  /* This function will set the fpscr from memory.
--- 8257,8264 ----
  
    /* Hard reg 1 is live; since this is a SMALL_REGISTER_CLASSES target,
       there shouldn't be anything but a jump before the function end.  */
!   gcc_assert (TEST_HARD_REG_BIT (regs_live, 7));
!   return gen_rtx_REG (Pmode, 7);
  }
  
  /* This function will set the fpscr from memory.
*************** sh_expand_builtin (tree exp, rtx target,
*** 9538,9544 ****
        pat = (*insn_data[d->icode].genfun) (op[0], op[1], op[2], op[3]);
        break;
      default:
!       abort ();
      }
    if (! pat)
      return 0;
--- 9533,9539 ----
        pat = (*insn_data[d->icode].genfun) (op[0], op[1], op[2], op[3]);
        break;
      default:
!       gcc_unreachable ();
      }
    if (! pat)
      return 0;
*************** sh_output_mi_thunk (FILE *file, tree thu
*** 9817,9823 ****
  	  offset_addr = scratch0;
  	}
        else
! 	abort (); /* FIXME */
        emit_load_ptr (scratch0, offset_addr);
  
        if (Pmode != ptr_mode)
--- 9812,9818 ----
  	  offset_addr = scratch0;
  	}
        else
! 	gcc_unreachable (); /* FIXME */
        emit_load_ptr (scratch0, offset_addr);
  
        if (Pmode != ptr_mode)
*************** extract_sfunc_addr (rtx insn)
*** 9982,9990 ****
  	  && GENERAL_REGISTER_P (true_regnum (XEXP (part, 0))))
  	return XEXP (part, 0);
      }
!   if (GET_CODE (XVECEXP (pattern, 0, 0)) == UNSPEC_VOLATILE)
!     return XVECEXP (XVECEXP (pattern, 0, 0), 0, 1);
!   abort ();
  }
  
  /* Verify that the register in use_sfunc_addr still agrees with the address
--- 9977,9984 ----
  	  && GENERAL_REGISTER_P (true_regnum (XEXP (part, 0))))
  	return XEXP (part, 0);
      }
!   gcc_assert (GET_CODE (XVECEXP (pattern, 0, 0)) == UNSPEC_VOLATILE);
!   return XVECEXP (XVECEXP (pattern, 0, 0), 0, 1);
  }
  
  /* Verify that the register in use_sfunc_addr still agrees with the address
*************** check_use_sfunc_addr (rtx insn, rtx reg)
*** 10010,10016 ****
  	continue;
        return rtx_equal_p (extract_sfunc_addr (insn), reg);
      }
!   abort ();
  }
  
  /* Returns 1 if OP is a MEM that can be source of a simple move operation.  */
--- 10004,10010 ----
  	continue;
        return rtx_equal_p (extract_sfunc_addr (insn), reg);
      }
!   gcc_unreachable ();
  }
  
  /* Returns 1 if OP is a MEM that can be source of a simple move operation.  */
Index: config/sh/sh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.264
diff -c -3 -p -r1.264 sh.h
*** config/sh/sh.h	28 Apr 2005 05:38:48 -0000	1.264
--- config/sh/sh.h	8 May 2005 19:44:16 -0000
*************** extern int rtx_equal_function_value_matt
*** 3475,3482 ****
      if (((ENCODING) & 0xf) != DW_EH_PE_sdata4 \
  	&& ((ENCODING) & 0xf) != DW_EH_PE_sdata8) \
        { \
! 	if (GET_CODE (ADDR) != SYMBOL_REF) \
! 	  abort (); \
  	SYMBOL_REF_FLAGS (ADDR) |= SYMBOL_FLAG_FUNCTION; \
  	if (0) goto DONE; \
        } \
--- 3475,3481 ----
      if (((ENCODING) & 0xf) != DW_EH_PE_sdata4 \
  	&& ((ENCODING) & 0xf) != DW_EH_PE_sdata8) \
        { \
! 	gcc_assert (GET_CODE (ADDR) == SYMBOL_REF); \
  	SYMBOL_REF_FLAGS (ADDR) |= SYMBOL_FLAG_FUNCTION; \
  	if (0) goto DONE; \
        } \
Index: config/sh/sh.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v
retrieving revision 1.191
diff -c -3 -p -r1.191 sh.md
*** config/sh/sh.md	23 Mar 2005 00:14:52 -0000	1.191
--- config/sh/sh.md	8 May 2005 19:44:39 -0000
***************
*** 889,895 ****
  	  FAIL;
  
  	default:
! 	  abort ();
  	}
      }
  }")
--- 889,895 ----
  	  FAIL;
  
  	default:
! 	  gcc_unreachable ();
  	}
      }
  }")
***************
*** 1950,1956 ****
    [(const_int 0)]
    "
  {
!   if (INTVAL (operands[2]) == (unsigned) 0xffffffff)
      emit_insn (gen_mshflo_l_di (operands[0], operands[1], CONST0_RTX (DImode)));
    else
      emit_insn (gen_mshfhi_l_di (operands[0], CONST0_RTX (DImode), operands[1]));
--- 1950,1956 ----
    [(const_int 0)]
    "
  {
!   if ((unsigned)INTVAL (operands[2]) == (unsigned) 0xffffffff)
      emit_insn (gen_mshflo_l_di (operands[0], operands[1], CONST0_RTX (DImode)));
    else
      emit_insn (gen_mshfhi_l_di (operands[0], CONST0_RTX (DImode), operands[1]));
***************
*** 2022,2029 ****
        offset = SUBREG_BYTE (operands[0]);
        operands[0] = SUBREG_REG (operands[0]);
      }
!   if (GET_CODE (operands[0]) != REG)
!     abort ();
    if (! TARGET_LITTLE_ENDIAN)
      offset += 8 - GET_MODE_SIZE (inmode);
    operands[5] = gen_rtx_SUBREG (inmode, operands[0], offset);
--- 2022,2028 ----
        offset = SUBREG_BYTE (operands[0]);
        operands[0] = SUBREG_REG (operands[0]);
      }
!   gcc_assert (GET_CODE (operands[0]) == REG);
    if (! TARGET_LITTLE_ENDIAN)
      offset += 8 - GET_MODE_SIZE (inmode);
    operands[5] = gen_rtx_SUBREG (inmode, operands[0], offset);
***************
*** 3812,3825 ****
  	  && GET_CODE (XEXP (operands[1], 0)) == POST_INC))
      FAIL;
  
!   if (GET_CODE (operands[0]) == REG)
!     regno = REGNO (operands[0]);
!   else if (GET_CODE (operands[0]) == SUBREG)
!     regno = subreg_regno (operands[0]);
!   else if (GET_CODE (operands[0]) == MEM)
!     regno = -1;
!   else
!     abort ();
  
    if (regno == -1
        || ! refers_to_regno_p (regno, regno + 1, operands[1], 0))
--- 3811,3830 ----
  	  && GET_CODE (XEXP (operands[1], 0)) == POST_INC))
      FAIL;
  
!   switch (GET_CODE (operands[0]))
!     {
!     case REG:
!       regno = REGNO (operands[0]);
!       break;
!     case SUBREG:
!       regno = subreg_regno (operands[0]);
!       break;
!     case MEM:
!       regno = -1;
!       break;
!     default:
!       gcc_unreachable ();
!     }
  
    if (regno == -1
        || ! refers_to_regno_p (regno, regno + 1, operands[1], 0))
***************
*** 4186,4196 ****
      operands[2] = immed_double_const ((unsigned long) values[endian]
  				      | ((HOST_WIDE_INT) values[1 - endian]
  					 << 32), 0, DImode);
-   else if (HOST_BITS_PER_WIDE_INT == 32)
-     operands[2] = immed_double_const (values[endian], values[1 - endian],
- 				      DImode);
    else
!     abort ();
  
    operands[3] = gen_rtx_REG (DImode, true_regnum (operands[0]));
  }")
--- 4191,4202 ----
      operands[2] = immed_double_const ((unsigned long) values[endian]
  				      | ((HOST_WIDE_INT) values[1 - endian]
  					 << 32), 0, DImode);
    else
!     {
!       gcc_assert (HOST_BITS_PER_WIDE_INT == 32);
!       operands[2] = immed_double_const (values[endian], values[1 - endian],
! 	  			        DImode);
!     }
  
    operands[3] = gen_rtx_REG (DImode, true_regnum (operands[0]));
  }")
***************
*** 4558,4571 ****
  	  && GET_CODE (XEXP (operands[1], 0)) == POST_INC))
      FAIL;
  
!   if (GET_CODE (operands[0]) == REG)
!     regno = REGNO (operands[0]);
!   else if (GET_CODE (operands[0]) == SUBREG)
!     regno = subreg_regno (operands[0]);
!   else if (GET_CODE (operands[0]) == MEM)
!     regno = -1;
!   else
!     abort ();
  
    if (regno == -1
        || ! refers_to_regno_p (regno, regno + 1, operands[1], 0))
--- 4564,4583 ----
  	  && GET_CODE (XEXP (operands[1], 0)) == POST_INC))
      FAIL;
  
!   switch (GET_CODE (operands[0]))
!     {
!     case REG:
!       regno = REGNO (operands[0]);
!       break;
!     case SUBREG:
!       regno = subreg_regno (operands[0]);
!       break;
!     case MEM:
!       regno = -1;
!       break;
!     default:
!       gcc_unreachable ();
!     }
  
    if (regno == -1
        || ! refers_to_regno_p (regno, regno + 1, operands[1], 0))
***************
*** 5959,6016 ****
    "TARGET_SHCOMPACT"
    "
  {
!   if (operands[2] && INTVAL (operands[2]))
!     {
!       rtx cookie_rtx = operands[2];
!       long cookie = INTVAL (cookie_rtx);
!       rtx func = XEXP (operands[0], 0);
!       rtx r0, r1;
! 
!       if (flag_pic)
! 	{
! 	  if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
! 	    {
! 	      rtx reg = gen_reg_rtx (Pmode);
  
! 	      emit_insn (gen_symGOTPLT2reg (reg, func));
! 	      func = reg;
! 	    }
! 	  else
! 	    func = legitimize_pic_address (func, Pmode, 0);
  	}
  
!       r0 = gen_rtx_REG (SImode, R0_REG);
!       r1 = gen_rtx_REG (SImode, R1_REG);
! 
!       /* Since such a call function may use all call-clobbered
! 	 registers, we force a mode switch earlier, so that we don't
! 	 run out of registers when adjusting fpscr for the call.  */
!       emit_insn (gen_force_mode_for_call ());
  
!       operands[0] = function_symbol (\"__GCC_shcompact_call_trampoline\");
!       if (flag_pic)
! 	{
! 	  rtx reg = gen_reg_rtx (Pmode);
  
! 	  emit_insn (gen_symGOTPLT2reg (reg, operands[0]));
! 	  operands[0] = reg;
! 	}
!       operands[0] = force_reg (SImode, operands[0]);
  
!       emit_move_insn (r0, func);
!       emit_move_insn (r1, cookie_rtx);
  
!       if (cookie & CALL_COOKIE_RET_TRAMP (1))
! 	emit_call_insn (gen_call_pop_compact_rettramp
! 			(operands[0], operands[1], operands[2], operands[3]));
!       else
! 	emit_call_insn (gen_call_pop_compact
! 			(operands[0], operands[1], operands[2], operands[3]));
  
!       DONE;
!     }
  
!   abort ();
  }")
  
  (define_expand "call_value"
--- 5971,6027 ----
    "TARGET_SHCOMPACT"
    "
  {
!   rtx cookie_rtx;
!   long cookie;
!   rtx func;
!   rtx r0, r1;
! 
!   gcc_assert (operands[2] && INTVAL (operands[2]));
!   cookie_rtx = operands[2];
!   cookie = INTVAL (cookie_rtx);
!   func = XEXP (operands[0], 0);
  
!   if (flag_pic)
!     {
!       if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
!         {
! 	  rtx reg = gen_reg_rtx (Pmode);
! 	  emit_insn (gen_symGOTPLT2reg (reg, func));
! 	  func = reg;
  	}
+       else
+         func = legitimize_pic_address (func, Pmode, 0);
+     }
  
!   r0 = gen_rtx_REG (SImode, R0_REG);
!   r1 = gen_rtx_REG (SImode, R1_REG);
  
!   /* Since such a call function may use all call-clobbered
!      registers, we force a mode switch earlier, so that we don't
!      run out of registers when adjusting fpscr for the call.  */
!   emit_insn (gen_force_mode_for_call ());
  
!   operands[0] = function_symbol (\"__GCC_shcompact_call_trampoline\");
!   if (flag_pic)
!     {
!       rtx reg = gen_reg_rtx (Pmode);
  
!       emit_insn (gen_symGOTPLT2reg (reg, operands[0]));
!       operands[0] = reg;
!     }
!   operands[0] = force_reg (SImode, operands[0]);
  
!   emit_move_insn (r0, func);
!   emit_move_insn (r1, cookie_rtx);
  
!   if (cookie & CALL_COOKIE_RET_TRAMP (1))
!     emit_call_insn (gen_call_pop_compact_rettramp
! 	   	     (operands[0], operands[1], operands[2], operands[3]));
!   else
!     emit_call_insn (gen_call_pop_compact
! 	  	     (operands[0], operands[1], operands[2], operands[3]));
  
!   DONE;
  }")
  
  (define_expand "call_value"
***************
*** 6430,6489 ****
    "TARGET_SHCOMPACT"
    "
  {
!   if (TARGET_SHCOMPACT && operands[3] && INTVAL (operands[3]))
!     {
!       rtx cookie_rtx = operands[3];
!       long cookie = INTVAL (cookie_rtx);
!       rtx func = XEXP (operands[1], 0);
!       rtx r0, r1;
! 
!       if (flag_pic)
! 	{
! 	  if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
! 	    {
! 	      rtx reg = gen_reg_rtx (Pmode);
  
! 	      emit_insn (gen_symGOTPLT2reg (reg, func));
! 	      func = reg;
! 	    }
! 	  else
! 	    func = legitimize_pic_address (func, Pmode, 0);
! 	}
  
!       r0 = gen_rtx_REG (SImode, R0_REG);
!       r1 = gen_rtx_REG (SImode, R1_REG);
  
!       /* Since such a call function may use all call-clobbered
! 	 registers, we force a mode switch earlier, so that we don't
! 	 run out of registers when adjusting fpscr for the call.  */
!       emit_insn (gen_force_mode_for_call ());
  
!       operands[1] = function_symbol (\"__GCC_shcompact_call_trampoline\");
!       if (flag_pic)
! 	{
! 	  rtx reg = gen_reg_rtx (Pmode);
  
! 	  emit_insn (gen_symGOTPLT2reg (reg, operands[1]));
! 	  operands[1] = reg;
! 	}
!       operands[1] = force_reg (SImode, operands[1]);
  
!       emit_move_insn (r0, func);
!       emit_move_insn (r1, cookie_rtx);
  
!       if (cookie & CALL_COOKIE_RET_TRAMP (1))
! 	emit_call_insn (gen_call_value_pop_compact_rettramp
  			(operands[0], operands[1], operands[2],
  			 operands[3], operands[4]));
!       else
! 	emit_call_insn (gen_call_value_pop_compact
  			(operands[0], operands[1], operands[2],
  			 operands[3], operands[4]));
  
!       DONE;
!     }
! 
!   abort ();
  }")
  
  (define_expand "sibcall_epilogue"
--- 6441,6500 ----
    "TARGET_SHCOMPACT"
    "
  {
!   rtx cookie_rtx;
!   long cookie;
!   rtx func;
!   rtx r0, r1;
! 
!   gcc_assert (TARGET_SHCOMPACT && operands[3] && INTVAL (operands[3]));
!   cookie_rtx = operands[3];
!   cookie = INTVAL (cookie_rtx);
!   func = XEXP (operands[1], 0);
  
!   if (flag_pic)
!     {
!       if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
!         {
!           rtx reg = gen_reg_rtx (Pmode);
! 
! 	  emit_insn (gen_symGOTPLT2reg (reg, func));
!           func = reg;
!         }
!       else
!         func = legitimize_pic_address (func, Pmode, 0);
!     }
  
!   r0 = gen_rtx_REG (SImode, R0_REG);
!   r1 = gen_rtx_REG (SImode, R1_REG);
  
!   /* Since such a call function may use all call-clobbered
!      registers, we force a mode switch earlier, so that we don't
!      run out of registers when adjusting fpscr for the call.  */
!   emit_insn (gen_force_mode_for_call ());
  
!   operands[1] = function_symbol (\"__GCC_shcompact_call_trampoline\");
!   if (flag_pic)
!     {
!       rtx reg = gen_reg_rtx (Pmode);
  
!       emit_insn (gen_symGOTPLT2reg (reg, operands[1]));
!       operands[1] = reg;
!     }
!   operands[1] = force_reg (SImode, operands[1]);
  
!   emit_move_insn (r0, func);
!   emit_move_insn (r1, cookie_rtx);
  
!   if (cookie & CALL_COOKIE_RET_TRAMP (1))
!     emit_call_insn (gen_call_value_pop_compact_rettramp
  			(operands[0], operands[1], operands[2],
  			 operands[3], operands[4]));
!   else
!     emit_call_insn (gen_call_value_pop_compact
  			(operands[0], operands[1], operands[2],
  			 operands[3], operands[4]));
  
!   DONE;
  }")
  
  (define_expand "sibcall_epilogue"
*************** mov.l\\t1f,r0\\n\\
*** 7145,7152 ****
  {
    rtx diff_vec = PATTERN (next_real_insn (operands[2]));
  
!   if (GET_CODE (diff_vec) != ADDR_DIFF_VEC)
!     abort ();
  
    switch (GET_MODE (diff_vec))
      {
--- 7156,7162 ----
  {
    rtx diff_vec = PATTERN (next_real_insn (operands[2]));
  
!   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
  
    switch (GET_MODE (diff_vec))
      {
*************** mov.l\\t1f,r0\\n\\
*** 7159,7165 ****
  	return \"mov.b	@(r0,%1),%0\;extu.b	%0,%0\";
        return \"mov.b	@(r0,%1),%0\";
      default:
!       abort ();
      }
  }"
    [(set_attr "length" "4")])
--- 7169,7175 ----
  	return \"mov.b	@(r0,%1),%0\;extu.b	%0,%0\";
        return \"mov.b	@(r0,%1),%0\";
      default:
!       gcc_unreachable ();
      }
  }"
    [(set_attr "length" "4")])
*************** mov.l\\t1f,r0\\n\\
*** 7177,7184 ****
    rtx diff_vec = PATTERN (next_real_insn (operands[2]));
    const char *load;
  
!   if (GET_CODE (diff_vec) != ADDR_DIFF_VEC)
!     abort ();
  
    switch (GET_MODE (diff_vec))
      {
--- 7187,7193 ----
    rtx diff_vec = PATTERN (next_real_insn (operands[2]));
    const char *load;
  
!   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
  
    switch (GET_MODE (diff_vec))
      {
*************** mov.l\\t1f,r0\\n\\
*** 7195,7201 ****
  	load = \"mov.b	@(r0,%1),%0\";
        break;
      default:
!       abort ();
      }
    output_asm_insn (\"add\tr0,%1\;mova\t%O3,r0\\n\", operands);
    return load;
--- 7204,7210 ----
  	load = \"mov.b	@(r0,%1),%0\";
        break;
      default:
!       gcc_unreachable ();
      }
    output_asm_insn (\"add\tr0,%1\;mova\t%O3,r0\\n\", operands);
    return load;
*************** mov.l\\t1f,r0\\n\\
*** 7212,7219 ****
  {
    rtx diff_vec = PATTERN (next_real_insn (operands[2]));
  
!   if (GET_CODE (diff_vec) != ADDR_DIFF_VEC)
!     abort ();
  
    switch (GET_MODE (diff_vec))
      {
--- 7221,7227 ----
  {
    rtx diff_vec = PATTERN (next_real_insn (operands[2]));
  
!   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
  
    switch (GET_MODE (diff_vec))
      {
*************** mov.l\\t1f,r0\\n\\
*** 7226,7232 ****
  	return \"\";
        return \"add	%1, r63, %0\";
      default:
!       abort ();
      }
  }"
    [(set_attr "type" "arith_media")])
--- 7234,7240 ----
  	return \"\";
        return \"add	%1, r63, %0\";
      default:
!       gcc_unreachable ();
      }
  }"
    [(set_attr "type" "arith_media")])
*************** mov.l\\t1f,r0\\n\\
*** 7241,7248 ****
  {
    rtx diff_vec = PATTERN (next_real_insn (operands[3]));
  
!   if (GET_CODE (diff_vec) != ADDR_DIFF_VEC)
!     abort ();
  
    switch (GET_MODE (diff_vec))
      {
--- 7249,7255 ----
  {
    rtx diff_vec = PATTERN (next_real_insn (operands[3]));
  
!   gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC);
  
    switch (GET_MODE (diff_vec))
      {
*************** mov.l\\t1f,r0\\n\\
*** 7259,7265 ****
  	return \"ldx.ub	%1, %2, %0\";
        return \"ldx.b	%1, %2, %0\";
      default:
!       abort ();
      }
  }"
    [(set_attr "type" "load_media")])
--- 7266,7272 ----
  	return \"ldx.ub	%1, %2, %0\";
        return \"ldx.b	%1, %2, %0\";
      default:
!       gcc_unreachable ();
      }
  }"
    [(set_attr "type" "load_media")])
*************** mov.l\\t1f,r0\\n\\
*** 7348,7355 ****
      {
        rtx r18 = gen_rtx_REG (DImode, PR_MEDIA_REG);
  
!       if (! call_really_used_regs[TR0_REG] || fixed_regs[TR0_REG])
! 	abort ();
        tr_regno = TR0_REG;
        tr = gen_rtx_REG (DImode, tr_regno);
        emit_move_insn (tr, r18);
--- 7355,7361 ----
      {
        rtx r18 = gen_rtx_REG (DImode, PR_MEDIA_REG);
  
!       gcc_assert (call_really_used_regs[TR0_REG] && !fixed_regs[TR0_REG]);
        tr_regno = TR0_REG;
        tr = gen_rtx_REG (DImode, tr_regno);
        emit_move_insn (tr, r18);
Index: config/sh/symbian.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/symbian.c,v
retrieving revision 1.8
diff -c -3 -p -r1.8 symbian.c
*** config/sh/symbian.c	28 Apr 2005 05:38:49 -0000	1.8
--- config/sh/symbian.c	8 May 2005 19:44:40 -0000
*************** sh_symbian_mark_dllexport (tree decl)
*** 216,229 ****
    tree idp;
  
    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 (sh_symbian_dllimport_name_p (oldname))
      {
--- 216,225 ----
    tree idp;
  
    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 (sh_symbian_dllimport_name_p (oldname))
      {
*************** sh_symbian_mark_dllimport (tree decl)
*** 265,278 ****
    rtx newrtl;
  
    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 (sh_symbian_dllexport_name_p (oldname))
      {
--- 261,270 ----
    rtx newrtl;
  
    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 (sh_symbian_dllexport_name_p (oldname))
      {

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