From: Andrew Cagney <ac131313@cygnus.com>
To: Elena Zannoni <ezannoni@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] gdbtypes.[ch] rs6000-tdep.c--AltiVec regs types
Date: Fri, 11 Jan 2002 17:04:00 -0000 [thread overview]
Message-ID: <3C3F8B79.9000100@cygnus.com> (raw)
In-Reply-To: <15423.26637.972974.400390@localhost.cygnus.com>
Your post prompted me to dig. It is just that I kind of regret this
exposure of a GCC internal naming convention (SI, QI, FI, HI, ...) to
the innocent end user. Is the convention really set in stone or can we
reform our ways? :-)
The relevant thread is:
http://sources.redhat.com/ml/gdb-patches/1999-q4/msg00316.html
As an aside, it did take a few years but there are now both more
explicit builtin fp types (see builtin_type_ieee ...); and implemented
the virtual to raw register mapping the thread talks about for MMX. The
i386 MMX registers can finally be implemented as (looks in sandpit, for
wip code):
static void
i386_register_read (struct gdbarch *gdbarch, int regnum, char *buf)
{
if (is_mmx_regnum (regnum))
{
char *mmx_buf = alloca (MAX_REGISTER_RAW_SIZE);
int fpnum = mmnum_to_fpnum (regnum);
regcache_read (fpnum, mmx_buf);
/* Extract (always little endian). */
memcpy (buf, mmx_buf, REGISTER_RAW_SIZE (regnum));
}
else
regcache_read (regnum, buf);
}
(probably time to submit that patch).
Anyway, regarding your patch, perhaps move the construct to
gdbtypes.[hc] to encourage its re-use by other Altivecish targets.
Andrew
PS: Check the man page for [x]calloc() GDB could benefit from its use.
Two questions.
> +static struct type *
> +build_builtin_type_powerpc_altivec (void)
> +{
> + /* Construct a type for the AltiVec registers. The type we're building
> + is this: */
> +#if 0
> + union __gdb_builtin_type_powerpc_altivec
> + {
> + struct __builtin_v16qi v16qi;
> + struct __builtin_v8hi v8hi;
> + struct __builtin_v4si v4si;
> + struct __builtin_v4sf v4sf;
> + uint128_t uint128;
> + };
> +#endif
> +
> + struct type *t;
> + struct field *f;
> +
> + f = (struct field *) xmalloc (sizeof (*f) * 5);
> + memset (f, 0, sizeof (*f) * 5);
> +
> + FIELD_TYPE (f[0]) = builtin_type_int128;
> + FIELD_NAME (f[0]) = "uint128";
> +
> + FIELD_TYPE (f[1]) = builtin_type_v4sf;
> + FIELD_NAME (f[1]) = "v4sf";
> +
> + FIELD_TYPE (f[2]) = builtin_type_v4si;
> + FIELD_NAME (f[2]) = "v4si";
> +
> + FIELD_TYPE (f[3]) = builtin_type_v8hi;
> + FIELD_NAME (f[3]) = "v8hi";
> +
> + FIELD_TYPE (f[4]) = builtin_type_v16qi;
> + FIELD_NAME (f[4]) = "v16qi";
> +
> + /* Build a union type with those fields. */
> + t = init_type (TYPE_CODE_UNION, 16, 0, 0, 0);
> + TYPE_NFIELDS (t) = 5;
> + TYPE_FIELDS (t) = f;
> + TYPE_TAG_NAME (t) = "__gdb_builtin_type_powerpc_altivec";
> +
> + return t;
> +}
> +
>
next prev parent reply other threads:[~2002-01-12 1:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-11 15:20 Elena Zannoni
2002-01-11 15:28 ` Daniel Jacobowitz
2002-01-11 15:47 ` Michael Snyder
2002-01-11 15:55 ` Daniel Jacobowitz
2002-01-14 8:12 ` Elena Zannoni
2002-01-11 17:04 ` Andrew Cagney [this message]
2002-01-11 20:47 ` Elena Zannoni
2002-01-14 16:41 ` Elena Zannoni
2002-01-14 18:13 ` Kevin Buettner
2002-01-15 11:39 ` Elena Zannoni
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=3C3F8B79.9000100@cygnus.com \
--to=ac131313@cygnus.com \
--cc=ezannoni@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