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]

Re: Duplicate assembler function names in cgraph


Hi,
> Hello all,
> 
> I'm doing in my IPA pass:
> for(node = cgraph_nodes; node; node = node->next) {
>    reg_cgraph_node(IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(node->decl)));
> }
> 
> to get all the function names in the cgraph. I'm adding them to a list
> and I'm assuming that two nodes do not have the same
> DECL_ASSEMBLER_NAME but I'm wrong. In a C++ file I'm getting two
> functions with name _ZN4listIiE6appendEPS0_, DECL_NAME = append.
> Why is this? The code is at
> http://pastebin.ca/442691

Callgraph is currently trying to avoid use of DECL_ASSEMBLER_NAME, the
motivation is that for C++, the DECL_ASSEMBLER_NAMEs are very long and
expensive and thus it is not good idea to compute them for symbols not
output to final assembly (DECL_ASSEMBLER_NAME triggers lazy construction
of the names).  So if you don't have good reason for using the names,
you should not do it.

Cgraph rely on frontend that there are no duplicate FUNCTION_DECLs
representing the same function (with same assembler node), that seems to
be broken in your testcase.  Would be possible to have a small tewstcase
reproducing the problem?

Honza
> 
> Is there a way to transverse the cgraph but never going through the
> same twice? Or should I just ignore the node if the function name is
> already registered?
> 
> Cheers,
> -- 
> Paulo Jorge Matos - pocm at soton.ac.uk
> http://www.personal.soton.ac.uk/pocm
> PhD Student @ ECS
> University of Southampton, UK


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