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]

try 2: error for invalid -fcall-XXX-REG




This patch implements an error message for the use of an invalid 
register in a -fcall-used-REG or -fcall-saved-REG option in order
to avoid a possible later internal error.

	* regclass.c (fix_register): Add error message.
	* invoke.texi (-fcall-used-REG,-fcall-saved-REG): Note the
	  new error message.

Index: regclass.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/regclass.c,v
retrieving revision 1.59
diff -c -r1.59 regclass.c
*** regclass.c	1998/03/27 07:55:53	1.59
--- regclass.c	1998/10/14 18:00:06
***************
*** 498,505 ****
  
    if ((i = decode_reg_name (name)) >= 0)
      {
!       fixed_regs[i] = fixed;
!       call_used_regs[i] = call_used;
      }
    else
      {
--- 498,524 ----
  
    if ((i = decode_reg_name (name)) >= 0)
      {
!       if ((i == STACK_POINTER_REGNUM
! #ifdef HARD_FRAME_POINTER_REGNUM
! 	   || i == HARD_FRAME_POINTER_REGNUM
! #else
! 	   || i == FRAME_POINTER_REGNUM
! #endif
! 	   )
! 	  && (fixed == 0 || call_used == 0))
! 	{
! 	  static char* what_option[2][2] = {
! 	    "call-saved", "call-used", 
! 	    "no-such-option", "fixed" };
! 	  
! 	  error ("can't use '%s' as a %s register", name, 
! 		 what_option[fixed][call_used]);
! 	}
!       else
! 	{
! 	  fixed_regs[i] = fixed;
! 	  call_used_regs[i] = call_used;
! 	}
      }
    else
      {
Index: invoke.texi
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/invoke.texi,v
retrieving revision 1.245.2.1
diff -c -r1.245.2.1 invoke.texi
*** invoke.texi	1998/04/04 01:59:25	1.245.2.1
--- invoke.texi	1998/10/14 18:00:14
***************
*** 5821,5829 ****
  variables that do not live across a call.  Functions compiled this way
  will not save and restore the register @var{reg}.
  
! Use of this flag for a register that has a fixed pervasive role in the
! machine's execution model, such as the stack pointer or frame pointer,
! will produce disastrous results.
  
  This flag does not have a negative form, because it specifies a
  three-way choice.
--- 5821,5829 ----
  variables that do not live across a call.  Functions compiled this way
  will not save and restore the register @var{reg}.
  
! It is an error to used this flag with the frame pointer or stack pointer.
! Use of this flag for another register that has a fixed pervasive role in
! the machine's execution model will produce disastrous results.
  
  This flag does not have a negative form, because it specifies a
  three-way choice.
***************
*** 5834,5842 ****
  live across a call.  Functions compiled this way will save and restore
  the register @var{reg} if they use it.
  
! Use of this flag for a register that has a fixed pervasive role in the
! machine's execution model, such as the stack pointer or frame pointer,
! will produce disastrous results.
  
  A different sort of disaster will result from the use of this flag for
  a register in which function values may be returned.
--- 5834,5842 ----
  live across a call.  Functions compiled this way will save and restore
  the register @var{reg} if they use it.
  
! It is an error to used this flag with the frame pointer or stack pointer.
! Use of this flag for another register that has a fixed pervasive role in
! the machine's execution model will produce disastrous results.
  
  A different sort of disaster will result from the use of this flag for
  a register in which function values may be returned.


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