[LLVMdev] Changing basic blocks

Emílio Wuerges wuerges at gmail.com
Thu Aug 9 17:40:43 PDT 2007


For adding the nop:

TII->insertNoop(*BB, BB->end());


2007/8/9, Chris Lattner <sabre at nondot.org>:
>
> On Thu, 9 Aug 2007, [ISO-8859-1] Emílio Wuerges wrote:
> > I too believe it should not be complicated.
> > But I was not being able to do it.
> > Finally, after some thinking (and tinkering), this worked like a charm:
> >
> >  MachineInstr* mi = BB->remove(BB->begin());
> >  BB->push_back(mi);
> >
> > But, is there a better way to do it?
>
> This is a good way to do a single instruction.  You can also use the
> splice method, which allows you to move around ranges of instructions in
> constant time.  It works the same was as std::list::splice.
>
> -Chris
>
> --
> http://nondot.org/sabre/
> http://llvm.org/
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>


-- 
Emilio Wuerges
LAPS - Laboratorio de Automacao de Projeto de Sistemas
UFSC - Universidade Federal de Santa Catarina
Brasil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070809/7f546c7f/attachment.html>


More information about the llvm-dev mailing list