similar to: How to efficiently extract the calledFunction from a complex CallInst?

Displaying 20 results from an estimated 4000 matches similar to: "How to efficiently extract the calledFunction from a complex CallInst?"

2013 Feb 11
2
[LLVMdev] How to get type of a call instruction
I need to get the type of a call instruction to typecast a (void*) pointer to the type of the function which is called. How can I achieve that? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130211/6a044cde/attachment.html>
2004 Nov 18
3
[LLVMdev] A few beginner level questions..
1. If we run a few passes in a sequence ..is the bytecode file transformed after each pass in sequence i.e if we have a) opt -pass1 -pass2 -pass3 < in.bc > out.bc b)opt -pass1 -pass2 < in.bc > tmp.bc opt -pass3 < tmp.bc > out.bc are the above two equivalent ? what I basically want is to run my pass on an optimised bytecode , so should i optimize it and get a new bytecode
2004 Nov 18
0
[LLVMdev] A few beginner level questions..
On Wed, 2004-11-17 at 23:19, Abhijit Ray wrote: > 1. If we run a few passes in a sequence ..is the bytecode file > transformed after each pass in sequence i.e > > if we have > a) opt -pass1 -pass2 -pass3 < in.bc > out.bc > b)opt -pass1 -pass2 < in.bc > tmp.bc > opt -pass3 < tmp.bc > out.bc > > are the above two equivalent ? Yes, they're
2016 Jan 19
2
Why getFunction() of CallGraphNode return NULL function?
Hi all, I want to find all the called functions in each function, thus I iterate the calledFunctions of each CallGraphNode in CallGraph as follow: for (CallGraph::iterator it = CG->begin(); it != CG->end(); ++it) { CallGraphNode* node = it->second; for (CallGraphNode::iterator it2 = node->begin(); it2 != node->end(); ++it2) { Function* calledFunc =
2012 Jan 06
2
[LLVMdev] How to duplicate a CallInst
Hi, I have the following piece of code: %34 = fptosi float %33 to i32 %35 = call i32 @function(i32 %34) nounwind I would like of know how can I duplicate the statement %35 ? , as follows: %34 = fptosi float %33 to i32 %35 = call i32 @function(i32 %34) nounwind *%36 = **call i32 @function(i32 %34) nounwind* * * i.e, two instructions exactly equal. Using clone, results in badref. Moreover, how
2016 Jan 20
2
Why getFunction() of CallGraphNode return NULL function?
Dear Ashutosh, Thank you, I can handle some indirect callSites by getFunction() of InvokInst and CallInst. However, when I am handling C++ programs, I found the calls of member functions are converted to some strange indirect calls. For example: table->truncate(sysTransaction); // from mysql are translated to the next complex llvm IR: _ZN8Database20getSystemTransactionEv.exit: ;
2016 Jan 20
2
Why getFunction() of CallGraphNode return NULL function?
So, I won't know the called function statically, Right? -------------------------------------------- Qiuping Yi Institute Of Software Chinese Academy of Sciences On Wed, Jan 20, 2016 at 2:24 PM, Nema, Ashutosh <Ashutosh.Nema at amd.com> wrote: > Typically for C++ virtual function you will see an indirect callSite > (unless not de-virtualized). > > > > Regards, >
2015 Sep 08
2
CallInst::getCalledFunction returns null?
I was wondering if someone could explain why CallInst::getCalledFunc behaves the way it does. For simple, direct call instructions in my IR, that method behaves just as one would expect. However, for instructions like this: %25 = call i32 (%struct._IO_FILE*, ...)* bitcast (i32 (...)* @close to i32 > (%struct._IO_FILE*, ...)*)(%struct._IO_FILE* %24), !dbg !695 getCalledFunc returns null. I
2012 Jul 31
0
[LLVMdev] rotate
Oh, no. I should have been more clear. The patch was not rejected, just lost in the daily shuffle. I already have my employer's approval to send this upstream, so I will prepare a patch against trunk this morning. > I proposed a similar patch to LLVM (left circular shift) around 10/2011. > > Parts of my patch did make it into trunk about a year after, but others > > did not.
2018 Mar 24
0
Change function call name in a CallInst only in certain functions
You are probably calling setName() on the called Function, which in-turned renamed the called Function instead of replacing the called function. Depending on your use-case, if you are certain that you only need to modify CallInsts, then you could simply call CallInst::setCalledFunction , otherwise it’s probably wiser to use CallSite as a wrapper for both CallInst and InvokeInst. Do note, however,
2018 Mar 23
3
Change function call name in a CallInst only in certain functions
Hello, In my module I have functions: a b c f3 calls "a" f2 calls "a" f1 calls "b" I would like to modify a CallInst in the f2. Now it calls "a", but I want changed it to "c". When loop over the instructions of the f2, I can get a CallInst to be modified, then I use "setName" to changed it to "c". Problem is, since
2012 Jul 31
4
[LLVMdev] rotate
On Monday, July 30, 2012 12:16 AM, Cameron McInally wrote: > Hey Andy, > > I proposed a similar patch to LLVM (left circular shift) around 10/2011. > Parts of my patch did make it into trunk about a year after, but others > did not. > > At that time, my solution was to add a binary operator to the IRBuilder, > since LCS fits in nicely with the other shift operators. But,
2012 Apr 10
4
[LLVMdev] How to explain this weird phenomenon????????
My friends, I ran a function pass on a .bc file, intending to insert a CallInst to my self-made check function. The compilation is successful. BUT after I ran that pass on the .bc file, the size of the file didn't get any bigger!! Does this mean my instrumentation work failed?? BTW the opt command I use is "opt -load ../../../Debug+Asserts/lib/Hello.so -hello <hello.bc> -o
2012 Apr 10
0
[LLVMdev] How to explain this weird phenomenon????????
I figured that my opt command is wrong! How to specify the output file anyway?? if I want hello.bc to be input file and newhello.bc to be output file, is the opt command go like this? opt -load ../../../Debug+Asserts/lib/Hello.so -hello <hello.bc> -o newhello.bc ?? -- 祝好! 甄凯
2008 Nov 17
2
[LLVMdev] Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed.
ok.. So I am trying out what you have suggested. I have written the below code which basically tries to write the constant 10 to a file. myprint is a function pointer to a function which takes char * parameter and writes it to file. Value *Ten = ConstantInt::get(Type::Int32Ty, 10); const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); AllocaInst *AI = new AllocaInst(Type::Int32Ty); Value
2012 Apr 09
3
[LLVMdev] How to instrument a this function using insertBefore instruction???
Hi all, Im trying to instrument this hello function right before the instruction that call the "puts" function(the source code is as follow). Now I can compile the pass without errors, but when run the pass with opt tool, it broke down. The diagnose is something like Referencing function in another module! %CallCheck = call i32 @fib() Broken module found, compilation aborted! Does
2019 May 29
2
Problem of getNumOperands() for CallInst
Hi all, I got a interesting problem when calling getNumOperands() of CallInst. For example, call void @_Z2f2PA100_i([100 x i32]* nonnull %arraydecay) If I use getNumOperands(), it will return 2. However, if I use getCalledFunction()->getNumParams(), it will return 1. According to the IR, I think the number of operands of the call instruction should be 1. I
2012 Apr 09
2
[LLVMdev] How to instrument a this function using insertBefore instruction???
Hi, I don't think the code you pasted can be the correct code, where does FibF come from? Anyway, the problem is that you're calling the FibF from Module A, however you defined it for Module B. You need to insert the FibF function into the Module that you're running. To do this override "virtual bool doInitialization(Module &M);" and insert FibF into M. Joey 2012/4/9
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
Hi: My llvm code is: for( BasicBlock::iterator i = b->begin() , ie = b->end(); b != be ; b ++ ){ if( CallInst * pCall = dyn_cast<CallInst>(i)){ pCall->dump(); // Function * pFunction = pCall->getCalledFunction(); if( !pFunction ){ } std::string fname = pFunction->getName(); } } The dump result
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