[LLVMdev] "Refactoring" Basic Blocks into a new function

Chris Lattner sabre at nondot.org
Tue Apr 19 20:58:23 PDT 2005


On Tue, 19 Apr 2005, Vikram Adve wrote:
> Evan,
>
> Have you looked at ExtractCodeRegion() and its siblings in 
> include/llvm/Transform/Utils/FunctionUtils.h?  It seems to be what you need.

Vikram is exactly right.  The functions in that header can extract an 
arbitrary single entry multiple exit set of basic blocks into a new 
function, and takes care of all of the updating needed for live ins and 
live outs of the code.  If you want to extract something that doesn't 
start/end on a basic block boundary, use of BB::splitBasicBlock would be 
appropriate.

I'm glad LLVM is working out for you!! :)

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list