PR c/8068

Jan Hubicka jh@suse.cz
Mon Mar 3 18:18:00 GMT 2003


> On Mon, Mar 03, 2003 at 12:58:27PM +0100, Jan Hubicka wrote:
> > 	* i386.c (classify_argument): Obey MUST_PASS_IN_STACK.
> > 	* i386.h (MUST_PASS_IN_STACK): Use default_must_pass_in_stack
> > 	for x86-64.
> 
> Would you pull MUST_PASS_IN_STACK out of line now?
> Ok with that change.

I am just testing the attached patch.  It looks even more silly than the
previous version.  Any idea why we do have the test for TImode at all?
Especially now when we don't use TImode for _m128i this looks silly.
Whats about just returning to the default?  I checked that it makes no
difference on code that does use SSE or TImode integers.
What else can be affected?  Code that do use TImode structures?
All that seems to be correctly dealt with in function_arg 
That is bit silly to as it does:
      case TImode:
	if (cum->sse_nregs)
	  ret = gen_rtx_REG (mode, cum->sse_regno);
That will reproduce same problems as I do have on x86-64 when sse_regno
is ever used.  It is not at all currently.

Honza

Index: i386-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386-protos.h,v
retrieving revision 1.94
diff -c -3 -p -r1.94 i386-protos.h
*** i386-protos.h	16 Feb 2003 01:35:35 -0000	1.94
--- i386-protos.h	3 Mar 2003 18:14:26 -0000
*************** extern int x86_field_alignment PARAMS ((
*** 226,231 ****
--- 226,232 ----
  
  extern rtx ix86_tls_get_addr PARAMS ((void));
  extern void x86_machine_dependent_reorg PARAMS ((rtx));
+ extern bool ix86_must_pass_in_stack PARAMS ((enum machine_mode mode, tree));
  
  /* In winnt.c  */
  extern int i386_pe_dllexport_name_p PARAMS ((const char *));
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.544
diff -c -3 -p -r1.544 i386.c
*** i386.c	28 Feb 2003 18:30:57 -0000	1.544
--- i386.c	3 Mar 2003 18:14:27 -0000
*************** classify_argument (mode, type, classes, 
*** 1914,1919 ****
--- 1914,1923 ----
    if (bytes < 0)
      return 0;
  
+   if (mode != VOIDmode
+       && MUST_PASS_IN_STACK (mode, type))
+     return 0;
+ 
    if (type && AGGREGATE_TYPE_P (type))
      {
        int i;
*************** x86_emit_floatuns (operands)
*** 15637,15642 ****
--- 15641,15657 ----
    emit_insn (gen_rtx_SET (VOIDmode, out, gen_rtx_PLUS (mode, f0, f0)));
  
    emit_label (donelab);
+ }
+ 
+ /* Return if we do not know how to pass TYPE solely in registers.  */
+ bool
+ ix86_must_pass_in_stack (mode, type)
+ 	enum machine_mode mode;
+ 	tree type;
+ {
+    if (default_must_pass_in_stack (mode, type))
+      return true;
+    return (!TARGET_64BIT && type && mode == TImode);
  }
  
  #include "gt-i386.h"
Index: i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.327
diff -c -3 -p -r1.327 i386.h
*** i386.h	25 Feb 2003 11:39:19 -0000	1.327
--- i386.h	3 Mar 2003 18:14:27 -0000
*************** enum reg_class
*** 1664,1681 ****
     definition that is usually appropriate, refer to expr.h for additional
     documentation. If `REG_PARM_STACK_SPACE' is defined, the argument will be
     computed in the stack and then loaded into a register.  */
! #define MUST_PASS_IN_STACK(MODE, TYPE)				\
!   ((TYPE) != 0							\
!    && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST		\
!        || TREE_ADDRESSABLE (TYPE)				\
!        || ((MODE) == TImode)					\
!        || ((MODE) == BLKmode 					\
! 	   && ! ((TYPE) != 0					\
! 		 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
! 		 && 0 == (int_size_in_bytes (TYPE)		\
! 			  % (PARM_BOUNDARY / BITS_PER_UNIT)))	\
! 	   && (FUNCTION_ARG_PADDING (MODE, TYPE)		\
! 	       == (BYTES_BIG_ENDIAN ? upward : downward)))))
  
  /* Value is the number of bytes of arguments automatically
     popped when returning from a subroutine call.
--- 1664,1670 ----
     definition that is usually appropriate, refer to expr.h for additional
     documentation. If `REG_PARM_STACK_SPACE' is defined, the argument will be
     computed in the stack and then loaded into a register.  */
! #define MUST_PASS_IN_STACK(MODE, TYPE)  ix86_must_pass_in_stack ((MODE), (TYPE))
  
  /* Value is the number of bytes of arguments automatically
     popped when returning from a subroutine call.



More information about the Gcc-patches mailing list