Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa:sparc] Remove write_fp() from sparc-tdep.c
@ 2002-04-05 14:04 Andrew Cagney
  2002-04-05 14:38 ` Michael Snyder
  2002-04-05 16:03 ` Kevin Buettner
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-04-05 14:04 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

Hello,

The attached deletes the write_fp() function from the sparc-tdep.c code.

Ok?

Once this is in, I'll commit the other patch that simply deletes 
write_fp() from the architecture vector.

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2320 bytes --]

2002-04-04  Andrew Cagney  <ac131313@redhat.com>

	* sparc-tdep.c (sparc64_write_fp): Delete.
	(sparc_push_dummy_frame): Replace write_fp call with code to store
	the FP directly.
	(sparc_gdbarch_init): Do not initialize write_fp.

Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.23
diff -u -r1.23 sparc-tdep.c
--- sparc-tdep.c	2002/02/20 10:42:59	1.23
+++ sparc-tdep.c	2002/04/05 21:58:56
@@ -986,8 +986,18 @@
 
   if (strcmp (target_shortname, "sim") != 0)
     {
-      write_fp (old_sp);
-
+      if (gdbarch_tdep (current_gdbarch)->intreg_size == 8)
+	{
+	  CORE_ADDR oldfp = read_register (FP_REGNUM);
+	  if (oldfp & 1)
+	    write_register (FP_REGNUM, old_sp - 2047);
+	  else
+	    write_register (FP_REGNUM, old_sp);
+	}
+      else
+	{
+	  write_register (FP_REGNUM, old_sp);
+	}
       /* Set return address register for the call dummy to the current PC.  */
       write_register (I7_REGNUM, read_pc () - 8);
     }
@@ -2261,16 +2271,6 @@
     write_register (SP_REGNUM, val);
 }
 
-void
-sparc64_write_fp (CORE_ADDR val)
-{
-  CORE_ADDR oldfp = read_register (FP_REGNUM);
-  if (oldfp & 1)
-    write_register (FP_REGNUM, val - 2047);
-  else
-    write_register (FP_REGNUM, val);
-}
-
 /* The SPARC 64 ABI passes floating-point arguments in FP0 to FP31,
    and all other arguments in O0 to O5.  They are also copied onto
    the stack in the correct places.  Apparently (empirically), 
@@ -3038,7 +3038,6 @@
       set_gdbarch_store_struct_return (gdbarch, sparc32_store_struct_return);
       set_gdbarch_use_struct_convention (gdbarch, 
 					 generic_use_struct_convention);
-      set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
       set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
       tdep->y_regnum = SPARC32_Y_REGNUM;
       tdep->fp_max_regnum = SPARC_FP0_REGNUM + 32;
@@ -3097,7 +3096,6 @@
       set_gdbarch_store_struct_return (gdbarch, sparc64_store_struct_return);
       set_gdbarch_use_struct_convention (gdbarch, 
 					 sparc64_use_struct_convention);
-      set_gdbarch_write_fp (gdbarch, sparc64_write_fp);
       set_gdbarch_write_sp (gdbarch, sparc64_write_sp);
       tdep->y_regnum = SPARC64_Y_REGNUM;
       tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfa:sparc] Remove write_fp() from sparc-tdep.c
  2002-04-05 14:04 [rfa:sparc] Remove write_fp() from sparc-tdep.c Andrew Cagney
@ 2002-04-05 14:38 ` Michael Snyder
  2002-04-05 15:01   ` Andrew Cagney
  2002-04-05 16:03 ` Kevin Buettner
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-04-05 14:38 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
> 
> Hello,
> 
> The attached deletes the write_fp() function from the sparc-tdep.c code.
> 
> Ok?
> 
> Once this is in, I'll commit the other patch that simply deletes
> write_fp() from the architecture vector.

Looks good.
 
>   ------------------------------------------------------------------------
> 2002-04-04  Andrew Cagney  <ac131313@redhat.com>
> 
>         * sparc-tdep.c (sparc64_write_fp): Delete.
>         (sparc_push_dummy_frame): Replace write_fp call with code to store
>         the FP directly.
>         (sparc_gdbarch_init): Do not initialize write_fp.
> 
> Index: sparc-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
> retrieving revision 1.23
> diff -u -r1.23 sparc-tdep.c
> --- sparc-tdep.c        2002/02/20 10:42:59     1.23
> +++ sparc-tdep.c        2002/04/05 21:58:56
> @@ -986,8 +986,18 @@
> 
>    if (strcmp (target_shortname, "sim") != 0)
>      {
> -      write_fp (old_sp);
> -
> +      if (gdbarch_tdep (current_gdbarch)->intreg_size == 8)
> +       {
> +         CORE_ADDR oldfp = read_register (FP_REGNUM);
> +         if (oldfp & 1)
> +           write_register (FP_REGNUM, old_sp - 2047);
> +         else
> +           write_register (FP_REGNUM, old_sp);
> +       }
> +      else
> +       {
> +         write_register (FP_REGNUM, old_sp);
> +       }
>        /* Set return address register for the call dummy to the current PC.  */
>        write_register (I7_REGNUM, read_pc () - 8);
>      }
> @@ -2261,16 +2271,6 @@
>      write_register (SP_REGNUM, val);
>  }
> 
> -void
> -sparc64_write_fp (CORE_ADDR val)
> -{
> -  CORE_ADDR oldfp = read_register (FP_REGNUM);
> -  if (oldfp & 1)
> -    write_register (FP_REGNUM, val - 2047);
> -  else
> -    write_register (FP_REGNUM, val);
> -}
> -
>  /* The SPARC 64 ABI passes floating-point arguments in FP0 to FP31,
>     and all other arguments in O0 to O5.  They are also copied onto
>     the stack in the correct places.  Apparently (empirically),
> @@ -3038,7 +3038,6 @@
>        set_gdbarch_store_struct_return (gdbarch, sparc32_store_struct_return);
>        set_gdbarch_use_struct_convention (gdbarch,
>                                          generic_use_struct_convention);
> -      set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
>        set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
>        tdep->y_regnum = SPARC32_Y_REGNUM;
>        tdep->fp_max_regnum = SPARC_FP0_REGNUM + 32;
> @@ -3097,7 +3096,6 @@
>        set_gdbarch_store_struct_return (gdbarch, sparc64_store_struct_return);
>        set_gdbarch_use_struct_convention (gdbarch,
>                                          sparc64_use_struct_convention);
> -      set_gdbarch_write_fp (gdbarch, sparc64_write_fp);
>        set_gdbarch_write_sp (gdbarch, sparc64_write_sp);
>        tdep->y_regnum = SPARC64_Y_REGNUM;
>        tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfa:sparc] Remove write_fp() from sparc-tdep.c
  2002-04-05 14:38 ` Michael Snyder
@ 2002-04-05 15:01   ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-04-05 15:01 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> Andrew Cagney wrote:
> 
>> 
>> Hello,
>> 
>> The attached deletes the write_fp() function from the sparc-tdep.c code.
>> 
>> Ok?
>> 
>> Once this is in, I'll commit the other patch that simply deletes
>> write_fp() from the architecture vector.
> 
> 
> Looks good.
>  

Thanks!  I'll add a comment explaing the history of that bit of code as 
well before committing.

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfa:sparc] Remove write_fp() from sparc-tdep.c
  2002-04-05 14:04 [rfa:sparc] Remove write_fp() from sparc-tdep.c Andrew Cagney
  2002-04-05 14:38 ` Michael Snyder
@ 2002-04-05 16:03 ` Kevin Buettner
  2002-04-05 16:05   ` Andrew Cagney
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Buettner @ 2002-04-05 16:03 UTC (permalink / raw)
  To: Andrew Cagney, gdb-patches

On Apr 5,  5:04pm, Andrew Cagney wrote:

>    if (strcmp (target_shortname, "sim") != 0)
>      {
> -      write_fp (old_sp);
> -
> +      if (gdbarch_tdep (current_gdbarch)->intreg_size == 8)

How about

	 if (GDB_TARGET_IS_SPARC64)

instead?  (That matches the existing convention in the rest of the
file better.)

Aside from that, I think your change is fine.  Something to consider
though is whether the entire

    if (strcmp (target_shortname, "sim") != 0)
      {
        ...
      }

could simply go away.  I.e, let the "sim" case just use the non-sim
code.

Kevin


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfa:sparc] Remove write_fp() from sparc-tdep.c
  2002-04-05 16:03 ` Kevin Buettner
@ 2002-04-05 16:05   ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-04-05 16:05 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> On Apr 5,  5:04pm, Andrew Cagney wrote:
> 
> 
>> if (strcmp (target_shortname, "sim") != 0)
>> {
>> -      write_fp (old_sp);
>> -
>> +      if (gdbarch_tdep (current_gdbarch)->intreg_size == 8)
> 
> 
> How about
> 
> 	 if (GDB_TARGET_IS_SPARC64)

Didn't see it, I'll tweak it.

> instead?  (That matches the existing convention in the rest of the
> file better.)
> 
> Aside from that, I think your change is fine.  Something to consider
> though is whether the entire
> 
>     if (strcmp (target_shortname, "sim") != 0)
>       {
>         ...
>       }
> 
> could simply go away.  I.e, let the "sim" case just use the non-sim
> code.

Somebody elses problem - the only objective of this patch was to remove 
write_fp() :-)

thanks,
Andrew



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-04-06  0:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-05 14:04 [rfa:sparc] Remove write_fp() from sparc-tdep.c Andrew Cagney
2002-04-05 14:38 ` Michael Snyder
2002-04-05 15:01   ` Andrew Cagney
2002-04-05 16:03 ` Kevin Buettner
2002-04-05 16:05   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox