Vu Le
2010-Dec-22 19:02 UTC
[LLVMdev] Extracting Single-entry single-exit Regions into functions
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>
Reasonably Related Threads
- [LLVMdev] Add a function splitting pass to LLVM which extracts cold regions into their own functions
- [LLVMdev] An unexpected behavior in RegionInfo's block_iterator
- [LLVMdev] An unexpected behavior in RegionInfo's block_iterator
- [LLVMdev] Update PHINode after extracting code
- [LLVMdev] Update PHINode after extracting code