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

Chris Lattner sabre at nondot.org
Mon Oct 2 12:35:29 PDT 2006

On Sun, 1 Oct 2006, Bram Adams wrote:
> 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?

I think this is the better way to go.  If you're concerned about varargs, 
you need to call va_start in the varargs one, then pass the valist down.

I thin kthe easiest way to do this is to do the 'complement' as you 
describe, but specially handle the varargs case.  Basically you need to 
call va_start in the original function, and pass the valist pointer down. 
This shouldn't be too hard.



More information about the llvm-dev mailing list