Displaying 20 results from an estimated 10000 matches similar to: "[LLVMdev] Simpler way to insert instructions into the program"
2009 Aug 01
2
[LLVMdev] Inserting Instructions (pass)
Thank you Chris,
for your hint, but I am still too stupid. I tried two versions
asm_arguments.push_back(Type::VoidTy);
FunctionType *asm_type = FunctionType::get(Type::VoidTy, asm_arguments,
false);
Alternatively
FunctionType *asm_type = FunctionType::get(Type::VoidTy, std::vector<const
Type*>(), false);
. Can you give me a snippet of example code, or somebody else?
2009 Jul 31
0
[LLVMdev] Inserting Instructions (pass)
On Jul 31, 2009, at 10:24 AM, Michael Graumann wrote:
> Hi,
> I’ am trying to insert an InlineAsm Instruction in my pass, which
> FunctionType do I need for Inlineasm?
> If I understand it right, I need a call instruction to insert the
> new produced InlineAsm?
>
> Thanks for help
Inline asm works like a "callee". So for:
call void asm sideeffect
2012 Aug 22
1
[LLVMdev] Insert Self Written Function Call from a FunctionPass?
Hello all;
So my goal is to insert some (self-written) function calls in the LLVM IR.
I can achieve it with a ModulePass and using the getOrInsertFunction()
call. For a ModulePass I follow the steps-
1. Compile the code (in which call instructions are to be inserted) to
LLVM IR
2. Compile the file (which contains the *called* external function ) to
LLVM IR
3. Link them together and run the
2009 Jul 31
2
[LLVMdev] Inserting Instructions (pass)
Hi,
I' am trying to insert an InlineAsm Instruction in my pass, which
FunctionType do I need for Inlineasm?
If I understand it right, I need a call instruction to insert the new
produced InlineAsm?
Thanks for help,
Michael
for (BasicBlock::iterator bi = i->begin(), be = i->end(); bi != be; ++bi){
std::vector<const Type*> asm_arguments;
2009 Aug 01
1
[LLVMdev] Inserting Instructions (pass)
Hi,
both versions are working:
FunctionType *asm_Ftype = FunctionType::get(Type::VoidTy, std::vector<const
Type*>(), false);
InlineAsm* Iasm =
InlineAsm::get(asm_Ftype,"isync","~{dirflag},~{fpsr},~{flags}",true);
How can I insert this InlineAsm, because it is no instruction and this way
it will not work:
Instruction *pi = bi;
2011 Nov 20
0
[LLVMdev] Insert a function call in the code
Thank you for your help
I found the problem,
as hook() is a no paramter function,so
for(Function::arg_iterator i =
hook->arg_begin(), e = hook->arg_end(); i != e; ++i)
{
Args.push_back(i); /////////////Wong
}
we can add a call by
Instruction *newInst = CallInst::Create(hook,
2013 Mar 06
1
[LLVMdev] LLVM load instruction query
Duncan Sands <baldrick <at> free.fr> writes:
>
> Hi Anshul,
>
> > I am creating a pass that will pass loaded value by load instruction to an
> > external function.
> > I don't know how to do it.Please Help.
>
> your question is too vague for anyone to be able to help you. Add details,
> for example provide the code for your pass.
>
>
2011 Nov 19
2
[LLVMdev] Insert a function call in the code
Hello, everyone
I am new to LLVM, now I got a problem
I want to add a function call before sleep(int a, int b)
code below
#include <stdio.h>
int sleep(int a, int b)
{
return a+b;
}
int main(int argc, char **argv)
{
sleep(1,2);
}
after use opt -load ../llvm-2.8/Release+Asserts/lib/bishe_insert.so
-bishe_insert <1.bc> 2.bc
I want get the code
#include <stdio.h>
2019 Oct 23
3
Inserting instructions when encountered a specific label
Hi Tim,
Thank you for the quick response!
so you'd probably check you're looking at a
BranchInst and check BI->getSuccessor(0)->getName() (& 1 if it's
conditional)
I initially was printing out the result from getName() (I.getParent()->getName()) and it printed out nothing sadly.
when parsing the instructions in SelectionDAGBuilder but it was only visiting instructions in
2004 May 19
2
[LLVMdev] Question about insert function or instruction.
Hi llvmer,
I am trying to learn how to use llvm. My question is
described as the following,
there has already a testcase code, and I get bytecode
by using llvmgcc. What I want to do is to insert a
call funcation into each basic block, which is for
statistic some information.
1) I implement call function in another c/cpp file and
can I insert the external call function to existed
bytecode ? if it
2004 May 19
0
[LLVMdev] Question about insert function or instruction.
> What I want to do is to insert a call funcation into each basic
> block, which is for statistic some information.
I recommend that you look at the various pieces of code under
llvm/lib/Transforms/Instrumentation, e.g. BlockProfiling.cpp and
TraceBasicBlocks.cpp. They do essentially the same thing as you are
trying to do.
> 1) I implement call function in another c/cpp file and
>
2016 Aug 25
2
InstList insert depreciated?
Hi llvm-devel,
I have migrated my codebase from llvm-3.6 to llvm 3.8.1-stable.
Although I was able to resolve most of the problems, I am facing
issues resolving the following:
To insert an instruction immediately after the first instruction
within a basic block, I first get all instructions in my basic block
in an instruction container list. Once that is done, I insert my new
instruction in the
2011 May 09
0
[LLVMdev] <badref> showed up when duplicating a list of dependent instructions
Hi Chuck,
> std::vector<Instruction *>::iterator p;
> Instruction * pi = PREVIOUS_POSITION;
> BasicBlock * pb = PREVIOUS_POSITION->getParent();
>
> for(p = coll.begin(); p != coll.end(); ++p){
> Instruction * CurI = * p;
> Instruction * CloneI = CurI->clone();
clone doesn't know have any magical way of knowing that it should update the
instruction's
2016 Aug 25
2
InstList insert depreciated?
Jon,
> You want:
> TaintVar->insertAfter(FirstI);
This worked! Thank you.
On Thu, Aug 25, 2016 at 9:38 AM, Jonathan Roelofs
<jonathan at codesourcery.com> wrote:
>
>
> On 8/25/16 7:01 AM, Shehbaz Jaffer via llvm-dev wrote:
>>
>> I tried an alternative way of adding instruction by first getting the
>> first instruction of the basic block, and then
2004 Aug 04
0
[LLVMdev] moving instructions
How does one move instructions from one basic block to another? I tried
this:
(IB is an Instruction* as is current_last, current_BB is a BasicBlock*)
IB->getParent()->getInstList().remove(IB);
current_BB->getInstList().insert(current_last, IB);
and I get this assertion:
Assertion `V->getParent() == 0 && "Value already in a container!!"' failed.
2011 Sep 16
0
[LLVMdev] How to duplicate a function?
Hi all,
I am a newbie in LLVM and I am trying to replace the function like:
old function || new function
=======================================
int haha(int a) { int haha(int a, char* ID) {
===>
} }
Of course in the newly replaced function "int haha(int,
2013 Sep 17
4
[LLVMdev] Is it safe to insert instructions in batches into BBs?
Hi,
I'm getting a very strange behaviour while adding already created
instructions in batches into basicblocks instead of creating and
inserting them immediately.
Because I need to insert instructions in a certain specific order inside
multiple different BBs I found it easy to use the IRBuilder to create
instructions without inserting them into a BB, storing them somewhere
(vector, map
2012 Apr 07
1
[LLVMdev] How to insert a self-written function to a piece of programme
Hi all,
I wrote a function pass. In the pass, it ran through all the instruction that call to functions. When arriving at the exact function that I m interested in, it would insert a self-made function.
Now I've finished the pass, the compilation is successful. The pass can find the function I like and can insert the CallInst to call my check function. BUT, when running the
2012 Apr 08
0
[LLVMdev] How to insert a self-written function to a piece of programme
Thanks for your reply! I send the message to the mail list this time~
Did you mean I need to initialize M and the Context? Is that really necessary? Does all the function need to be wrapped in the module? I remember you once said "you can just declare the function (i.e. no need to give it a body), and call it.You can then link with an object file that defines it. This is simpler than
2004 May 21
1
[LLVMdev] Re: LLVMdev digest, Vol 1 #292 - 4 msgs
Hi,
Thank Brian Gaeke so much.
Following TraceBasicBlocks.cpp, I modified the code as below and could insert instruction or function I need into anywhere in Module.
But it works well without BB->getInstList().push_back(InstrCall), and if I add the BB->getInstList().push_back() following new CallInst(), I got error information when runing opt. What is the reason for it? And is it necessary