search for: getcalledfunct

Displaying 20 results from an estimated 165 matches for "getcalledfunct".

Did you mean: getcalledfunc
2012 Apr 10
4
[LLVMdev] How to explain this weird phenomenon????????
...can be cast to CallInst if(CallInst * III = dyn_cast<CallInst>(II)) { // if the callInst is calling for puts function if(III->getCalledFunction()!=NULL&&III->getCalledFunction()->getName()=="puts") { errs() <<III->getCalledFunction()->getName()<<" function found!\n";...
2015 Nov 13
5
How to efficiently extract the calledFunction from a complex CallInst?
Hi all, Usually if we want to get the called Function we can directly use CallInst->getCalledFunction(), however, today i encounter an unusual CallInst as follows: %call11 = call double (...)* bitcast (double ()* @quantum_frand to double (...)*)() the original C source involve type cast: float u,v; extern double quantum_frand(); u = 2 * quantum_frand() - 1; v = 2 * quantum_frand() - 1;...
2012 Apr 10
0
[LLVMdev] How to explain this weird phenomenon????????
...can be cast to CallInst if(CallInst * III = dyn_cast<CallInst>(II)) { // if the callInst is calling for puts function if(III->getCalledFunction()!=NULL&&III->getCalledFunction()->getName()=="puts") { errs() <<III->getCalledFunction()->getName()<<" function found!\n";...
2005 Aug 29
1
[LLVMdev] getCalledFunction
Hi, The getCalledFunction on CallInst is returning NULL, although it is (directly) calling a function, which is defined in the same file. ---------------------- if (CallInst* callInst = dyn_cast<CallInst>(&inst)) { std::cerr<<callInst->getCalledFunction(); } ----------------------- Wh...
2018 Sep 12
2
CallSiteBase::getCalledFunction and non-trivial calls
How does LLVM define "indirect call"? The documentation of CallSiteBase::getCalledFunction claims it returns null for indirect calls, but in practice it seems to return null for "non-trivial" calls. For example, it returns null for a direct call to a bitcast'ed function: %0 = call void bitcast (void (%struct.foo *)* @func to void (%struct.bar *)*)(%struct.bar *qux)...
2018 Sep 12
2
CallSiteBase::getCalledFunction and non-trivial calls
...rently relies on the the callee arguments being lowered before the call is lowered, and we simply do not support indirect calls. However, we should be able to support these bitcast calls, as they are effectively direct for our purposes, but the CallGraph does not seem to consider them (it uses .getCalledFunction()). Maybe a new function for `dyn_cast<Function>(CS.getCalledValue()->stripPointerCasts())` would make sense? I am not sure if this is valid to use in CallGraph, but it does not care about arguments as far as I can tell. At the very least I can try to clarify the docs, because unti...
2012 Apr 07
1
[LLVMdev] How to insert a self-written function to a piece of programme
...BasicBlock::iterator II = BI->begin(),IE = BI->end();II != IE; ++II) { if(CallInst * III = dyn_cast<CallInst>(II)) { if(III->getCalledFunction()!=NULL&&III->getCalledFunction()->getName()=="puts") { errs() <<III->getCalledFunction()->getName()<<" function found!\n";...
2012 Apr 09
3
[LLVMdev] How to instrument a this function using insertBefore instruction???
...CallInst * III = CallInst::Create(&F,"InsttoCallInst",II); if(CallInst * III = dyn_cast<CallInst>(II)) { if(III->getCalledFunction()!=NULL&&III->getCalledFunction()->getName()=="puts") { errs() <<III->getCalledFunction()->getName()<<" function found!\n";...
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 of the function call I want to find is : call void %7(%struct.nsAString* %8, i32 0) nounwind, !dbg !1565 it returns null from pCall->getCalledFunction(), an...
2004 Nov 18
3
[LLVMdev] A few beginner level questions..
...an application , for every instruction if its a call instruction I try to print out the called function as below .. void pass01a::instruct_show(Instruction* I){ if ( isa<CallInst>(*I) ){ const CallInst *CI = cast<CallInst>(I); const Function *Func = CI->getCalledFunction() ; std::cerr<<":calledFunction:"<<Func->getName(); } } Now it works fine for some application but for one of the benchmark in MIBENCH , i am getting the following error .. ++++++++++++++++++++++++ :calledFunction:opt((anonymous namespace)::PrintStackTrace()+...
2004 Nov 18
0
[LLVMdev] A few beginner level questions..
...truction if its a call > instruction I try to print out the called function as below .. > > void pass01a::instruct_show(Instruction* I){ > if ( isa<CallInst>(*I) ){ > const CallInst *CI = cast<CallInst>(I); > const Function *Func = CI->getCalledFunction() ; > std::cerr<<":calledFunction:"<<Func->getName(); > } > } > > Now it works fine for some application but for one of the benchmark in > MIBENCH , i am getting the following error .. > > ++++++++++++++++++++++++ > :calledFunction:...
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 Apr 09
2
[LLVMdev] How to instrument a this function using insertBefore instruction???
...t;; > // CallInst * III = > CallInst::Create(&F,"InsttoCallInst",II); > if(CallInst * III = > dyn_cast<CallInst>(II)) > { > > > if(III->getCalledFunction()!=NULL&&III->getCalledFunction()->getName()=="puts") > { > errs() > <<III->getCalledFunction()->getName()<<" function found!\n"; > &g...
2012 Apr 09
0
[LLVMdev] How to instrument a this function using insertBefore instruction???
...CallInst * III = CallInst::Create(&F,"InsttoCallInst",II); if(CallInst * III = dyn_cast<CallInst>(II)) { if(III->getCalledFunction()!=NULL&&III->getCalledFunction()->getName()=="puts") { errs() <<III->getCalledFunction()->getName()<<" function found!\n";...
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
...de 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 of the function call I want to find is : >> >> call void %7(%struct.nsAStr...
2002 Dec 06
1
[LLVMdev] WRT: function pointers + DSG
LLVM, What do I pass into the DSG in order to access the globals vector of functions that a function pointer may be calling. The code: CallInst *calli = dynamic_cast<CallInst*>(*i); std::vector<GlobalValue*> funcVect = theGraph.getNodeForValue(calli->getCalledFunction()).getNode()->getGlobals(); Doesn't appear to work... getCalledFunction() returns 0 Dave On Fri, 6 Dec 2002, Vikram Adve wrote: > P.S. I have also updated the CSIL tree. Just check out > TarjanSCCIterator.h. > > --Vikram > http://www.cs.uiuc.edu/~vadve > > &gt...
2019 Mar 12
3
Help with bitcast instruction
..., i8* (%struct.png_struct_def*, i64)*, void (%struct.png_struct_def*, i8*)*)*)(%struct.png_struct_def* %create_struct, i8* %mem_ptr, i8* (%struct.png_struct_def*, i64)* %malloc_fn, void (%struct.png_struct_def*, i8*)* %free_fn) #15 I'm pretty sure that this is a CallInst but when I try to call getCalledFunction() I receive a null pointer and that really surprise me. I would like to understand how to get the function that is called and its parameters. Can you tell me how please? Am i right saying that: (void (%struct.png_struct_def.68*, i8*, i8* (%struct.png_struct_def.68*, i64)*, void (%struct.png_s...
2012 Apr 09
0
[LLVMdev] How to instrument a this function using insertBefore instruction???
...CallInst * III = CallInst::Create(&F,"InsttoCallInst",II); if(CallInst * III = dyn_cast<CallInst>(II)) { if(III->getCalledFunction()!=NULL&&III->getCalledFunction()->getName()=="puts") { errs() <<III->getCalledFunction()->getName()<<" function found!\n";...
2012 Apr 09
1
[LLVMdev] How to instrument a this function using insertBefore instruction???
...CallInst * III = >> CallInst::Create(&F,"InsttoCallInst",II); >> if(CallInst * III = >> dyn_cast<CallInst>(II)) >> { >> >> >> if(III->getCalledFunction()!=NULL&&III->getCalledFunction()->getName()=="puts") >> { >> errs() >> <<III->getCalledFunction()->getName()<<" function found!\n&qu...
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
...: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 of the function cal...