From: Geoffrey Keating <geoffk@apple.com>
To: Gabriel Dos Reis <gdr@cs.tamu.edu>
Cc: gcc List <gcc@gcc.gnu.org>
Subject: Re: attribute data structure rewrite
Date: Fri, 24 Sep 2004 08:36:00 -0000 [thread overview]
Message-ID: <E14DD3DE-0DF6-11D9-B012-000A95B1F520@apple.com> (raw)
In-Reply-To: <m3vfe4pk6k.fsf@merlin.cs.tamu.edu>
[-- Attachment #1: Type: text/plain, Size: 2579 bytes --]
On 23/09/2004, at 5:47 PM, Gabriel Dos Reis wrote:
> Geoffrey Keating <geoffk@apple.com> writes:
>
> | As a precondition for other compile speed improvements, I've been
> | rewriting the way that GCC represents attributes. The result is a
> | medium-size patch that touches every language and many targets (a
> | surprising number of targets don't define any special attributes at
> | all).
> |
> | The basic principle is that DECL_ATTRIBUTES and TREE_ATTRIBUTES now
> | point to an attribute_list:
> |
> | /* A structure representing 'attributes' on a DECL or TYPE node.
> | Each attribute has a NAME (an IDENTIFIER_NODE) and possibly a
> | VALUE. */
> | struct one_attribute GTY(())
> | {
> | tree name;
> | tree value;
> | };
> |
> | /* A counted list of attributes. */
> | struct attribute_list_s GTY(())
> | {
> | attribute_count n_attributes;
> | /* There are 16 bits free here. */
> | struct one_attribute GTY((length ("%h.n_attributes"))) attribs[1];
> | };
> |
> | This has many benefits, mostly flowing from the fact that it's not a
> | TREE_LIST any more.
> |
> | 1. Do we think this would be acceptable for stage 3, or should I make
> | a branch?
>
>
> I would argue that such a change should be accepted, at this phase of
> stage 3; now. As:
> (1) it addresses compile-time/memory regression;
> (2) it is no less interesting no less useful that the various cleanup
> we've been having, in particular in the C++ front-end.
>
>
> I would even take a further step and ask an official position about
> how we how attributes to play with language rules.
>
>
> Currently, the compiler fails on any of the following fails,
> complaining about non-"integral constant expression"-ness, which is
> pure nonense.
>
> const int N = 4;
> struct S {
> enum { M = 4 };
> float x __attibute__((__aligned__(N)));
> float x __attibute__((__aligned__(M)));
> };
>
> template<typename T, int N>
> struct buffer {
> typedef char U[sizeof(T)];
> U data __attribute__((__aligned__(N)));
> };
>
> They should be accepted.
That's a very good point. I noticed from looking at the C front-end
that an attribute can have as a 'value' any of:
1. NULL
2. an IDENTIFIER
3. an expression
From that, I suspect that what's happening here is that 'N' is an
identifier, so that rule matches in preference to treating 'N' as an
expression and evaluating it.
I would really like to avoid case (2), or at least make sure that you
can tell which of (2) or (3) any particular attribute should have.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2408 bytes --]
next prev parent reply other threads:[~2004-09-24 6:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-24 0:15 Geoffrey Keating
2004-09-24 0:34 ` Andrew Pinski
2004-09-24 1:30 ` Joseph S. Myers
2004-09-24 1:47 ` Zack Weinberg
2004-09-24 6:52 ` Geoffrey Keating
2004-09-24 1:40 ` Gabriel Dos Reis
2004-09-24 2:34 ` Giovanni Bajo
2004-09-24 2:59 ` Gabriel Dos Reis
2004-09-24 4:17 ` Giovanni Bajo
2004-09-24 4:18 ` Gabriel Dos Reis
2004-09-24 8:40 ` Andreas Schwab
2004-09-24 8:40 ` Andreas Schwab
2004-09-24 9:17 ` Joseph S. Myers
2004-09-24 14:45 ` Giovanni Bajo
2004-09-24 8:36 ` Geoffrey Keating [this message]
2004-09-24 14:03 ` Joseph S. Myers
2004-09-24 2:35 ` Giovanni Bajo
2004-09-24 8:33 ` Geoffrey Keating
2004-09-24 12:24 ` Nathan Sidwell
2004-09-24 22:29 ` Mark Mitchell
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=E14DD3DE-0DF6-11D9-B012-000A95B1F520@apple.com \
--to=geoffk@apple.com \
--cc=gcc@gcc.gnu.org \
--cc=gdr@cs.tamu.edu \
/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).