[LLVMdev] Copy Instruction from one Basic block to another

Soumya Prasad Ukil
Wed, 17 Nov 2010 06:31:35 -0000

I want to do the following:

suppose the program structure:

                                                    bb
                                                 /       \
                                            bb1          bb2
                                                \         /
                                                   bb3
                                                     |
                                                    bb4
              Now I want to create a new basic block, say bb5 between bb2 &
bb3, copy some instructions from bb3 to bb5. Then I want to add between bb2
and bb3, then outgoing edge from bb5 is to be attached with bb4. Finally my
program will look like :


                                                    bb
                                                 /        \
                                            bb1          bb2
                                                \            /
                                                bb3      bb5
                                                     \    /
                                                     bb4


                     Can you please help me out? How to proceed onto it?
Thanx in advance.







On 16 November 2010 00:04, Devang Patel <dpatel at apple.com> wrote:

>
> On Nov 14, 2010, at 12:13 PM, Soumya Prasad Ukil wrote:
>
> > I have created a new basic block. Now I want to make copy of
instructions
> from one basic block to another . How to do that ?
>
> See  CloneBasicBlock @ Transforms/Utils/Cloning.h
> -
> Devang
>
>


--
regards,
soumya prasad ukil
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20101117/61ec0e20/attachment.html>