João Corrêa
2014-Nov-11 22:01 UTC
[LLVMdev] CallGraph.cpp incorrectly identifying call instructions
Hi, I'm implementing a graph analysis and for that I'm modifying the -dot-callgraph passe through the file CallGraph.cpp. I have the following call on my IR: %3 = call %struct.proc_dir_entry* @proc_create_data(i8* getelementptr inbounds ([9 x i8]* @.str, i64 0, i64 0), i16 zeroext 292, %struct.proc_dir_entry* %2, %struct.file_operations* @ac6_seq_fops, i8* null) #3 Which is a direct call. When this call is translated by the backend, the resulting line on the dumped assembly is: ffffffff815f520d: e8 0e fc b6 ff callq ffffffff81164e20 <proc_create_data> Which is also direct. In the CallGraph.cpp I'm counting the number of indirect and direct calls, so this call was supposed to be counted as a direct one. This is when the error I'm getting happens. This call is counted as indirect, what means that the lines on the cpp file: const Function *Callee = CS.getCalledFunction(); if (!Callee){ may not be correctly verifying if this call is direct or not. Since the code I'm compiling is huge, I've also not been able to generate an image or pdf of this callgraph, only the dot file (which has 9MB). So I'm not sure if it is being generated correctly. Can anyone give me some guidance while dealing with this? Is it a bug in the API or in the CallGraph.cpp? If yes, I would be glad to go through fixing it. Should I be using a different method for identifying indirect and direct calls? Thanks a lot, any pointers will be helpful at this point. João.