[LLVMdev] Extracting Single-entry single-exit Regions into functions

Vu Le vmle at ucdavis.edu
Wed Dec 22 11:02:27 PST 2010


Hi,
I want to write a pass that pulls single-entry a single-exit (SESE) region
into a function.
The idea is similar to extracting a loop in LoopExtractor.cpp.

Basically, for each region that meet our criteria,
1. Find all basic blocks in that regions
2. Call llvm::ExtractCodeRegion() to replace that region by a call to the
extracted function.
3. Delete the region from the RegionPassManager queue
4. Update the RegionInfo to reflect the change

To find all basic blocks (step 1), I use Region::block_iterator().
However, after changing the CFG, that block_iterator does not seem to work
anymore.

Should I add a list of basic blocks for each Region like what people did
with Loop?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101222/7f06f240/attachment.html>


More information about the llvm-dev mailing list