[LLVMdev] "Refactoring" Basic Blocks into a new function
ejones at uwaterloo.ca
Tue Apr 19 19:56:31 PDT 2005
On Apr 19, 2005, at 22:10, Evan Jones wrote:
> I just found the Interval class, and it looks like it could help me
> out here. I want to locate the Interval that begins with the call to
> the "magic" begin(), and ends with the call to the "magic" end(), if
> it exists. If there is no such valid interval, then I want to detect
> that and return an error. Can I make this happen by using the
> IntervalPartition pass? It looks like LLVM has some functionality that
> I could use *some where.* I just can't quite figure out how to make
> use of it.
Ah ha! I figured out the succ_begin() and pred_begin() functions. This
looks like it *might* be a better way to do things. At the very least,
I can verify that I have located the chunk of code between begin() and
1. All predecessors must be in the interval, except for the initial
block, which must have a single predecessor: the block that used to
contain the begin() call.
2. All successors must be in the interval, except for the last block,
which must have a single successor: the block that was created when
splitting the block with the end() call.
However, since I am creating the Interval manually, it is possible that
one of these errors occurs because the blocks are returned out of order
by the Function::begin() iterator. However, since I only need to worry
about handling code that is produced by llvm-gcc, I'm not going to
worry about it.
On to issue #2.
More information about the llvm-dev