On 4/16/07, Jan Hubicka <[EMAIL PROTECTED]> wrote:
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/442691Callgraph 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.
My only reason to use DECL_ASSEMBLER_NAME is, when I'm transversing cgraph_nodes, to have an ID for the nodes I've already 'analyzed'.
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?
Sure, however, I'm developing over 4.1.1, still you might still have the error on current head, (I know 4.1.1 is quite old). What do you mean by a test case? Do you want a short version of my IPA pass which shows up the issue? Cheers, Paulo Matos
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
-- Paulo Jorge Matos - pocm at soton.ac.uk http://www.personal.soton.ac.uk/pocm PhD Student @ ECS University of Southampton, UK
