Hi Tanya and everybody,<br><br>Ty for your support.<br><br>I too believe it should not be complicated.<br>But I was not being able to do it.<br><br>For instance, I tried to run this code below:<br><br>  BB->push_back(&(BB->front()));
<br>  BB->pop_front();<br>  <br>But it did not work (kinda obvious why).<br><br>Nor this:<br><br>  BB->push_back(BB->begin());<br>  BB->pop_front();<br><br>But also did not work. It seams the same instruction may not be duplicated in the base block.
<br><br>Finally, after some thinking (and tinkering), this worked like a charm:<br><br>  MachineInstr* mi = BB->remove(BB->begin());<br>  BB->push_back(mi);<br>
<br>=D<br><br>But, is there a better way to do it?<br>And for inserting a NOP ? Is there a simple way?<br><br>Ty again.<br>
<br><br><div><span class="gmail_quote">2007/8/8, Tanya M. Lattner <<a href="mailto:tonic@nondot.org">tonic@nondot.org</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>> I need a way to reorder instructions inside MachineBasicBlocks or<br>> MachineFunctions.<br>> I've been searching for it but I have not found an example in the code yet.<br><br>For MachineBasicBlocks, check out this doc:
<br><a href="http://llvm.org/doxygen/classllvm_1_1MachineBasicBlock.html">http://llvm.org/doxygen/classllvm_1_1MachineBasicBlock.html</a><br><br>I believe its basically the same as basic blocks in that you can<br>manipulate the instruction list.
<br><br>Otherwise, you need to write a MachineFunction Pass:<br><a href="http://llvm.org/docs/WritingAnLLVMPass.html#MachineFunctionPass">http://llvm.org/docs/WritingAnLLVMPass.html#MachineFunctionPass</a><br><br>-Tanya<br>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Emilio Wuerges<br>LAPS - Laboratorio de Automacao de Projeto de Sistemas<br>UFSC - Universidade Federal de Santa Catarina
<br>Brasil