[LLVMdev] "Refactoring" Basic Blocks into a new function
Vikram Adve
vadve at cs.uiuc.edu
Tue Apr 19 20:17:40 PDT 2005
On Apr 19, 2005, at 8:39 PM, Evan Jones wrote:
> I have two very specific questions about LLVM, but first let me give
> you the general overview of what I am trying to achieve. I have some
> section of a function that I want to replace with a function call to a
> brand new function. For example, I want to take the following
> function:
>
> function foo:
> code A
> <--- CUT
> code B
> <--- CUT
> code C
>
> and (approximately) convert it into:
>
> function foo:
> code A
> call label
> code C
>
> function label:
> code B
>
> I think I have a pretty good idea of how to do this (BasicBlock::split
> really helps!), but I have a few specific questions:
Evan,
Have you looked at ExtractCodeRegion() and its siblings in
include/llvm/Transform/Utils/FunctionUtils.h? It seems to be what you
need.
--Vikram
http://www.cs.uiuc.edu/~vadve
http://llvm.cs.uiuc.edu/
More information about the llvm-dev
mailing list