From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA] sh-tdep.c (sh_use_struct_convention): Restructure and fix
Date: Fri, 10 Oct 2003 16:59:00 -0000 [thread overview]
Message-ID: <20031010165845.GM14344@cygbert.vinschen.de> (raw)
In-Reply-To: <16262.57775.717281.437954@localhost.redhat.com>
On Fri, Oct 10, 2003 at 12:43:27PM -0400, Elena Zannoni wrote:
> Corinna Vinschen writes:
> > static int
> > sh_use_struct_convention (int gcc_p, struct type *type)
> > {
> > int len = TYPE_LENGTH (type);
> > int nelem = TYPE_NFIELDS (type);
> >
> > /* Non-power of 2 length types and types bigger than 8 bytes (which don't
> > fit in two registers anyway) use struct convention. */
> > if (len != 1 && len != 2 && len != 4 && len != 8)
> > return 1;
> >
> > /* Scalar types and aggregate types with exactly one field are aligned
> > by definition. They are returned in registers. */
> > if (nelem <= 1)
> > return 0;
> >
> > /* If the first field in the aggregate has the same length as the entire
> > aggregate type, the type is returned in registers. */
> > if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == len)
> > return 0;
> >
> > /* If the size of the aggregate is 8 bytes and the first field is
> > of size 4 bytes its alignment is equal to long long's alignment,
> > so it's returned in registers. */
> > if (len == 8 && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4)
> > return 0;
> >
> > /* Otherwise use struct convention. */
> > return 1;
> > }
>
> Much better, however, I would still like to know what the behavior is
> for a struct of 2 chars. Probably this needs another test case.
A struct of two chars is returned in memory. That's correct.
Corinna
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
next prev parent reply other threads:[~2003-10-10 16:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-04 11:39 Corinna Vinschen
2003-10-04 15:54 ` Andrew Cagney
2003-10-04 17:04 ` Kevin Buettner
2003-10-04 17:35 ` Andrew Cagney
2003-10-04 18:13 ` Kevin Buettner
2003-10-06 16:31 ` Andrew Cagney
2003-10-04 18:08 ` Corinna Vinschen
2003-10-06 15:52 ` Andrew Cagney
2003-10-07 14:52 ` Corinna Vinschen
2003-10-08 17:39 ` Andrew Cagney
2003-10-09 22:51 ` Elena Zannoni
2003-10-11 20:05 ` Andrew Cagney
2003-10-09 22:51 ` Elena Zannoni
2003-10-10 7:29 ` Corinna Vinschen
2003-10-10 15:01 ` Corinna Vinschen
2003-10-10 16:32 ` Elena Zannoni
2003-10-10 16:59 ` Corinna Vinschen [this message]
2003-10-10 17:56 ` Elena Zannoni
2003-10-10 19:14 ` Corinna Vinschen
2003-10-10 16:28 ` 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=20031010165845.GM14344@cygbert.vinschen.de \
--to=vinschen@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