[LLVMdev] Question about removeFromParent
John Criswell
criswell at illinois.edu
Tue Aug 20 07:42:51 PDT 2013
On 8/20/13 8:43 AM, Rasha Omar wrote:
> I have Function
> Function* F;
> and one of its basic blocks BB
>
> I want to insert this BB into a new function without remove it from
> the original
> according that BList is the list of the basic blocks of the newFunction
>
> BList.insert(BB);
>
> but I don't want to call BB->removeFromParent(); and without this
> method it give me error that BB is already in a container
>
> is there another function that get copy without deleting?
I don't think you can share a basic block between functions; you'll need
to make a copy of the existing block and put it into your new function.
There is a CloneBasicBlock() function in
llvm32/lib/Transforms/Utils/CloneFunction.cpp. That (or some other
function in that file) may do what you want.
-- John T.
>
> Thank you in advance
>
> --
> *Rasha Salah Omar
> Msc Student at E-JUST
> Demonestrator at Faculty of Computers and Informatics
> Benha University*
>
> *e-mail: rasha.omar at ejust.edu.eg <mailto:rasha.omar at ejust.edu.eg>*
>
> P* Please consider the environment before printing this email.*
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130820/26286b0e/attachment.html>
More information about the llvm-dev
mailing list