This is the mail archive of the gdb-patches@sources.redhat.com 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]

[obish/ppc] Move "store struct return" into "push dumy call"


Hello,

Now that the PPC has "push dummy call", this change becomes easy. It moves the all the code that saves the structure return address into that function.

I've tested the SYSV ABI part without regressions.

committed,
Andrew
2003-09-09  Andrew Cagney  <cagney@redhat.com>

	* rs6000-tdep.c (rs6000_store_struct_return): Delete function.
	(rs6000_push_dummy_call): Store the struct return address.
	* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Ditto.

Index: ppc-sysv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-sysv-tdep.c,v
retrieving revision 1.6
diff -u -r1.6 ppc-sysv-tdep.c
--- ppc-sysv-tdep.c	9 Sep 2003 18:29:26 -0000	1.6
+++ ppc-sysv-tdep.c	9 Sep 2003 20:18:03 -0000
@@ -69,11 +69,22 @@
   CORE_ADDR saved_sp;
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
 
-  greg = struct_return ? 4 : 3;
+  greg = 3;
   freg = 1;
   vreg = 2;
   argstkspace = 0;
   structstkspace = 0;
+
+  /* If the function is returning a `struct', then the first word
+     (which will be passed in r3) is used for struct return address.
+     In that case we should advance one word and start from r4
+     register to copy parameters.  */
+  if (struct_return)
+    {
+      regcache_raw_write_signed (regcache, tdep->ppc_gp0_regnum + greg,
+				 struct_addr);
+      greg++;
+    }
 
   /* Figure out how much new stack space is required for arguments
      which don't fit in registers.  Unlike the PowerOpen ABI, the
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.151
diff -u -r1.151 rs6000-tdep.c
--- rs6000-tdep.c	9 Sep 2003 18:29:27 -0000	1.151
+++ rs6000-tdep.c	9 Sep 2003 20:18:08 -0000
@@ -1123,6 +1123,7 @@
 			int nargs, struct value **args, CORE_ADDR sp,
 			int struct_return, CORE_ADDR struct_addr)
 {
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
   int ii;
   int len = 0;
   int argno;			/* current argument number */
@@ -1137,14 +1138,19 @@
   CORE_ADDR saved_sp;
 
   /* The first eight words of ther arguments are passed in registers.
-     Copy them appropriately.
-
-     If the function is returning a `struct', then the first word (which 
-     will be passed in r3) is used for struct return address.  In that
-     case we should advance one word and start from r4 register to copy 
-     parameters.  */
+     Copy them appropriately.  */
+  ii = 0;
 
-  ii = struct_return ? 1 : 0;
+  /* If the function is returning a `struct', then the first word
+     (which will be passed in r3) is used for struct return address.
+     In that case we should advance one word and start from r4
+     register to copy parameters.  */
+  if (struct_return)
+    {
+      regcache_raw_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
+				   struct_addr);
+      ii++;
+    }
 
 /* 
    effectively indirect call... gcc does...
@@ -2051,16 +2057,6 @@
   return regnum;
 }
 
-/* Store the address of the place in which to copy the structure the
-   subroutine will return.  */
-
-static void
-rs6000_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-  write_register (tdep->ppc_gp0_regnum + 3, addr);
-}
-
 /* Write into appropriate registers a function return value
    of type TYPE, given in virtual format.  */
 static void
@@ -2973,7 +2969,6 @@
   else
     set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call);
 
-  set_gdbarch_deprecated_store_struct_return (gdbarch, rs6000_store_struct_return);
   set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
   set_gdbarch_deprecated_pop_frame (gdbarch, rs6000_pop_frame);
 

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