similar to: [LLVMdev] How to get type of a call instruction

Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] How to get type of a call instruction"

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() -
2009 Apr 07
0
[LLVMdev] Patch: MSIL backend global pointers initialization
Artur, > OK, I just need the same signature for both of those instructions. Both are callinsts of same function, isn't that enough? Since it's a variadic function there is also a bitcast to proper type. So, looking for type of callee (not result, but function type!) you'll obtain the real "signature" of callee and if you'll strip all pointer cast you'll obtain the
2009 Apr 07
3
[LLVMdev] Patch: MSIL backend global pointers initialization
Hello Anton > %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([16 x > > i8]* @.str, i32 0, i32 0), i32 %0) nounwind > > %10 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([11 x i8]* > > @.str2, i32 0, i32 0), i32 5) nounwind > > > > Instruction::isSameOperationAs() returns false for those two. Is it a > > bug or I misunderstood
2014 Jul 07
2
[LLVMdev] Return Type of Call Function with nested bitcast
Hi All, I am facing an issue with CallInst with nested bitcast instruction. I want to check if the return type of a call is void or non-void the below line works well for CallInst without bit cast. *cast<CallInst>(I)->getCalledFunction()->getReturnType()->isVoidTy()* But for Call instructions like *call void bitcast (void (%struct.jpeg_compress_struct.131*, i32)*
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
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
thanks! After I check the ll file, I find this: %1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048 %2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg !2048 %3 = getelementptr inbounds %struct.nsISupports* %2, i32 0, i32 0, !dbg !2048 %4 = load i32 (...)*** %3, align 4, !dbg !2048 %5 = getelementptr inbounds i32 (...)** %4, i32 10, !dbg !2048 %6 = load i32 (...)**
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
> On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote: >> thanks! >> >> After I check the ll file, I find this: >> >> %1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048 >> %2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg >> !2048 >> %3 = getelementptr inbounds %struct.nsISupports* %2, i32 0, i32 0, !dbg >> !2048
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 2:07 PM, songlh at cs.wisc.edu wrote: > 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(
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
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote: > thanks! > > After I check the ll file, I find this: > > %1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048 > %2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg !2048 > %3 = getelementptr inbounds %struct.nsISupports* %2, i32 0, i32 0, !dbg !2048 > %4 = load i32 (...)*** %3, align 4, !dbg !2048
2019 Mar 12
3
Help with bitcast instruction
Hi Tim, I'm still struggling on the instruction: call void bitcast (void (%struct.png_struct_def.68*, i8*, i8* (%struct.png_struct_def.68*, i64)*, void (%struct.png_struct_def.68*, i8*)*)* @png_set_mem_fn to void (%struct.png_struct_def*, i8*, i8* (%struct.png_struct_def*, i64)*, void (%struct.png_struct_def*, i8*)*)*)(%struct.png_struct_def* %create_struct, i8* %mem_ptr, i8*
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
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 3:00 PM, songlh at cs.wisc.edu wrote: >> On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote: >>> thanks! >>> >>> After I check the ll file, I find this: >>> >>> %1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048 >>> %2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg >>> !2048 >>> %3
2013 Mar 11
2
[LLVMdev] How to detect all free() calls
Hi, I'm trying to write a pass to detect all free()/delete() call instructions in LLVM IR.The method is as follows. First I find Call Instructions: CallInst *CI=dyn_cast<CallInst>(&*i); then see if the Function name matches: name=CI->getCalledFunction()->getName(); if(name=="_ZdlPv"||name=="_ZdaPv"||name=="free")
2020 Jan 15
4
Finding callees of a function
I searched the doxygen documentation and could not find a solution to my task: In a ModulePass running at EP_OptimizerLast, if I have a function F like in: bool Foo:runOnModule(Module &M) { LLVMContext &C = M.getContext(); for (auto &F : M) { // magic here if I want to know from which function (callee) each function is called - how can I do this? (so that I e.g. have
2012 Nov 09
2
[LLVMdev] Inlining bitcast functions...
I've got a call instruction: call void bitcast (void (%4 addrspace(1)*, <2 x i32>, <4 x float>)* @_Z12write_imagefPU3AS110_image2d_tDv2_iDv4_f to void (%9 addrspace(1)*, <2 x i32>, <4 x float>)*)(%9 addrspace(1)* %dstimg, <2 x i32> %28, <4 x float> %26) nounwind %4 and %9 are both (stripped) opaque structs. InlineFunction() does not inline this because
2013 Dec 17
2
[LLVMdev] tail call
I have a pass which operates on IR for mips16 so that I can build stubs and such for floating point. I usually get this attribute of the call instruction getCalledFunction. This is turning out to be null when there is a tail call. (I think this may be something new but maybe was there already). So then what is the right way to find the function prototype for the call? TIA. Reed
2018 Sep 12
2
CallSiteBase::getCalledFunction and non-trivial calls
The immediate change I have in mind is in CallGraph; our implementation of LowerCall in AMDGPU currently 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
2012 Jul 17
2
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
OK, at our end the following workaround seems to be sufficient: // Check if function is called (needs -instcombine pass). Function* callee = call->getCalledFunction(); if (!callee) { // Could be also a function called inside a bitcast. // So try to extract function
2013 Mar 11
2
[LLVMdev] How to detect all free() calls
Thanks. isFreeCall() works well but for %call2 = call i32 bitcast (i32 (...)* @free to i32 (i8*)*)(i8* %call1) nounwind, !dbg !16 So I tried to figure out when the above instruction occurred. When <stdlib.h> is included, free(buf2R1); turn into call void @free(i8* %call1) nounwind, !dbg !16 when I forget to include <stdlib.h>, free(buf2R1); turn into %call2 = call i32 bitcast (i32