Dear All, Given a pointer to an instruction, what is the easiest way to insert one or more new instructions after that instructions? We used to find the next instruction using Instruction::getNext(), but this method seems to have been made private now. -- John T.
Tanya M. Lattner wrote:>> Given a pointer to an instruction, what is the easiest way to insert one >> or more new instructions after that instructions? We used to find the >> next instruction using Instruction::getNext(), but this method seems to >> have been made private now. >> > > LLVM Builder is the easiest way to create/insert instructions. > > Or you turn the instruction pointer to an iterator and advance: > http://llvm.org/docs/ProgrammersManual.html#iterate_convert >Thanks! That looks like it'll fit in well with the pre-existing code I'm working on. -- John T.> -Tanya > > > >> -- John T. >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Wed, 5 Dec 2007, John Criswell wrote:> Given a pointer to an instruction, what is the easiest way to insert one > or more new instructions after that instructions? We used to find the > next instruction using Instruction::getNext(), but this method seems to > have been made private now.The best way is to use the LLVMBuilder interface to construct the instructions, which is more uniform and easier to use than 'new fooinst(...)'. Examples of use are here: http://llvm.org/docs/tutorial/LangImpl3.html -Chris -- http://nondot.org/sabre/ http://llvm.org/
Tanya M. Lattner
2007-Dec-05 22:58 UTC
[LLVMdev] Inserting Instructions After Instructions
> Given a pointer to an instruction, what is the easiest way to insert one > or more new instructions after that instructions? We used to find the > next instruction using Instruction::getNext(), but this method seems to > have been made private now.LLVM Builder is the easiest way to create/insert instructions. Or you turn the instruction pointer to an iterator and advance: http://llvm.org/docs/ProgrammersManual.html#iterate_convert -Tanya> > -- John T. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Reasonably Related Threads
- [LLVMdev] Inserting Instructions After Instructions
- [LLVMdev] Antw.: 2.0 Pre-release tarballs online
- [LLVMdev] isa and friends as an alternative to dynamic cast?
- [LLVMdev] Why is BasicBlock's copy constructor private?
- [LLVMdev] Getting the target information of a branch instruction