Inserting Instructions After Instructions

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.

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

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

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.