Displaying 17 results from an estimated 17 matches for "setcalledfunct".
Did you mean:
getcalledfunc
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
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, that no matter which solution you end up using, you’ll need to update the FunctionType as well
Zhang
> On 23 Mar 2018, at 23:07, Dávid Bolvanský via llvm-dev <llvm-dev at lists...
2013 Jan 24
2
[LLVMdev] FunctionPass question
Hi,
I am working on a pass to convert lib calls to intrinsic calls as discussed here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-January/058507.html
In my first attempt I created a FunctionPass that uses CallInst::setCalledFunction to replace the callee with the appropriate intrinsic (using Intrinsic::getDeclaration).
After the pass runs I get an assertion from CallGraphSCCPass:
clang-3.3: /home/predmond/src/ssg_llvm/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:338: bool {anonymous}::CGPassManager::RefreshCallGraph(llvm::C...
2012 Mar 06
2
[LLVMdev] Work with CallSites
...{};
};
int main() {
A *a = new B();
a->test(1);
}
We have call site CS: "a->test(1);". CS.getCalledFunction() - return NULL, so we can say that this call site is virtual. My optimization determines, that in this call site B::test() should be called.
I've tried to use CSn.setCalledFunction(F) (where F is B::test()), but I've got this:
Check function __cxa_pure_virtual
Call parameter type does not match function signature!
%6 = load %class.A** %a, align 4
%class.B* call void @_ZN1B4testEi(%class.A* %6, i32 1)
Ok! I've tried to change the first %class.A %6 to %class.B...
2012 Nov 09
2
[LLVMdev] Inlining bitcast functions...
...ts.
InlineFunction() does not inline this because call->getCalledFunction() returns 0. call->getCalledValue() returns a cast ConstantExpr. The called Function * is available at (leaving out necessary casts and checks) call->getCalledValue()->getOperand(0). I've tried using call->setCalledFunction(), but that isn't successful either, I'm guessing because the types don't match.
If I don't strip the module, the linker produces an ordinary call to the target function, with no bitcast because both formal arg and passed arg have the same opaque struct name, and InlineFunction(...
2013 Oct 30
1
[LLVMdev] Setting called value for an indirect function call
Hello;
I am trying to clone some call instructions in the IR and then set the
call destination of those call instructions to my own library
functions that happens to have the same arguments and return types of
the original callee.
It works perfectly for direct calls using setCalledFunction(). But
when the function call is indirect, is there a way to set the callee?
Something like setCalledValue()? How do I achieve this?
Any help will be appreciated, thanks a lot!
--
Arnamoy Bhattacharyya
Athabasca Hall 143
Department of Computing Science - University of Alberta
Edmonton, Albe...
2018 Aug 16
2
Convert Function Pointer Call to Function Call at the IR Level
...!dbg !963916 {
...
I wrote a function pass and found the mentioned function pointer call
(here, stored in "CallInstr") and set the call target as follows:
...
Module *theModule = F.getParent();
Function *targetFunc = theModule->getFunction("demux_lavf_control");
CalIInstr->setCalledFunction(targetFunc);
...
"F" is the function containing the call. But it leads to the following
error:
...
Call parameter type does not match function signature!
%struct.demuxer* %0
%struct.demuxer.2657* %10 = tail call i32
@demux_lavf_control(%struct.demuxer*
nonnull %0, i32 %1, i8* %2) #7,...
2013 Jan 24
0
[LLVMdev] FunctionPass question
...ent. If a libcall can be correctly
turned into a target processor instruction, then at some point that conversion
has to happen. Thus the recognition of certain libcalls, and their conversion
into a SDNode.
Ciao, Duncan.
>
> In my first attempt I created a FunctionPass that uses CallInst::setCalledFunction to replace the callee with the appropriate intrinsic (using Intrinsic::getDeclaration).
>
> After the pass runs I get an assertion from CallGraphSCCPass:
>
> clang-3.3: /home/predmond/src/ssg_llvm/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:338: bool {anonymous}::CGPassManager::Refres...
2012 Nov 09
0
[LLVMdev] Inlining bitcast functions...
...> InlineFunction() does not inline this because call->getCalledFunction() returns 0. call->getCalledValue() returns a cast ConstantExpr. The called Function * is available at (leaving out necessary casts and checks) call->getCalledValue()->getOperand(0). I've tried using call->setCalledFunction(), but that isn't successful either, I'm guessing because the types don't match.
>
> If I don't strip the module, the linker produces an ordinary call to the target function, with no bitcast because both formal arg and passed arg have the same opaque struct name, and Inline...
2018 Sep 02
2
Replacing a function from one module into another one
...arameter's type and even the same variable's name in the
IR.
So after calling the *llvm::LinkerlinkModules* function, I did:
1. First attempt:
1. llvm::CallInst *callOInst = static_cast<llvm::CallInst*>(oInst); //
I cast the* oInst* to a llvm::CallInst
2. callOInst->setCalledFunction(nFunc); // now *oInst* should call nFunc
Error:
Call parameter type does not match function signature!
%0 = load i32, i32* %a, align 4
i32 %call1 = call i32 @foo3(i32 %0, i32 %1)
So even though the parameters are the same type, and defined identically in
both modules, the *p(oInst)* apparently...
2018 Sep 02
2
Replacing a function from one module into another one
...IR.
>>
>> So after calling the *llvm::LinkerlinkModules* function, I did:
>>
>> 1. First attempt:
>>
>> 1. llvm::CallInst *callOInst = static_cast<llvm::CallInst*>(oInst);
>> // I cast the* oInst* to a llvm::CallInst
>> 2. callOInst->setCalledFunction(nFunc); // now *oInst* should call
>> nFunc
>>
>> Error:
>> Call parameter type does not match function signature!
>> %0 = load i32, i32* %a, align 4
>> i32 %call1 = call i32 @foo3(i32 %0, i32 %1)
>>
>> So even though the parameters are the same...
2018 Sep 03
2
Replacing a function from one module into another one
...function, I did:
>>>>
>>>> 1. First attempt:
>>>>
>>>> 1. llvm::CallInst *callOInst =
>>>> static_cast<llvm::CallInst*>(oInst); // I cast the* oInst* to a
>>>> llvm::CallInst
>>>> 2. callOInst->setCalledFunction(nFunc); // now *oInst* should call
>>>> nFunc
>>>>
>>>> Error:
>>>> Call parameter type does not match function signature!
>>>> %0 = load i32, i32* %a, align 4
>>>> i32 %call1 = call i32 @foo3(i32 %0, i32 %1)
>>>...
2012 Nov 09
3
[LLVMdev] Inlining bitcast functions...
...> InlineFunction() does not inline this because call->getCalledFunction() returns 0. call->getCalledValue() returns a cast ConstantExpr. The called Function * is available at (leaving out necessary casts and checks) call->getCalledValue()->getOperand(0). I've tried using call->setCalledFunction(), but that isn't successful either, I'm guessing because the types don't match.
>>
>> If I don't strip the module, the linker produces an ordinary call to the target function, with no bitcast because both formal arg and passed arg have the same opaque struct name, a...
2018 Sep 04
2
Replacing a function from one module into another one
...t;>> 1. First attempt:
>>>>>>
>>>>>> 1. llvm::CallInst *callOInst =
>>>>>> static_cast<llvm::CallInst*>(oInst); // I cast the* oInst* to a
>>>>>> llvm::CallInst
>>>>>> 2. callOInst->setCalledFunction(nFunc); // now *oInst* should
>>>>>> call nFunc
>>>>>>
>>>>>> Error:
>>>>>> Call parameter type does not match function signature!
>>>>>> %0 = load i32, i32* %a, align 4
>>>>>> i32 %cal...
2018 Sep 06
2
Replacing a function from one module into another one
...;>>>>>
>>>>>>>> 1. llvm::CallInst *callOInst =
>>>>>>>> static_cast<llvm::CallInst*>(oInst); // I cast the* oInst* to
>>>>>>>> a llvm::CallInst
>>>>>>>> 2. callOInst->setCalledFunction(nFunc); // now *oInst* should
>>>>>>>> call nFunc
>>>>>>>>
>>>>>>>> Error:
>>>>>>>> Call parameter type does not match function signature!
>>>>>>>> %0 = load i32, i32* %a, a...
2018 Aug 27
3
Replacing a function from one module into another one
Hello LLVM Developers,
I'm trying to replace a function defined in one module into another module
(different files). The first issue I ran into was that llvm::Function does
not have a method "moveBefore" or "moveAfter" as the llvm::BasicBlock or
llvm::Instruction do, so I figured I would just move the BasicBlocks of the
replacing function into the function that was being
2018 Sep 06
2
Replacing a function from one module into another one
...t;>>>>>>> 1. llvm::CallInst *callOInst =
>>>>>>>>>> static_cast<llvm::CallInst*>(oInst); // I cast the* oInst*
>>>>>>>>>> to a llvm::CallInst
>>>>>>>>>> 2. callOInst->setCalledFunction(nFunc); // now *oInst* should
>>>>>>>>>> call nFunc
>>>>>>>>>>
>>>>>>>>>> Error:
>>>>>>>>>> Call parameter type does not match function signature!
>>>>>>&g...