public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
To: Ulrich.Weigand@de.ibm.com
Cc: gcc@gcc.gnu.org
Subject: Re:  RFA: Ada variable-sized objects, bit_size_type == TImode, and divti3
Date: Mon, 31 Mar 2003 20:16:00 -0000	[thread overview]
Message-ID: <10303311958.AA11051@vlsi1.ultra.nyu.edu> (raw)

Sorry I forgot to get back to this when I got back last week.

    What appears to happen is that the Ada source in question defines a
    variable-sized object with non-standard alignment requirements, and
    Ada reflects this by building a DECL_SIZE_UNIT tree containing various
    mult_expr and div_expr nodes.  As alignment is counted in bits, those
    have type bit_size_type, which on 64-bit platforms corresponds to
    TImode. When expanding that tree, the backend emits calls to __divti3.

The point of having separate DECL_SIZE_UNIT and DECL_SIZE is precisely for
the former to only have computations in sizetype and the latter in bitsizetype.
There are very rare situations where a bitsizetype might be in the expression
for DECL_SIZE_UNIT, but other occurrences are a bug.  Indeed, there's
a trivial bug in layout_decl that would account for some of those usages.
Here's the diff; I'll do the testing and installation for it within the
next few days.

*************** layout_decl (decl, known_align)
*** 368,372 ****
        DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (type);
      }
!   else
      DECL_SIZE_UNIT (decl)
        = convert (sizetype, size_binop (CEIL_DIV_EXPR, DECL_SIZE (decl),
--- 365,369 ----
        DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (type);
      }
!   else if (DECL_SIZE_UNIT (decl) == 0)
      DECL_SIZE_UNIT (decl)
        = convert (sizetype, size_binop (CEIL_DIV_EXPR, DECL_SIZE (decl),


    - does bit_size_type really need to be TImode

Perhaps not, but it should for consistency.  In practice, not that much needs
to be computed dynamically for bitsizes.

    - if so, shouldn't these special cases be implemented more efficiently
      somewhere (we divide by an integer constant 8 here)

No.

    - in general, are we really supposed to need TImode division

Yes.

    How does this work on other 64-bit platforms?

By having __divti3.

             reply	other threads:[~2003-03-31 19:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-31 20:16 Richard Kenner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-04-02 15:43 Ulrich Weigand
2003-04-02 15:36 Richard Kenner
2003-04-02 15:36 Ulrich Weigand
2003-04-01 22:53 Richard Kenner
2003-04-01 19:26 Ulrich Weigand
2003-03-24 11:08 Richard Kenner
2003-03-21  2:09 Ulrich Weigand
2003-03-20 22:35 Ulrich Weigand
2003-03-20 23:44 ` Richard Henderson
2003-03-21  0:25   ` Neil Booth
2003-03-21  1:58   ` Ulrich Weigand
2003-03-21  7:46     ` Richard Henderson
2003-03-21 16:27       ` Ulrich Weigand
2003-03-21 20:25       ` Ulrich Weigand
2003-03-20 21:55 Ulrich Weigand
2003-03-20 22:31 ` Richard Henderson
2003-03-20 23:18 ` Geert Bosch
2003-03-21  0:00 ` Janis Johnson

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=10303311958.AA11051@vlsi1.ultra.nyu.edu \
    --to=kenner@vlsi1.ultra.nyu.edu \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gcc@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).