[LLVMdev] how to get an independent copy of a function?

Alexander Poddey alexander.poddey at gmx.net
Sat May 30 22:11:26 PDT 2015


Hi,

I need to get a copy of a function which should be 'selfcontained' 
(independent from the original function). Just like in C making a copy of a 
functions source code, changing the name. 

I tried to copy the basic blocks and their instructions (clone) to a new 
function, but the module check gives 'referring to an argument in another 
function'.
This seems obvious, because the clone on instruction level can not know that 
the instruction later should belong to another function.

I could not find some sort of copy method on function level...

Alex






More information about the llvm-dev mailing list