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]

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


This patch removes the "set mips stack-arg-size" and "set mips
saved-gpreg-size" commands.  As far as I can tell, they are obsoleted
by "set mips abi".  saved-gpreg-size was originally added for EABI
-mgp32, which was not setting any e_flags bit that GDB could use to
identify it; but nowadays we have an ABI marker in a section name, and
we have the "set mips abi" command to specify it manually.

So I replaced uses of the separate mips_stack_argsize with
mips_abi_regsize, and then I propagated constant ABI register sizes
into the n32, n64, o32, and o64 routines and deleted some of the
obvious resulting dead code.  If we've decided to have separate
implementations for all of these we may as well make them more
readable.  I have a lot of ABI-related failures on mips64-linux,
which I'll track down some other time.

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.

(I actually started down this rathole trying to add the orig_zero
"register", to fix native linux interrupt.exp...)

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?

-- 
Daniel Jacobowitz
CodeSourcery

2007-05-01  Daniel Jacobowitz  <dan@codesourcery.com>

	* NEWS: Mention removed "set mips stack-arg-size" and "set mips
	saved-gpreg-size".

	* mips-tdep.c (MIPS32_REGSIZE, MIPS64_REGSIZE): New constants.
	(size_auto, size_32, size_64, size_enums, mips_abi_regsize_string)
	(mips_stack_argsize_string, mips_stack_argsize): Delete.
	(mips_abi_regsize): Simplify.
	(mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call)
	(mips_n32n64_return_value, mips_o32_push_dummy_call)
	(mips_o32_return_value, mips_o64_push_dummy_call)
	(mips_o64_return_value): Propogate constant register sizes.  Use the
	ABI register size instead of mips_stack_argsize.
	(mips_dump_tdep): Don't print mips_stack_argsize.
	(_initialize_mips_tdep): Remove saved-gpreg-size and stack-arg-size
	settings.

	* gdb.texinfo (MIPS): Remove documentation for set mips saved-gpreg-size,
	show mips saved-gpreg-size, and set mips stack-arg-size.

---
 NEWS            |    5 
 doc/gdb.texinfo |   27 ----
 mips-tdep.c     |  354 +++++++++++++++-----------------------------------------
 3 files changed, 100 insertions(+), 286 deletions(-)

Index: gdb/NEWS
===================================================================
--- gdb.orig/NEWS	2007-05-01 13:44:41.000000000 -0400
+++ gdb/NEWS	2007-05-01 14:00:56.000000000 -0400
@@ -158,6 +158,11 @@ Scheme support
 	GDB could work with an older version of Guile to debug
 	the interpreter and Scheme programs running in it.
 
+set mips stack-arg-size
+set mips saved-gpreg-size
+
+	Use "set mips abi" to control parameter passing for MIPS.
+
 *** Changes in GDB 6.6
 
 * New targets
Index: gdb/doc/gdb.texinfo
===================================================================
--- gdb.orig/doc/gdb.texinfo	2007-05-01 13:46:13.000000000 -0400
+++ gdb/doc/gdb.texinfo	2007-05-01 14:01:19.000000000 -0400
@@ -15184,33 +15184,6 @@ Several MIPS-specific commands are avail
 programs:
 
 @table @code
-@item set mips saved-gpreg-size @var{size}
-@kindex set mips saved-gpreg-size
-@cindex MIPS GP register size on stack
-Set the size of MIPS general-purpose registers saved on the stack.
-The argument @var{size} can be one of the following:
-
-@table @samp
-@item 32
-32-bit GP registers
-@item 64
-64-bit GP registers
-@item auto
-Use the target's default setting or autodetect the saved size from the
-information contained in the executable.  This is the default
-@end table
-
-@item show mips saved-gpreg-size
-@kindex show mips saved-gpreg-size
-Show the current size of MIPS GP registers on the stack.
-
-@item set mips stack-arg-size @var{size}
-@kindex set mips stack-arg-size
-@cindex MIPS stack space for arguments
-Set the amount of stack space reserved for arguments to functions.
-The argument can be one of @code{"32"}, @code{"64"} or @code{"auto"}
-(the default).
-
 @item set mips abi @var{arg}
 @kindex set mips abi
 @cindex set ABI for MIPS
Index: gdb/mips-tdep.c
===================================================================
--- gdb.orig/mips-tdep.c	2007-05-01 13:26:04.000000000 -0400
+++ gdb/mips-tdep.c	2007-05-01 14:00:26.000000000 -0400
@@ -75,6 +75,11 @@ enum
   MIPS_FPU_DOUBLE_REGSIZE = 8
 };
 
+enum
+{
+  MIPS32_REGSIZE = 4,
+  MIPS64_REGSIZE = 8
+};
 
 static const char *mips_abi_string;
 
@@ -89,21 +94,6 @@ static const char *mips_abi_strings[] = 
   NULL
 };
 
-/* Various MIPS ISA options (related to stack analysis) can be
-   overridden dynamically.  Establish an enum/array for managing
-   them. */
-
-static const char size_auto[] = "auto";
-static const char size_32[] = "32";
-static const char size_64[] = "64";
-
-static const char *size_enums[] = {
-  size_auto,
-  size_32,
-  size_64,
-  0
-};
-
 /* Some MIPS boards don't support floating point while others only
    support single-precision floating-point operations.  */
 
@@ -279,31 +269,24 @@ mips_isa_regsize (struct gdbarch *gdbarc
 
 /* Return the currently configured (or set) saved register size. */
 
-static const char *mips_abi_regsize_string = size_auto;
-
 unsigned int
 mips_abi_regsize (struct gdbarch *gdbarch)
 {
-  if (mips_abi_regsize_string == size_auto)
-    switch (mips_abi (gdbarch))
-      {
-      case MIPS_ABI_EABI32:
-      case MIPS_ABI_O32:
-	return 4;
-      case MIPS_ABI_N32:
-      case MIPS_ABI_N64:
-      case MIPS_ABI_O64:
-      case MIPS_ABI_EABI64:
-	return 8;
-      case MIPS_ABI_UNKNOWN:
-      case MIPS_ABI_LAST:
-      default:
-	internal_error (__FILE__, __LINE__, _("bad switch"));
-      }
-  else if (mips_abi_regsize_string == size_64)
-    return 8;
-  else				/* if (mips_abi_regsize_string == size_32) */
-    return 4;
+  switch (mips_abi (gdbarch))
+    {
+    case MIPS_ABI_EABI32:
+    case MIPS_ABI_O32:
+      return 4;
+    case MIPS_ABI_N32:
+    case MIPS_ABI_N64:
+    case MIPS_ABI_O64:
+    case MIPS_ABI_EABI64:
+      return 8;
+    case MIPS_ABI_UNKNOWN:
+    case MIPS_ABI_LAST:
+    default:
+      internal_error (__FILE__, __LINE__, _("bad switch"));
+    }
 }
 
 /* Functions for setting and testing a bit in a minimal symbol that
@@ -415,23 +398,6 @@ mips2_fp_compat (void)
   return 0;
 }
 
-/* The amount of space reserved on the stack for registers. This is
-   different to MIPS_ABI_REGSIZE as it determines the alignment of
-   data allocated after the registers have run out. */
-
-static const char *mips_stack_argsize_string = size_auto;
-
-static unsigned int
-mips_stack_argsize (struct gdbarch *gdbarch)
-{
-  if (mips_stack_argsize_string == size_auto)
-    return mips_abi_regsize (gdbarch);
-  else if (mips_stack_argsize_string == size_64)
-    return 8;
-  else				/* if (mips_stack_argsize_string == size_32) */
-    return 4;
-}
-
 #define VM_MIN_ADDRESS (CORE_ADDR)0x400000
 
 static CORE_ADDR heuristic_proc_start (CORE_ADDR);
@@ -2403,6 +2369,7 @@ mips_eabi_push_dummy_call (struct gdbarc
   int stack_offset = 0;
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   CORE_ADDR func_addr = find_function_addr (function, NULL);
+  int regsize = mips_abi_regsize (gdbarch);
 
   /* For shared libraries, "t9" needs to point at the function
      address.  */
@@ -2425,8 +2392,7 @@ mips_eabi_push_dummy_call (struct gdbarc
      than necessary for EABI, because the first few arguments are
      passed in registers, but that's OK.  */
   for (argnum = 0; argnum < nargs; argnum++)
-    len += align_up (TYPE_LENGTH (value_type (args[argnum])),
-		     mips_stack_argsize (gdbarch));
+    len += align_up (TYPE_LENGTH (value_type (args[argnum])), regsize);
   sp -= align_up (len, 16);
 
   if (mips_debug)
@@ -2467,13 +2433,12 @@ mips_eabi_push_dummy_call (struct gdbarc
 
       /* The EABI passes structures that do not fit in a register by
          reference.  */
-      if (len > mips_abi_regsize (gdbarch)
+      if (len > regsize
 	  && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
 	{
-	  store_unsigned_integer (valbuf, mips_abi_regsize (gdbarch),
-				  VALUE_ADDRESS (arg));
+	  store_unsigned_integer (valbuf, regsize, VALUE_ADDRESS (arg));
 	  typecode = TYPE_CODE_PTR;
-	  len = mips_abi_regsize (gdbarch);
+	  len = regsize;
 	  val = valbuf;
 	  if (mips_debug)
 	    fprintf_unfiltered (gdb_stdlog, " push");
@@ -2486,8 +2451,7 @@ mips_eabi_push_dummy_call (struct gdbarc
          up before the check to see if there are any FP registers
          left.  Non MIPS_EABI 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 (regsize < 8 && fp_register_arg_p (typecode, arg_type))
 	{
 	  if ((float_argreg & 1))
 	    float_argreg++;
@@ -2545,13 +2509,12 @@ mips_eabi_push_dummy_call (struct gdbarc
 	  /* Copy the argument to general registers or the stack in
 	     register-sized pieces.  Large arguments are split between
 	     registers and stack.  */
-	  /* Note: structs whose size is not a multiple of
-	     mips_abi_regsize() are treated specially: Irix cc passes
+	  /* Note: structs whose size is not a multiple of regsize
+	     are treated specially: Irix cc passes
 	     them in registers where gcc sometimes puts them on the
 	     stack.  For maximum compatibility, we will put them in
 	     both places.  */
-	  int odd_sized_struct = ((len > mips_abi_regsize (gdbarch))
-				  && (len % mips_abi_regsize (gdbarch) != 0));
+	  int odd_sized_struct = (len > regsize && len % regsize != 0);
 
 	  /* Note: Floating-point values that didn't fit into an FP
 	     register are only written to memory.  */
@@ -2559,8 +2522,7 @@ mips_eabi_push_dummy_call (struct gdbarc
 	    {
 	      /* Remember if the argument was written to the stack.  */
 	      int stack_used_p = 0;
-	      int partial_len = (len < mips_abi_regsize (gdbarch)
-				 ? len : mips_abi_regsize (gdbarch));
+	      int partial_len = (len < regsize ? len : regsize);
 
 	      if (mips_debug)
 		fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@@ -2578,16 +2540,15 @@ mips_eabi_push_dummy_call (struct gdbarc
 		  stack_used_p = 1;
 		  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
 		    {
-		      if (mips_stack_argsize (gdbarch) == 8
+		      if (regsize == 8
 			  && (typecode == TYPE_CODE_INT
 			      || typecode == TYPE_CODE_PTR
 			      || typecode == TYPE_CODE_FLT) && len <= 4)
-			longword_offset = mips_stack_argsize (gdbarch) - len;
+			longword_offset = regsize - len;
 		      else if ((typecode == TYPE_CODE_STRUCT
 				|| typecode == TYPE_CODE_UNION)
-			       && (TYPE_LENGTH (arg_type)
-				   < mips_stack_argsize (gdbarch)))
-			longword_offset = mips_stack_argsize (gdbarch) - len;
+			       && TYPE_LENGTH (arg_type) < regsize)
+			longword_offset = regsize - len;
 		    }
 
 		  if (mips_debug)
@@ -2628,8 +2589,7 @@ mips_eabi_push_dummy_call (struct gdbarc
 		  if (mips_debug)
 		    fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
 				      argreg,
-				      phex (regval,
-					    mips_abi_regsize (gdbarch)));
+				      phex (regval, regsize));
 		  write_register (argreg, regval);
 		  argreg++;
 		}
@@ -2644,8 +2604,7 @@ mips_eabi_push_dummy_call (struct gdbarc
 	         only needs to be adjusted when it has been used.  */
 
 	      if (stack_used_p)
-		stack_offset += align_up (partial_len,
-					  mips_stack_argsize (gdbarch));
+		stack_offset += align_up (partial_len, regsize);
 	    }
 	}
       if (mips_debug)
@@ -2708,8 +2667,7 @@ mips_n32n64_push_dummy_call (struct gdba
 
   /* Now make space on the stack for the args.  */
   for (argnum = 0; argnum < nargs; argnum++)
-    len += align_up (TYPE_LENGTH (value_type (args[argnum])),
-		     mips_stack_argsize (gdbarch));
+    len += align_up (TYPE_LENGTH (value_type (args[argnum])), MIPS64_REGSIZE);
   sp -= align_up (len, 16);
 
   if (mips_debug)
@@ -2773,21 +2731,20 @@ mips_n32n64_push_dummy_call (struct gdba
 	  /* Copy the argument to general registers or the stack in
 	     register-sized pieces.  Large arguments are split between
 	     registers and stack.  */
-	  /* Note: structs whose size is not a multiple of
+	  /* Note: structs whose size is not a multiple of MIPS64_REGSIZE
 	     mips_abi_regsize() are treated specially: Irix cc passes
 	     them in registers where gcc sometimes puts them on the
 	     stack.  For maximum compatibility, we will put them in
 	     both places.  */
-	  int odd_sized_struct = ((len > mips_abi_regsize (gdbarch))
-				  && (len % mips_abi_regsize (gdbarch) != 0));
+	  int odd_sized_struct = (len > MIPS64_REGSIZE
+				  && len % MIPS64_REGSIZE != 0);
 	  /* Note: Floating-point values that didn't fit into an FP
 	     register are only written to memory.  */
 	  while (len > 0)
 	    {
 	      /* Remember if the argument was written to the stack.  */
 	      int stack_used_p = 0;
-	      int partial_len = (len < mips_abi_regsize (gdbarch)
-				 ? len : mips_abi_regsize (gdbarch));
+	      int partial_len = (len < MIPS64_REGSIZE ? len : MIPS64_REGSIZE);
 
 	      if (mips_debug)
 		fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@@ -2805,11 +2762,11 @@ mips_n32n64_push_dummy_call (struct gdba
 		  stack_used_p = 1;
 		  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
 		    {
-		      if (mips_stack_argsize (gdbarch) == 8
-			  && (typecode == TYPE_CODE_INT
-			      || typecode == TYPE_CODE_PTR
-			      || typecode == TYPE_CODE_FLT) && len <= 4)
-			longword_offset = mips_stack_argsize (gdbarch) - len;
+		      if ((typecode == TYPE_CODE_INT
+			   || typecode == TYPE_CODE_PTR
+			   || typecode == TYPE_CODE_FLT)
+			  && len <= 4)
+			longword_offset = MIPS64_REGSIZE - len;
 		    }
 
 		  if (mips_debug)
@@ -2854,34 +2811,19 @@ mips_n32n64_push_dummy_call (struct gdba
 		     big endian targets.
 
 		     It does not seem to be necessary to do the
-		     same for integral types.
-
-		     cagney/2001-07-23: gdb/179: Also, GCC, when
-		     outputting LE O32 with sizeof (struct) <
-		     mips_abi_regsize(), generates a left shift
-		     as part of storing the argument in a register
-		     (the left shift isn't generated when
-		     sizeof (struct) >= mips_abi_regsize()).  Since
-		     it is quite possible that this is GCC
-		     contradicting the LE/O32 ABI, GDB has not been
-		     adjusted to accommodate this.  Either someone
-		     needs to demonstrate that the LE/O32 ABI
-		     specifies such a left shift OR this new ABI gets
-		     identified as such and GDB gets tweaked
-		     accordingly.  */
+		     same for integral types.  */
 
 		  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
-		      && partial_len < mips_abi_regsize (gdbarch)
+		      && partial_len < MIPS64_REGSIZE
 		      && (typecode == TYPE_CODE_STRUCT
 			  || typecode == TYPE_CODE_UNION))
-		    regval <<= ((mips_abi_regsize (gdbarch) - partial_len)
+		    regval <<= ((MIPS64_REGSIZE - partial_len)
 				* TARGET_CHAR_BIT);
 
 		  if (mips_debug)
 		    fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
 				      argreg,
-				      phex (regval,
-					    mips_abi_regsize (gdbarch)));
+				      phex (regval, MIPS64_REGSIZE));
 		  write_register (argreg, regval);
 		  argreg++;
 		}
@@ -2896,8 +2838,7 @@ mips_n32n64_push_dummy_call (struct gdba
 	         adjusted when it has been used.  */
 
 	      if (stack_used_p)
-		stack_offset += align_up (partial_len,
-					  mips_stack_argsize (gdbarch));
+		stack_offset += align_up (partial_len, MIPS64_REGSIZE);
 	    }
 	}
       if (mips_debug)
@@ -2919,7 +2860,7 @@ mips_n32n64_return_value (struct gdbarch
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT
       || TYPE_CODE (type) == TYPE_CODE_UNION
       || TYPE_CODE (type) == TYPE_CODE_ARRAY
-      || TYPE_LENGTH (type) > 2 * mips_abi_regsize (gdbarch))
+      || TYPE_LENGTH (type) > 2 * MIPS64_REGSIZE)
     return RETURN_VALUE_STRUCT_CONVENTION;
   else if (TYPE_CODE (type) == TYPE_CODE_FLT
 	   && TYPE_LENGTH (type) == 16
@@ -3070,11 +3011,10 @@ mips_o32_push_dummy_call (struct gdbarch
       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);
+      if (mips_type_needs_double_align (arg_type))
+	len = align_up (len, MIPS32_REGSIZE * 2);
       /* Allocate space on the stack.  */
-      len += align_up (arglen, mips_stack_argsize (gdbarch));
+      len += align_up (arglen, MIPS32_REGSIZE);
     }
   sp -= align_up (len, 16);
 
@@ -3095,7 +3035,7 @@ mips_o32_push_dummy_call (struct gdbarch
 			    "mips_o32_push_dummy_call: struct_return reg=%d 0x%s\n",
 			    argreg, paddr_nz (struct_addr));
       write_register (argreg++, struct_addr);
-      stack_offset += mips_stack_argsize (gdbarch);
+      stack_offset += MIPS32_REGSIZE;
     }
 
   /* Now load as many as possible of the first arguments into
@@ -3121,8 +3061,7 @@ mips_o32_push_dummy_call (struct gdbarch
          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++;
@@ -3188,40 +3127,38 @@ mips_o32_push_dummy_call (struct gdbarch
 		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));
+	  stack_offset += align_up (len, MIPS32_REGSIZE);
 	}
       else
 	{
 	  /* Copy the argument to general registers or the stack in
 	     register-sized pieces.  Large arguments are split between
 	     registers and stack.  */
-	  /* Note: structs whose size is not a multiple of
-	     mips_abi_regsize() are treated specially: Irix cc passes
+	  /* Note: structs whose size is not a multiple of MIPS32_REGSIZE
+	     are treated specially: Irix cc passes
 	     them in registers where gcc sometimes puts them on the
 	     stack.  For maximum compatibility, we will put them in
 	     both places.  */
-	  int odd_sized_struct = ((len > mips_abi_regsize (gdbarch))
-				  && (len % mips_abi_regsize (gdbarch) != 0));
+	  int odd_sized_struct = (len > MIPS32_REGSIZE
+				  && len % MIPS32_REGSIZE != 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))
 		{
 		  argreg++;
-		  stack_offset += mips_abi_regsize (gdbarch);
+		  stack_offset += MIPS32_REGSIZE;
 		}
 	    }
 	  while (len > 0)
 	    {
 	      /* Remember if the argument was written to the stack.  */
 	      int stack_used_p = 0;
-	      int partial_len = (len < mips_abi_regsize (gdbarch)
-				 ? len : mips_abi_regsize (gdbarch));
+	      int partial_len = (len < MIPS32_REGSIZE ? len : MIPS32_REGSIZE);
 
 	      if (mips_debug)
 		fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@@ -3236,14 +3173,6 @@ mips_o32_push_dummy_call (struct gdbarch
 		  int longword_offset = 0;
 		  CORE_ADDR addr;
 		  stack_used_p = 1;
-		  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-		    {
-		      if (mips_stack_argsize (gdbarch) == 8
-			  && (typecode == TYPE_CODE_INT
-			      || typecode == TYPE_CODE_PTR
-			      || typecode == TYPE_CODE_FLT) && len <= 4)
-			longword_offset = mips_stack_argsize (gdbarch) - len;
-		    }
 
 		  if (mips_debug)
 		    {
@@ -3304,19 +3233,17 @@ mips_o32_push_dummy_call (struct gdbarch
 		     identified as such and GDB gets tweaked
 		     accordingly.  */
 
-		  if (mips_abi_regsize (gdbarch) < 8
-		      && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
-		      && partial_len < mips_abi_regsize (gdbarch)
+		  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
+		      && partial_len < MIPS32_REGSIZE
 		      && (typecode == TYPE_CODE_STRUCT
 			  || typecode == TYPE_CODE_UNION))
-		    regval <<= ((mips_abi_regsize (gdbarch) - partial_len)
+		    regval <<= ((MIPS32_REGSIZE - partial_len)
 				* TARGET_CHAR_BIT);
 
 		  if (mips_debug)
 		    fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
 				      argreg,
-				      phex (regval,
-					    mips_abi_regsize (gdbarch)));
+				      phex (regval, MIPS32_REGSIZE));
 		  write_register (argreg, regval);
 		  argreg++;
 
@@ -3336,8 +3263,7 @@ mips_o32_push_dummy_call (struct gdbarch
 	         refered to as their "home".  Consequently, space is
 	         always allocated.  */
 
-	      stack_offset += align_up (partial_len,
-					mips_stack_argsize (gdbarch));
+	      stack_offset += align_up (partial_len, MIPS32_REGSIZE);
 	    }
 	}
       if (mips_debug)
@@ -3469,14 +3395,14 @@ mips_o32_return_value (struct gdbarch *g
     {
       /* A scalar extract each part but least-significant-byte
          justified.  o32 thinks registers are 4 byte, regardless of
-         the ISA.  mips_stack_argsize controls this.  */
+         the ISA.  */
       int offset;
       int regnum;
       for (offset = 0, regnum = MIPS_V0_REGNUM;
 	   offset < TYPE_LENGTH (type);
-	   offset += mips_stack_argsize (gdbarch), regnum++)
+	   offset += MIPS32_REGSIZE, regnum++)
 	{
-	  int xfer = mips_stack_argsize (gdbarch);
+	  int xfer = MIPS32_REGSIZE;
 	  if (offset + xfer > TYPE_LENGTH (type))
 	    xfer = TYPE_LENGTH (type) - offset;
 	  if (mips_debug)
@@ -3530,12 +3456,8 @@ mips_o64_push_dummy_call (struct gdbarch
       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));
+      len += align_up (arglen, MIPS64_REGSIZE);
     }
   sp -= align_up (len, 16);
 
@@ -3556,7 +3478,7 @@ mips_o64_push_dummy_call (struct gdbarch
 			    "mips_o64_push_dummy_call: struct_return reg=%d 0x%s\n",
 			    argreg, paddr_nz (struct_addr));
       write_register (argreg++, struct_addr);
-      stack_offset += mips_stack_argsize (gdbarch);
+      stack_offset += MIPS64_REGSIZE;
     }
 
   /* Now load as many as possible of the first arguments into
@@ -3577,18 +3499,6 @@ mips_o64_push_dummy_call (struct gdbarch
 
       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
@@ -3602,35 +3512,7 @@ mips_o64_push_dummy_call (struct gdbarch
       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
+	  if (1)
 	    {
 	      /* This is a floating point value that fits entirely
 	         in a single register.  */
@@ -3649,40 +3531,28 @@ mips_o64_push_dummy_call (struct gdbarch
 		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 += 1;
 	    }
 	  /* Reserve space for the FP register.  */
-	  stack_offset += align_up (len, mips_stack_argsize (gdbarch));
+	  stack_offset += align_up (len, MIPS64_REGSIZE);
 	}
       else
 	{
 	  /* Copy the argument to general registers or the stack in
 	     register-sized pieces.  Large arguments are split between
 	     registers and stack.  */
-	  /* Note: structs whose size is not a multiple of
-	     mips_abi_regsize() are treated specially: Irix cc passes
+	  /* Note: structs whose size is not a multiple of MIPS64_REGSIZE
+	     are treated specially: Irix cc passes
 	     them in registers where gcc sometimes puts them on the
 	     stack.  For maximum compatibility, we will put them in
 	     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);
-		}
-	    }
+	  int odd_sized_struct = (len > MIPS64_REGSIZE
+				  && len % MIPS64_REGSIZE != 0);
 	  while (len > 0)
 	    {
 	      /* Remember if the argument was written to the stack.  */
 	      int stack_used_p = 0;
-	      int partial_len = (len < mips_abi_regsize (gdbarch)
-				 ? len : mips_abi_regsize (gdbarch));
+	      int partial_len = (len < MIPS64_REGSIZE ? len : MIPS64_REGSIZE);
 
 	      if (mips_debug)
 		fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@@ -3699,11 +3569,11 @@ mips_o64_push_dummy_call (struct gdbarch
 		  stack_used_p = 1;
 		  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
 		    {
-		      if (mips_stack_argsize (gdbarch) == 8
-			  && (typecode == TYPE_CODE_INT
-			      || typecode == TYPE_CODE_PTR
-			      || typecode == TYPE_CODE_FLT) && len <= 4)
-			longword_offset = mips_stack_argsize (gdbarch) - len;
+		      if ((typecode == TYPE_CODE_INT
+			   || typecode == TYPE_CODE_PTR
+			   || typecode == TYPE_CODE_FLT)
+			  && len <= 4)
+			longword_offset = MIPS64_REGSIZE - len;
 		    }
 
 		  if (mips_debug)
@@ -3750,17 +3620,16 @@ mips_o64_push_dummy_call (struct gdbarch
 		     same for integral types. */
 
 		  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
-		      && partial_len < mips_abi_regsize (gdbarch)
+		      && partial_len < MIPS64_REGSIZE
 		      && (typecode == TYPE_CODE_STRUCT
 			  || typecode == TYPE_CODE_UNION))
-		    regval <<= ((mips_abi_regsize (gdbarch) - partial_len)
+		    regval <<= ((MIPS64_REGSIZE - partial_len)
 				* TARGET_CHAR_BIT);
 
 		  if (mips_debug)
 		    fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
 				      argreg,
-				      phex (regval,
-					    mips_abi_regsize (gdbarch)));
+				      phex (regval, MIPS64_REGSIZE));
 		  write_register (argreg, regval);
 		  argreg++;
 
@@ -3780,8 +3649,7 @@ mips_o64_push_dummy_call (struct gdbarch
 	         refered to as their "home".  Consequently, space is
 	         always allocated.  */
 
-	      stack_offset += align_up (partial_len,
-					mips_stack_argsize (gdbarch));
+	      stack_offset += align_up (partial_len, MIPS64_REGSIZE);
 	    }
 	}
       if (mips_debug)
@@ -3825,9 +3693,9 @@ mips_o64_return_value (struct gdbarch *g
       int regnum;
       for (offset = 0, regnum = MIPS_V0_REGNUM;
 	   offset < TYPE_LENGTH (type);
-	   offset += mips_stack_argsize (gdbarch), regnum++)
+	   offset += MIPS64_REGSIZE, regnum++)
 	{
-	  int xfer = mips_stack_argsize (gdbarch);
+	  int xfer = MIPS64_REGSIZE;
 	  if (offset + xfer > TYPE_LENGTH (type))
 	    xfer = TYPE_LENGTH (type) - offset;
 	  if (mips_debug)
@@ -5362,9 +5230,6 @@ mips_dump_tdep (struct gdbarch *current_
 		       : MIPS_FPU_TYPE == MIPS_FPU_SINGLE ? "single"
 		       : MIPS_FPU_TYPE == MIPS_FPU_DOUBLE ? "double"
 		       : "???"));
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: mips_stack_argsize() = %d\n",
-		      mips_stack_argsize (current_gdbarch));
 }
 
 extern initialize_file_ftype _initialize_mips_tdep;	/* -Wmissing-prototypes */
@@ -5393,35 +5258,6 @@ _initialize_mips_tdep (void)
 		  _("Various MIPS specific commands."),
 		  &showmipscmdlist, "show mips ", 0, &showlist);
 
-  /* Allow the user to override the saved register size. */
-  add_setshow_enum_cmd ("saved-gpreg-size", class_obscure,
-			size_enums, &mips_abi_regsize_string, _("\
-Set size of general purpose registers saved on the stack."), _("\
-Show size of general purpose registers saved on the stack."), _("\
-This option can be set to one of:\n\
-  32    - Force GDB to treat saved GP registers as 32-bit\n\
-  64    - Force GDB to treat saved GP registers as 64-bit\n\
-  auto  - Allow GDB to use the target's default setting or autodetect the\n\
-          saved GP register size from information contained in the\n\
-          executable (default)."),
-			NULL,
-			NULL, /* FIXME: i18n: Size of general purpose registers saved on the stack is %s.  */
-			&setmipscmdlist, &showmipscmdlist);
-
-  /* Allow the user to override the argument stack size. */
-  add_setshow_enum_cmd ("stack-arg-size", class_obscure,
-			size_enums, &mips_stack_argsize_string, _("\
-Set the amount of stack space reserved for each argument."), _("\
-Show the amount of stack space reserved for each argument."), _("\
-This option can be set to one of:\n\
-  32    - Force GDB to allocate 32-bit chunks per argument\n\
-  64    - Force GDB to allocate 64-bit chunks per argument\n\
-  auto  - Allow GDB to determine the correct setting from the current\n\
-          target and executable (default)"),
-			NULL,
-			NULL, /* FIXME: i18n: The amount of stack space reserved for each argument is %s.  */
-			&setmipscmdlist, &showmipscmdlist);
-
   /* Allow the user to override the ABI. */
   add_setshow_enum_cmd ("abi", class_obscure, mips_abi_strings,
 			&mips_abi_string, _("\


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