[LLVMdev] Extracting all BasicBlocks of a Function into new Function

Bram Adams bram.adams at ugent.be
Sun Oct 1 12:28:50 PDT 2006


Hi,

I need to find a way to extract all BasicBlocks of a Function (no  
clones!) into a new Function that has the exact same signature, and  
adding a call to the new Function in the old one. I tried out lib/ 
Transforms/Utils/CodeExtractor::ExtractCodeRegion(...), but this one  
unfortunately checks first to see whether there are any allocas and/ 
or va_starts and returns a null pointer in that case. Could this  
check be omitted? If not, is there another way to do the extraction?

One of the obstacles I face when trying to do the complement  
(creating new Function and adding call to original in it), is to find  
out how to pass the varargs argument of the new Function into the  
call to the old Function. Will passing the sbyte** passed to  
llvm.va_start do the trick?

Kind regards,

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)



More information about the llvm-dev mailing list