Hi. I would like to move first function of module to end. To do this, I remove function from module, then I insert it with getOrInsertFunction() method. It worked. But there is a problem: I can't see body of function (basic blocks). In other words, function basic blocks don't move. To solve, I store function basic blocks before remove it. and after function insertion, I want to insert them to function. But when I want to add them with insertInto() method, this error appears: no member named 'insertInto' in 'llvm::BasicBlock'. I'm confused. I sure this method exists in BasicBlock class. Any help? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150213/eed970e6/attachment.html>
> To solve, I store function basic blocks before remove it. and after function > insertion, I want to insert them to function. But when I want to add them > with insertInto() method, this error appears: > no member named 'insertInto' in 'llvm::BasicBlock'. > I'm confused. I sure this method exists in BasicBlock class.It seems to have been added after 3.5 branched, are you looking at documentation for trunk but compiling against an older LLVM? You might have slightly better luck with "Module->getFunctionList().push_back(OldFunc)" though. I wouldn't swear to it working, but if it did you wouldn't need to mess around with saving and restoring the basic blocks. Cheers. Tim.
On Fri, Feb 13, 2015 at 8:54 PM, Tim Northover <t.p.northover at gmail.com> wrote:> > To solve, I store function basic blocks before remove it. and after > function > > insertion, I want to insert them to function. But when I want to add them > > with insertInto() method, this error appears: > > no member named 'insertInto' in 'llvm::BasicBlock'. > > I'm confused. I sure this method exists in BasicBlock class. > > It seems to have been added after 3.5 branched, are you looking at > documentation for trunk but compiling against an older LLVM? >You are correct.> > You might have slightly better luck with > "Module->getFunctionList().push_back(OldFunc)" though. I wouldn't > swear to it working, but if it did you wouldn't need to mess around > with saving and restoring the basic blocks. >Thanks very much. Your answer was very helpful for me.> > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150216/c654bf6e/attachment.html>