Hello All, I am currently working on a project which requires me to generate a .bc file for given .c file and open the .bc file to identify various functions and the caller callee relationship amongst them. The end goal is to generate a type of callgraph for all the functions present in the original C code. I am quite new to llvm and will really appreciate if I can be provided some pointers. I am looking at various llvm passes, but I am not quite sure if thats the way to go. Your help will be greatly appreciated. Thanks SHWETA -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090302/5f848726/attachment.html>
Hi Shweta,> I am currently working on a project which requires me to generate a .bc file > for given .c file and open the .bc file to identify various functions and > the caller callee relationship amongst them. The end goal is to generate a > type of callgraph for all the functions present in the original C code. I am > quite new to llvm and will really appreciate if I can be provided some > pointers. I am looking at various llvm passes, but I am not quite sure if > thats the way to go.suppose cg.c contains void f(void); void g(void) { f(); } void h(void) { g(); } Then you can print the callgraph like this: $ llvm-gcc -c -emit-llvm cg.c -o - | opt -print-callgraph -disable-output CallGraph Root is: <<null function: 0x0x2029510>> Call graph node <<null function: 0x0x2029510>>: Calls function 'g' Calls function 'f' Calls function 'h' Call graph node for function: 'g' Calls function 'f' Call graph node for function: 'f' Calls external node Call graph node for function: 'h' Calls function 'g'