Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa] Add e500 function call support to PPC
Date: Mon, 10 Mar 2003 21:47:00 -0000	[thread overview]
Message-ID: <1030310214650.ZM4443@localhost.localdomain> (raw)
In-Reply-To: Andrew Cagney <ac131313@redhat.com> "Re: [rfa] Add e500 function call support to PPC" (Mar 10,  2:56pm)

On Mar 10,  2:56pm, Andrew Cagney wrote:

> > On Mar 10, 10:11am, Andrew Cagney wrote:
> > 
> >> > This construct bothers me.  If it occurred only once, it might not
> >> > bother me so much, but (arch_info->mach != bfd_mach_ppc_e500) appears
> >> > far too often in the code for me to be comfortable with it.  Suppose
> >> > we have another core with a similar property (of passing everything
> >> > in GPRs).  If this happens, we'll end up with a proliferation of
> >> > additional checks for all of these different cores and things will
> >> > become quite unreadable.  Please introduce a predicate into which
> >> > we can put this test and perhaps others as they arise.  Then, only
> >> > the predicate will need to be modified.
> > 
> >> 
> >> Such as:
> >> 
> >> 	if (.....
> >> 	   && tdep->ppc_fp0_regnum >= 0)
> >> 
> >> ?
> > 
> > If the ppc's tdep struct had such a member that would probably be okay.
> 
> It currently doesn't.  However, it occured to me that it should be added 
> anyway.  There is nothing indicating to the shared PPC code that the 
> e500 doesn't have FPRs.

For the time being, how about introducing a predicate (function) to
ppc-sysv-tdep.c (or perhaps rs6000-tdep.c) named
have_floating_point_registers_p() (or something along those lines).

In the short term this could be defined as:

int
have_floating_point_registers_p (struct gdbarch *gdbarch)
{
  const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);

  /* Note: It has been proposed that a ``ppc_fp0_regnum'' member be added
     to the ppc tdep struct.  If/when this occurs, it may be preferable to
     implement this as:

       struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);

       return tdep->ppc_fp0_regnum >= 0;
   */

  return arch_info->mach != bfd_mach_ppc_e500;
}

It occurs to me that such a predicate would be useful for checking
the state of a global variable in the event that a command similar to
``set nomipsfpu'' were added for the powerpc.  (Well, maybe.  Then
again, maybe it'd be better to just set ppc_fp0_regnum to -1 when
such a setting were made.)

In any event, a name like have_floating_point_registers_p() is
reasonably self docuementing whereas ``tdep->ppc_fp0_regnum >= 0''
requires a little bit more thought to discern the meaning.

Kevin


  reply	other threads:[~2003-03-10 21:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-08 19:11 Andrew Cagney
2003-03-09  1:00 ` Kevin Buettner
2003-03-10 15:11   ` Andrew Cagney
2003-03-10 17:54     ` Kevin Buettner
2003-03-10 19:56       ` Andrew Cagney
2003-03-10 21:47         ` Kevin Buettner [this message]
2003-03-17 16:59           ` Andrew Cagney
2003-03-17 17:45             ` Kevin Buettner
2003-03-17 18:28               ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1030310214650.ZM4443@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox