alpha regression on 920625-1

Richard Henderson rth@cygnus.com
Mon Apr 27 00:33:00 GMT 1998


   typedef struct{double x,y;}point;
   point pts[]={{1.0,2.0},{3.0,4.0},{5.0,6.0},{7.0,8.0}};
   static int va1(int nargs,...)
   {
     va_list args;
     int i;
     point pi;
     va_start(args,nargs);
     for(i=0;i<nargs;i++){
       pi=va_arg(args,point);
       if(pts[i].x!=pi.x||pts[i].y!=pi.y)abort();
     }
     va_end(args);
   }

`pi' is initially allocated to a TImode register, and when comes reload
time, we find that we must drop the register to memory.  It so happens
that the copy from varargs is done in DImode, while the comparison must
of course be done in DFmode.

The problem arose with jfc's recent mode-dependant aliasing changes.  
Because the memory block created for the TImode register is not marked
as a structure, and we have two different modes manipulating the memory,
the DFmode load gets scheduled before the DImode store.

The simplest solution is probably to change MAX_FIXED_MODE_SIZE from
TImode to prevent the struct from being mistreated.

Another is to get registers that contained structures to have
MEM_IN_STRUCT_P set out of alter_reg.  This solutiion is also
applicable to complex values, something that jfc warns about
in mode_alias_check.  A patch to do this follows.

Does this seem the correct approach?


r~



Sun Apr 26 21:29:06 1998  Richard Henderson  <rth@cygnus.com>

	* machmode.h (COMPLEX_MODE_P): New.
	* reload1.c (alter_reg): Set MEM_IN_STRUCT_P when assigning storage
	to a pseudo larger than word size.


Index: machmode.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/machmode.h,v
retrieving revision 1.2
diff -c -p -d -r1.2 machmode.h
*** machmode.h	1998/04/03 16:36:11	1.2
--- machmode.h	1998/04/27 04:28:36
*************** extern enum mode_class mode_class[];
*** 164,169 ****
--- 164,174 ----
    (GET_MODE_CLASS (MODE) == MODE_FLOAT	\
     || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
  
+ /* Nonzero if MODE is a complex mode.  */
+ #define COMPLEX_MODE_P(MODE)			\
+   (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT	\
+    || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
+ 
  /* Get the size in bytes of an object of mode MODE.  */
  
  extern int mode_size[];
Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.19
diff -c -p -d -r1.19 reload1.c
*** reload1.c	1998/04/03 16:36:46	1.19
--- reload1.c	1998/04/27 04:28:36
*************** alter_reg (i, from_reg)
*** 2525,2530 ****
--- 2525,2537 ----
  	    adjust = inherent_size - total_size;
  
  	  RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (regno_reg_rtx[i]);
+ 
+ 	  /* ??? If this register is larger than the host native word, it
+ 	     is likely that this is a structure being held in registers,
+ 	     and so should have the /s bit set.  The same goes for complex.  */
+ 	  if (total_size > UNITS_PER_WORD
+ 	      || COMPLEX_MODE_P (GET_MODE (regno_reg_rtx[i])))
+ 	    MEM_IN_STRUCT_P (x) = 1;
  	}
        /* Reuse a stack slot if possible.  */
        else if (spill_stack_slot[from_reg] != 0



More information about the Gcc mailing list