your recent regclass.c:globalize_reg change

Joern Rennecke amylaar@cygnus.co.uk
Thu Nov 25 15:10:00 GMT 1999


When you moved the error (it is indeed an error, not a warning as you
 wrote in the ChangeLog) for global registers being defined after too
late from make_decl_rtl to globalize_reg, you removed the check
that allows fixed registers to be declared as register variables at
any time.  This breaks newlib/libc/sys/sh/syscalls.c:

...
int
_close (int file)
{
  return __trap34 (SYS_close, file, 0, 0);
}


register char *stack_ptr asm ("r15");

caddr_t
_sbrk (int incr)
...

Declaring a fixed register as a variable can be done at any time, so the
check to allow this should be preserved.

Mon Nov 22 23:53:50 1999  J"orn Rennecke <amylaar@cygnus.co.uk>

	* regclass.c (globalize_reg): Re-instate test that allows
	fixed registers to be declared as a variable even after functions
	are defined.

Index: regclass.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/regclass.c,v
retrieving revision 1.91
diff -p -r1.91 regclass.c
*** regclass.c	1999/11/22 14:25:35	1.91
--- regclass.c	1999/11/25 22:59:23
*************** struct reg_info_data {
*** 226,232 ****
  
  static struct reg_info_data *reg_info_head;
  
! /* No more global register vairiables may be declared; true once
     regclass has been initialized. */
  
  static int no_global_reg_vars = 0;
--- 226,232 ----
  
  static struct reg_info_data *reg_info_head;
  
! /* No more global register variables may be declared; true once
     regclass has been initialized. */
  
  static int no_global_reg_vars = 0;
*************** void
*** 633,639 ****
  globalize_reg (i)
       int i;
  {
!   if (no_global_reg_vars)
      error ("global register variable follows a function definition");
  
    if (global_regs[i])
--- 633,639 ----
  globalize_reg (i)
       int i;
  {
!   if (fixed_regs[i] == 0 && no_global_reg_vars)
      error ("global register variable follows a function definition");
  
    if (global_regs[i])
*************** regclass_init ()
*** 765,771 ****
       before regclass is run.  */
    prefclass = 0;
  
!   /* No more global register vairiables may be declared. */
    no_global_reg_vars = 1;
  }
  
--- 765,771 ----
       before regclass is run.  */
    prefclass = 0;
  
!   /* No more global register variables may be declared. */
    no_global_reg_vars = 1;
  }
  


More information about the Gcc-patches mailing list