* RFA: rs6000: remove some uses of DEPRECATED_REGISTER_BYTE
@ 2004-05-21 0:29 Jim Blandy
2004-05-21 20:16 ` Kevin Buettner
0 siblings, 1 reply; 4+ messages in thread
From: Jim Blandy @ 2004-05-21 0:29 UTC (permalink / raw)
To: gdb-patches
2004-05-20 Jim Blandy <jimb@redhat.com>
* rs6000-tdep.c (rs6000_push_dummy_call): Remove uses of
DEPRECATED_REGISTER_BYTE and deprecated_registers.
Index: gdb/rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.207
diff -c -p -r1.207 rs6000-tdep.c
*** gdb/rs6000-tdep.c 20 May 2004 18:49:37 -0000 1.207
--- gdb/rs6000-tdep.c 20 May 2004 19:31:08 -0000
*************** rs6000_push_dummy_call (struct gdbarch *
*** 1305,1315 ****
--- 1305,1318 ----
for (argno = 0, argbytes = 0; argno < nargs && ii < 8; ++ii)
{
int reg_size = DEPRECATED_REGISTER_RAW_SIZE (ii + 3);
+ unsigned char buf[MAX_REGISTER_SIZE];
arg = args[argno];
type = check_typedef (VALUE_TYPE (arg));
len = TYPE_LENGTH (type);
+ memset (buf, 0, sizeof (buf));
+
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
*************** rs6000_push_dummy_call (struct gdbarch *
*** 1321,1330 ****
printf_unfiltered ("Fatal Error: a floating point parameter "
"#%d with a size > 8 is found!\n", argno);
! memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE
! (tdep->ppc_fp0_regnum + 1 + f_argno)],
! VALUE_CONTENTS (arg),
! len);
++f_argno;
}
--- 1324,1333 ----
printf_unfiltered ("Fatal Error: a floating point parameter "
"#%d with a size > 8 is found!\n", argno);
! memcpy (buf, VALUE_CONTENTS (arg), len);
! regcache_cooked_write (regcache,
! tdep->ppc_fp0_regnum + 1 + f_argno,
! buf);
++f_argno;
}
*************** rs6000_push_dummy_call (struct gdbarch *
*** 1334,1345 ****
/* Argument takes more than one register. */
while (argbytes < len)
{
! memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0,
! reg_size);
! memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)],
! ((char *) VALUE_CONTENTS (arg)) + argbytes,
! (len - argbytes) > reg_size
! ? reg_size : len - argbytes);
++ii, argbytes += reg_size;
if (ii >= 8)
--- 1337,1346 ----
/* Argument takes more than one register. */
while (argbytes < len)
{
! memcpy (buf,
! ((char *) VALUE_CONTENTS (arg)) + argbytes,
! min (len - argbytes, reg_size));
! regcache_cooked_write (regcache, ii + 3, buf);
++ii, argbytes += reg_size;
if (ii >= 8)
*************** rs6000_push_dummy_call (struct gdbarch *
*** 1352,1360 ****
{
/* Argument can fit in one register. No problem. */
int adj = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? reg_size - len : 0;
! memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0, reg_size);
! memcpy ((char *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)] + adj,
! VALUE_CONTENTS (arg), len);
}
++argno;
}
--- 1353,1360 ----
{
/* Argument can fit in one register. No problem. */
int adj = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? reg_size - len : 0;
! memcpy (buf + adj, VALUE_CONTENTS (arg), len);
! regcache_cooked_write (regcache, ii + 3, buf);
}
++argno;
}
*************** ran_out_of_registers_for_arguments:
*** 1420,1445 ****
/* Push the rest of the arguments into stack. */
for (; argno < nargs; ++argno)
{
-
arg = args[argno];
type = check_typedef (VALUE_TYPE (arg));
len = TYPE_LENGTH (type);
-
/* Float types should be passed in fpr's, as well as in the
stack. */
if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)
{
if (len > 8)
printf_unfiltered ("Fatal Error: a floating point parameter"
" #%d with a size > 8 is found!\n", argno);
! memcpy (&(deprecated_registers
! [DEPRECATED_REGISTER_BYTE
! (tdep->ppc_fp0_regnum + 1 + f_argno)]),
! VALUE_CONTENTS (arg),
! len);
++f_argno;
}
--- 1420,1444 ----
/* Push the rest of the arguments into stack. */
for (; argno < nargs; ++argno)
{
arg = args[argno];
type = check_typedef (VALUE_TYPE (arg));
len = TYPE_LENGTH (type);
/* Float types should be passed in fpr's, as well as in the
stack. */
if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)
{
+ unsigned char buf[MAX_REGISTER_SIZE];
if (len > 8)
printf_unfiltered ("Fatal Error: a floating point parameter"
" #%d with a size > 8 is found!\n", argno);
! memset (buf, 0, sizeof (buf));
! memcpy (buf, VALUE_CONTENTS (arg), len);
! regcache_cooked_write (regcache,
! tdep->ppc_fp0_regnum + 1 + f_argno,
! buf);
++f_argno;
}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: RFA: rs6000: remove some uses of DEPRECATED_REGISTER_BYTE
2004-05-21 0:29 RFA: rs6000: remove some uses of DEPRECATED_REGISTER_BYTE Jim Blandy
@ 2004-05-21 20:16 ` Kevin Buettner
2004-05-21 22:09 ` Jim Blandy
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2004-05-21 20:16 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
On 20 May 2004 19:24:51 -0500
Jim Blandy <jimb@redhat.com> wrote:
> 2004-05-20 Jim Blandy <jimb@redhat.com>
>
> * rs6000-tdep.c (rs6000_push_dummy_call): Remove uses of
> DEPRECATED_REGISTER_BYTE and deprecated_registers.
Would you mind revising the patch to call convert_typed_floating()
for the floating point cases? I think that will obviate the need
for some of the memset/memcpy calls. (See ppc_sysv_abi_push_dummy_call()
in ppc-sysv-tdep.c.)
It looks okay otherwise...
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFA: rs6000: remove some uses of DEPRECATED_REGISTER_BYTE
2004-05-21 20:16 ` Kevin Buettner
@ 2004-05-21 22:09 ` Jim Blandy
2004-06-01 22:39 ` Kevin Buettner
0 siblings, 1 reply; 4+ messages in thread
From: Jim Blandy @ 2004-05-21 22:09 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
Kevin Buettner <kevinb@redhat.com> writes:
> On 20 May 2004 19:24:51 -0500
> Jim Blandy <jimb@redhat.com> wrote:
>
> > 2004-05-20 Jim Blandy <jimb@redhat.com>
> >
> > * rs6000-tdep.c (rs6000_push_dummy_call): Remove uses of
> > DEPRECATED_REGISTER_BYTE and deprecated_registers.
>
> Would you mind revising the patch to call convert_typed_floating()
> for the floating point cases? I think that will obviate the need
> for some of the memset/memcpy calls. (See ppc_sysv_abi_push_dummy_call()
> in ppc-sysv-tdep.c.)
>
> It looks okay otherwise...
So, wait, does this mean that the existing code like this is wrong?
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
/* Floating point arguments are passed in fpr's, as well as gpr's.
There are 13 fpr's reserved for passing parameters. At this point
there is no way we would run out of them. */
if (len > 8)
printf_unfiltered ("Fatal Error: a floating point parameter "
"#%d with a size > 8 is found!\n", argno);
memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE
(tdep->ppc_fp0_regnum + 1 + f_argno)],
VALUE_CONTENTS (arg),
len);
++f_argno;
}
This code takes a floating-point value, of whatever size, and just
copies it into the left end of the floating-point register. My PPC
book says "Every instruction that interprets the contents of an FPR as
a floating-point value uses the floating-point double format for this
interpretation."
Calls to unprototyped functions would promote arguments to double
anyway, so this isn't a big deal there, but it seems bogus for
prototyped functions.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: RFA: rs6000: remove some uses of DEPRECATED_REGISTER_BYTE
2004-05-21 22:09 ` Jim Blandy
@ 2004-06-01 22:39 ` Kevin Buettner
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Buettner @ 2004-06-01 22:39 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
On 21 May 2004 17:09:22 -0500
Jim Blandy <jimb@redhat.com> wrote:
> Kevin Buettner <kevinb@redhat.com> writes:
>
> > On 20 May 2004 19:24:51 -0500
> > Jim Blandy <jimb@redhat.com> wrote:
> >
> > > 2004-05-20 Jim Blandy <jimb@redhat.com>
> > >
> > > * rs6000-tdep.c (rs6000_push_dummy_call): Remove uses of
> > > DEPRECATED_REGISTER_BYTE and deprecated_registers.
> >
> > Would you mind revising the patch to call convert_typed_floating()
> > for the floating point cases? I think that will obviate the need
> > for some of the memset/memcpy calls. (See ppc_sysv_abi_push_dummy_call()
> > in ppc-sysv-tdep.c.)
> >
> > It looks okay otherwise...
>
> So, wait, does this mean that the existing code like this is wrong?
>
> if (TYPE_CODE (type) == TYPE_CODE_FLT)
> {
>
> /* Floating point arguments are passed in fpr's, as well as gpr's.
> There are 13 fpr's reserved for passing parameters. At this point
> there is no way we would run out of them. */
>
> if (len > 8)
> printf_unfiltered ("Fatal Error: a floating point parameter "
> "#%d with a size > 8 is found!\n", argno);
>
> memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE
> (tdep->ppc_fp0_regnum + 1 + f_argno)],
> VALUE_CONTENTS (arg),
> len);
> ++f_argno;
> }
>
> This code takes a floating-point value, of whatever size, and just
> copies it into the left end of the floating-point register. My PPC
> book says "Every instruction that interprets the contents of an FPR as
> a floating-point value uses the floating-point double format for this
> interpretation."
>
> Calls to unprototyped functions would promote arguments to double
> anyway, so this isn't a big deal there, but it seems bogus for
> prototyped functions.
Sorry for taking so long on this one...
I'm okaying your original patch since it's a faithful conversion of
deprecated to non-deprecated code. We can revisit the matter of
whether convert_typed_floating() should be used or not at a later
date.
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-06-01 22:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-21 0:29 RFA: rs6000: remove some uses of DEPRECATED_REGISTER_BYTE Jim Blandy
2004-05-21 20:16 ` Kevin Buettner
2004-05-21 22:09 ` Jim Blandy
2004-06-01 22:39 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox