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]
Other format: [Raw text]

Improved use of TREE_SYMBOL_REFERENCED in the C++ front end


We've got a finish_file function in dp/decl2.c.  It walks the list of
global declarations, asking, for each one, whether it meets the
criteria for being output.  For some kinds of declarations, such
as inline functions, one of the criteria is whether the identifier
associated with that declaration has been referenced.

This is very inefficient, because in many cases the number of
declarations is much much larger than the number that will be
output.  General rule: work should be proportional to what gets
used, not to what happens to get declared.  I'd like to change
this so that when we know something is referenced it'll get put
on a special list.

The obvious solution is a callback, probably a lang hook, that
gets called when we know that the TREE_SYMBOL_REFERENCED
bit gets set.

So, two questions.

First, is this sort of change of interest?

Second, any advice on where to put that callback?  There are two
obvious choices, assemble_name and a (not yet existant)
TREE_SET_SYMBOL_REFERENCED macro.  If I take the latter
course, I'll change TREE_SYMBOL_REFERENCED so that it
returns an rvalue and change all lvalue uses of that macro to use
TREE_SET_SYMBOL_REFERENCED instead.  The latter of these
two choices obviously involves more change to the source.  Are
there any reasons why it might be the better choice anyway?

			--Matt


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