[LLVMdev] Basic Block / CFG Deep Copy?
nicholas at mxc.ca
Sun Jun 7 11:46:15 PDT 2009
> Does LLVM offer any way of obtaining a deep copy of a CFG, that is all the
> basic blocks of a function and their instructions.
CloneModule and CloneFunction do what they say on the box. CloneTrace
takes a vector<BasicBlock*> and produces a new function that includes
just those basic blocks. This is useful for tracing based JITs.
They're declared in include/llvm/Transforms/Utils/Cloning.h.
> I'm asking because I would like to implement continuations in my VM and I
> need to create a modified version of some functions. I thought a simple way
> of doing this would be to modify a copy of the code generated for the
> orignal function. This would be simpler than modifying all my VM logic to
> generate a brand new CFG (and less time consuming).
> - Maxime
More information about the llvm-dev