[LLVMdev] Call Graph Analysis and function cloning

Alireza.Moshtaghi at microchip.com Alireza.Moshtaghi at microchip.com
Thu Aug 6 15:32:21 PDT 2009


I need to perform call graph analysis (after all modules are merged) to
find which function calls which, and depending on the attributes that
each function has and what functions call it, I may need to clone it and
modify some of calls to that function to call the cloned function.

Currently we are doing this in few acrobatic moves that span from an
llvm-ld pass (to do call graph analysis) all the way to AsmPrinter (to
clone the function) and eventually our in-house linker (to check for
some irregularities). But I don't like it at all and I'm sure we will
run into problems later. So I would like to see if anybody has a better
answer for us.

I guess the most important question is how best (if possible) can I
clone a function before or during codegen.
Currently we are cloning the function in AsmPrinter but it does not look
good to me.

Any thoughts?

Alireza Moshtaghi
Senior Software Engineer
Development Systems, Microchip Technology




More information about the llvm-dev mailing list