This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

Re: [rfc] Propagate constants into MIPS ABI routines, remove some knobs


Daniel,

> Maciej, do you know of anyone who needs to use the stack-arg-size /
> saved-gpreg-size commands?  I couldn't find any uses when I searched
> for them.  I didn't touch the FP options in this pass.  I may have to
> later; I'm rearranging the use of "abi-sized" registers so that MIPS
> doesn't have to have its pseudo-registers, since they make it
> difficult to use the XML register descriptions in the same way ARM
> now can.

 This is the first time I see these commands -- certainly I will not miss 
them nor have an idea about anyone who would.

> Tested mips64-linux, all three ABIs.  I'd like to commit this if no
> one objects, but I'll definitely wait a bit for comments.  Eli,
> docs OK?

 It seems fine for me.  I was about to submit the change I promised a 
while ago -- to remove some pointless calls to mips_abi_regsize() -- but 
yours actually does all of that already (modulo some cosmetic clean-ups).  

 I'd be happier if the change was done in two steps though as it groups 
two independent sets.  Perhaps indeed it should?

 Here's my change:

2007-04-18  Maciej W. Rozycki  <macro@mips.com>

	* mips-tdep.c (mips_o32_push_dummy_call): Remove conditions
	based on mips_abi_regsize() whose result is known in advance.
	(mips_o64_push_dummy_call): Likewise.

  Maciej

mips_abi_regsize.diff
Index: binutils-quilt/src/gdb/mips-tdep.c
===================================================================
--- binutils-quilt.orig/src/gdb/mips-tdep.c	2007-04-18 09:45:07.000000000 +0100
+++ binutils-quilt/src/gdb/mips-tdep.c	2007-04-18 09:46:11.000000000 +0100
@@ -3069,8 +3069,7 @@
       int arglen = TYPE_LENGTH (arg_type);
 
       /* Align to double-word if necessary.  */
-      if (mips_abi_regsize (gdbarch) < 8
-	  && mips_type_needs_double_align (arg_type))
+      if (mips_type_needs_double_align (arg_type))
 	len = align_up (len, mips_stack_argsize (gdbarch) * 2);
       /* Allocate space on the stack.  */
       len += align_up (arglen, mips_stack_argsize (gdbarch));
@@ -3120,8 +3119,7 @@
          up before the check to see if there are any FP registers
          left.  O32/O64 targets also pass the FP in the integer
          registers so also round up normal registers.  */
-      if (mips_abi_regsize (gdbarch) < 8
-	  && fp_register_arg_p (typecode, arg_type))
+      if (fp_register_arg_p (typecode, arg_type))
 	{
 	  if ((float_argreg & 1))
 	    float_argreg++;
@@ -3187,7 +3185,7 @@
 		fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
 				    argreg, phex (regval, len));
 	      write_register (argreg, regval);
-	      argreg += (mips_abi_regsize (gdbarch) == 8) ? 1 : 2;
+	      argreg += 2;
 	    }
 	  /* Reserve space for the FP register.  */
 	  stack_offset += align_up (len, mips_stack_argsize (gdbarch));
@@ -3206,8 +3204,7 @@
 				  && (len % mips_abi_regsize (gdbarch) != 0));
 	  /* Structures should be aligned to eight bytes (even arg registers)
 	     on MIPS_ABI_O32, if their first member has double precision.  */
-	  if (mips_abi_regsize (gdbarch) < 8
-	      && mips_type_needs_double_align (arg_type))
+	  if (mips_type_needs_double_align (arg_type))
 	    {
 	      if ((argreg & 1))
 		{
@@ -3303,8 +3300,7 @@
 		     identified as such and GDB gets tweaked
 		     accordingly.  */
 
-		  if (mips_abi_regsize (gdbarch) < 8
-		      && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
+		  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
 		      && partial_len < mips_abi_regsize (gdbarch)
 		      && (typecode == TYPE_CODE_STRUCT
 			  || typecode == TYPE_CODE_UNION))
@@ -3529,10 +3525,6 @@
       struct type *arg_type = check_typedef (value_type (args[argnum]));
       int arglen = TYPE_LENGTH (arg_type);
 
-      /* Align to double-word if necessary.  */
-      if (mips_abi_regsize (gdbarch) < 8
-	  && mips_type_needs_double_align (arg_type))
-	len = align_up (len, mips_stack_argsize (gdbarch) * 2);
       /* Allocate space on the stack.  */
       len += align_up (arglen, mips_stack_argsize (gdbarch));
     }
@@ -3576,18 +3568,6 @@
 
       val = value_contents (arg);
 
-      /* 32-bit ABIs always start floating point arguments in an
-         even-numbered floating point register.  Round the FP register
-         up before the check to see if there are any FP registers
-         left.  O32/O64 targets also pass the FP in the integer
-         registers so also round up normal registers.  */
-      if (mips_abi_regsize (gdbarch) < 8
-	  && fp_register_arg_p (typecode, arg_type))
-	{
-	  if ((float_argreg & 1))
-	    float_argreg++;
-	}
-
       /* Floating point arguments passed in registers have to be
          treated specially.  On 32-bit architectures, doubles
          are passed in register pairs; the even register gets
@@ -3601,55 +3581,16 @@
       if (fp_register_arg_p (typecode, arg_type)
 	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM)
 	{
-	  if (mips_abi_regsize (gdbarch) < 8 && len == 8)
-	    {
-	      int low_offset = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 4 : 0;
-	      unsigned long regval;
-
-	      /* Write the low word of the double to the even register(s).  */
-	      regval = extract_unsigned_integer (val + low_offset, 4);
-	      if (mips_debug)
-		fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
-				    float_argreg, phex (regval, 4));
-	      write_register (float_argreg++, regval);
-	      if (mips_debug)
-		fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
-				    argreg, phex (regval, 4));
-	      write_register (argreg++, regval);
-
-	      /* Write the high word of the double to the odd register(s).  */
-	      regval = extract_unsigned_integer (val + 4 - low_offset, 4);
-	      if (mips_debug)
-		fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
-				    float_argreg, phex (regval, 4));
-	      write_register (float_argreg++, regval);
-
-	      if (mips_debug)
-		fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
-				    argreg, phex (regval, 4));
-	      write_register (argreg++, regval);
-	    }
-	  else
-	    {
-	      /* This is a floating point value that fits entirely
-	         in a single register.  */
-	      /* On 32 bit ABI's the float_argreg is further adjusted
-	         above to ensure that it is even register aligned.  */
-	      LONGEST regval = extract_unsigned_integer (val, len);
-	      if (mips_debug)
-		fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
-				    float_argreg, phex (regval, len));
-	      write_register (float_argreg++, regval);
-	      /* CAGNEY: 32 bit MIPS ABI's always reserve two FP
-	         registers for each argument.  The below is (my
-	         guess) to ensure that the corresponding integer
-	         register has reserved the same space.  */
-	      if (mips_debug)
-		fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
-				    argreg, phex (regval, len));
-	      write_register (argreg, regval);
-	      argreg += (mips_abi_regsize (gdbarch) == 8) ? 1 : 2;
-	    }
+	  LONGEST regval = extract_unsigned_integer (val, len);
+	  if (mips_debug)
+	    fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
+				float_argreg, phex (regval, len));
+	  write_register (float_argreg++, regval);
+	  if (mips_debug)
+	    fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
+				argreg, phex (regval, len));
+	  write_register (argreg, regval);
+	  argreg++;
 	  /* Reserve space for the FP register.  */
 	  stack_offset += align_up (len, mips_stack_argsize (gdbarch));
 	}
@@ -3665,17 +3606,6 @@
 	     both places.  */
 	  int odd_sized_struct = ((len > mips_abi_regsize (gdbarch))
 				  && (len % mips_abi_regsize (gdbarch) != 0));
-	  /* Structures should be aligned to eight bytes (even arg registers)
-	     on MIPS_ABI_O32, if their first member has double precision.  */
-	  if (mips_abi_regsize (gdbarch) < 8
-	      && mips_type_needs_double_align (arg_type))
-	    {
-	      if ((argreg & 1))
-		{
-		  argreg++;
-		  stack_offset += mips_abi_regsize (gdbarch);
-		}
-	    }
 	  while (len > 0)
 	    {
 	      /* Remember if the argument was written to the stack.  */


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