zhi chen
2015-Apr-21 22:40 UTC
[LLVMdev] what's the best way to insert an instruction after the current instruction
Does the insert point also mean inserting before the instruction? On Tue, Apr 21, 2015 at 3:36 PM, Daniel Berlin <dberlin at dberlin.org> wrote:> IRBuilder takes an insertion point. > Use it? > > > On Tue, Apr 21, 2015 at 3:17 PM, zhi chen <zchenhn at gmail.com> wrote: > > The current instruction is: > > > > Instruction *pInst; > > > > How can I create a new instruction, say add, after pInst? > > > > Thanks, > > Zhi > > > > > > > > _______________________________________________ > > 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/20150421/a658812e/attachment.html>
Daniel Berlin
2015-Apr-21 22:43 UTC
[LLVMdev] what's the best way to insert an instruction after the current instruction
Yes. So if you want the instruction after it, increase the iterator by 1. If Iterator + 1 was after BB->end() you had a bug anyway unless you were replacing the terminator :) On Tue, Apr 21, 2015 at 3:40 PM, zhi chen <zchenhn at gmail.com> wrote:> Does the insert point also mean inserting before the instruction? > > On Tue, Apr 21, 2015 at 3:36 PM, Daniel Berlin <dberlin at dberlin.org> wrote: >> >> IRBuilder takes an insertion point. >> Use it? >> >> >> On Tue, Apr 21, 2015 at 3:17 PM, zhi chen <zchenhn at gmail.com> wrote: >> > The current instruction is: >> > >> > Instruction *pInst; >> > >> > How can I create a new instruction, say add, after pInst? >> > >> > Thanks, >> > Zhi >> > >> > >> > >> > _______________________________________________ >> > LLVM Developers mailing list >> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > > >
Zhi Chen
2015-Apr-21 22:47 UTC
[LLVMdev] what's the best way to insert an instruction after the current instruction
I see. Thanks. On Tue, Apr 21, 2015 at 3:43 PM, Daniel Berlin <dberlin at dberlin.org> wrote:> Yes. > So if you want the instruction after it, increase the iterator by 1. > If Iterator + 1 was after BB->end() you had a bug anyway unless you > were replacing the terminator :) > > > > On Tue, Apr 21, 2015 at 3:40 PM, zhi chen <zchenhn at gmail.com> wrote: > > Does the insert point also mean inserting before the instruction? > > > > On Tue, Apr 21, 2015 at 3:36 PM, Daniel Berlin <dberlin at dberlin.org> > wrote: > >> > >> IRBuilder takes an insertion point. > >> Use it? > >> > >> > >> On Tue, Apr 21, 2015 at 3:17 PM, zhi chen <zchenhn at gmail.com> wrote: > >> > The current instruction is: > >> > > >> > Instruction *pInst; > >> > > >> > How can I create a new instruction, say add, after pInst? > >> > > >> > Thanks, > >> > Zhi > >> > > >> > > >> > > >> > _______________________________________________ > >> > LLVM Developers mailing list > >> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >> > > > > > >-- PhD Student Department of Computer Science University of California, Irvine -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150421/98033fa7/attachment.html>