Displaying 3 results from an estimated 3 matches for "yourcallinst".
2016 Sep 04
1
How to insert instructions before each function calls?
On Sun, Sep 4, 2016 at 7:44 AM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> Mehdi,
>
> Sorry, I misread his original post.
>
> So something like:
>
> XXXInsrtInfo *XII; // target instruction info
> MachineBasicBlock::iterator MI = MachineBasicBlock(YourCallInst);
> MachineBasicBlock *MBB = YourCallInst->getParent(); // basic block
> location of your call inst
> BuildMI(*MBB, MI, DebugLoc(), XII->get(XXX:::INSTRUCTION)......);
>
> The BuildMI params are going to depend on what you want to do with the
> instruction being inserted....
2016 Sep 05
2
How to insert instructions before each function calls?
...> On Sun, Sep 4, 2016 at 7:44 AM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> Mehdi,
>
> Sorry, I misread his original post.
>
> So something like:
>
> XXXInsrtInfo *XII; // target instruction info
> MachineBasicBlock::iterator MI = MachineBasicBlock(YourCallInst);
> MachineBasicBlock *MBB = YourCallInst->getParent(); // basic block location of your call inst
> BuildMI(*MBB, MI, DebugLoc(), XII->get(XXX:::INSTRUCTION)......);
>
> The BuildMI params are going to depend on what you want to do with the instruction being inserted.
> htt...
2016 Sep 04
2
How to insert instructions before each function calls?
So one way might look like this:
IRBuilder<> Builder(&*BB); // BB = Function::iterator OR IRBuilder<>
Builder(CallInst->getParent());
Builder.SetInsertPoint(CallInst);
InstructionClass *YourNewInstruction =
builder.CreateInstructionClass(.....); // InstructionClass = type of
instruction you are inserting
-Ryan
On Sat, Sep 3, 2016 at 6:04 PM, Ryan Taylor <ryta1203 at