This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: Prune unused DECL_STMTs from saved tree structure
- To: Zack Weinberg <zack at wolery dot cumb dot org>
- Subject: Re: Patch: Prune unused DECL_STMTs from saved tree structure
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 29 Aug 2000 10:23:01 -0600
- cc: gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <20000828101008.V17776@wolery.cumb.org>you write:
>
> I started out trying to discard all DECL_STMTs and VAR_DECLS that
> didn't have their used bit set. However, it turns out that there are
> several cases where a variable is referenced but TREE_USED(decl) is
> false. For instance, anything with an initialization expression and
> no further use; anything with a constructor or destructor (however
> trivial); and then there were these mysterious unnamed variables
> introduced by __builtin_va_arg, which is when I gave up trying to
> account for all the cases.
We should attack this separately. It sounds rather lame to me that we have
things which are used, but which don't have TREE_USED set.
> Six and a half megs
> is not to be sneezed at, though, and we can always make it more
> aggressive later.
Agreed.
> I put remove_unused_decls in c-semantics.c because
> the C front end will want it too, as soon as it switches to function
> at a time mode; it's only used from C++ right now. (This
> unfortunately means it doesn't know how to look inside try/catch
> blocks.)
Understood. Is there some reason why we can't promote those tree nodes to
tree.def in the main directory instead of having them be C++ specific?
> * c-semantics.c (remove_unused_decls,
> remove_unused_decls_from_block): New functions.
> * c-common.h: Prototype remove_unused_decls.
> cp:
> * semantics.c (finish_stmt_tree): Call remove_unused_decls.
This is fine. Please install this patch.
Thanks,
jeff