Hi, I have added an insertAfter method to the ilist and Instruction classes. The methods are implemented as efficiently as the currently existing insert and insertBefore methods. The insertAfter method was created to mirror a similar method in another compiler in order to ease an ongoing port. The patch, which is very small is included as AddInsertBefore.patch. Additionally, I wrote a small test pass which demonstrates the correctness of insertAfter and have attached it as ScratchPass.cpp. Thanks. Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: AddInsertAfter.patch Type: text/x-diff Size: 1874 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090107/40cad26d/attachment.patch> -------------- next part -------------- A non-text attachment was scrubbed... Name: ScratchPass.cpp Type: text/x-c++src Size: 1552 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090107/40cad26d/attachment.cpp>
Thomas B. Jablin wrote:> Hi, > I have added an insertAfter method to the ilist and Instruction classes. The methods are implemented as efficiently as the currently existing insert and insertBefore methods. The insertAfter method was created to mirror a similar method in another compiler in order to ease an ongoing port. The patch, which is very small is included as AddInsertBefore.patch. Additionally, I wrote a small test pass which demonstrates the correctness of insertAfter and have attached it as ScratchPass.cpp. Thanks. > TomSmall nitpick: in Instruction.cpp, the comment for insertAfter says insertBefore and not insertAfter. :) -- John T.
John Criswell wrote:> Small nitpick: in Instruction.cpp, the comment for insertAfter says > insertBefore and not insertAfter. > :) > > -- John T. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >Thanks for spotting the problem. Looking at the code again, I made the same mistake in the comment in Instruction.h. Here is the patch with the corrected comments. Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: AddInsertAfter.patch Type: text/x-patch Size: 1872 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090108/209a8a13/attachment.bin>
Reasonably Related Threads
- [LLVMdev] insertAfter method Patch
- [LLVMdev] insertAfter method Patch
- InstList insert depreciated?
- [LLVMdev] difficulty in replicating a sequence of instructions + inserting at a different location -- "instruction doesn't dominate all uses"
- [LLVMdev] [Fwd: Re: insertAfter method Patch]