This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Shrinking INTEGER_CSTs and IDENTIFIER_NODEs


>>>>> "Zack" == Zack Weinberg <zack@wolery.cumb.org> writes:

    Zack> Ideas?

You really are going down all the funny paths I've explored.  That's
good -- perhaps you'll follow through somewhere where I did not.

The thing you've spotted is an instance of a more generic problem.
For example lots of DECLs don't use all the fields in a DECL.  We have
DECL_LANG_SPECIFIC, but we don't have different structures for
VAR_DECLs vs. FUNCTION_DECLs vs. NAMESPACE_DECLs vs ...

It would be good if trees allowed for these variants.  It would also
make the code a lot cleaner; we wouldn't have all those fields that
are used three different ways depending which macro you come in
through.

--

Back to your question...  In C++, we should get rid of most the entra
stuff in lang_identifier.  In particular, class_template_info and
class_value should probably go.  namespace_bindings and just plain
bindings could probably be combined into a single bindings TREE_LIST,
or something.  One of the reasons is that for every global, we have an
IDENTIFIER_NODE for the mangled name; but mangled names don't use any
of the extra fields.  So the extra fields are just wasted space.  (In
fact, all we really need for the mangled name is a string; all of
tree_common is wasted.)

One alternate design is to just store the strings directly in
DECL_NAME/DECL_ASSEMBLER_NAME and use IDENTIFIER_NODEs only in the
symbol table.  As you exit a scope, throw away the symbol table,
keeping only the strings.  Right now, IDENTIFIER_NODE is used both to
implement the symbol table (via the TREE_TYPE, namespace_bindings,
TREE_CHAIN, etc.) and as the thing to which DECL_NAME and
DECL_ASSEMBLER_NAME point.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]