search for: targetfunc

Displaying 9 results from an estimated 9 matches for "targetfunc".

2018 Aug 16
2
Convert Function Pointer Call to Function Call at the IR Level
...@demux_lavf_control(%struct.demuxer.2657* nocapture readonly, i32, i8* nocapture) #0 !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*...
2018 Apr 01
2
Custom Binary Format Challenges
...if you are writing an optimization pass: > http://llvm.org/docs/ProgrammersManual.html > > It sounds like your highest level is a module, hence you should write a > module pass. There is example code on LLVM Programmer's Manual on how to do > a function pass: > > Function* targetFunc = ...; > class OurFunctionPass : public FunctionPass { > public: > OurFunctionPass(): callCounter(0) { } > > virtual runOnFunction(Function& F) { > for (BasicBlock &B : F) { > for (Instruction &I: B) { > if (auto *CallInst = dyn_...
2018 Apr 01
0
Custom Binary Format Challenges
Hi, You can write it as if you are writing an optimization pass: http://llvm.org/docs/ProgrammersManual.html It sounds like your highest level is a module, hence you should write a module pass. There is example code on LLVM Programmer's Manual on how to do a function pass: Function* targetFunc = ...; class OurFunctionPass : public FunctionPass { public: OurFunctionPass(): callCounter(0) { } virtual runOnFunction(Function& F) { for (BasicBlock &B : F) { for (Instruction &I: B) { if (auto *CallInst = dyn_cast<CallInst>(&I)) {...
2018 Apr 01
2
Custom Binary Format Challenges
Hello, I hope you are all doing well and thanks in advance. I need to program a transformation of a set of llvm bitcode to have some various techniques woven in. In particular, I need to resolve a given computed target address to one of several in the same way that the function of a dynamic library is resolved, but I need this resolution to happen in the binary target of my choice where I tell
2018 Apr 01
2
Custom Binary Format Challenges
...ttp://llvm.org/docs/ProgrammersManual.html >>> >>> It sounds like your highest level is a module, hence you should write a >>> module pass. There is example code on LLVM Programmer's Manual on how to do >>> a function pass: >>> >>> Function* targetFunc = ...; >>> class OurFunctionPass : public FunctionPass { >>> public: >>> OurFunctionPass(): callCounter(0) { } >>> >>> virtual runOnFunction(Function& F) { >>> for (BasicBlock &B : F) { >>> for (Instructi...
2018 Apr 01
0
Custom Binary Format Challenges
...ization pass: >> http://llvm.org/docs/ProgrammersManual.html >> >> It sounds like your highest level is a module, hence you should write a >> module pass. There is example code on LLVM Programmer's Manual on how to do >> a function pass: >> >> Function* targetFunc = ...; >> class OurFunctionPass : public FunctionPass { >> public: >> OurFunctionPass(): callCounter(0) { } >> >> virtual runOnFunction(Function& F) { >> for (BasicBlock &B : F) { >> for (Instruction &I: B) { >>...
2018 Apr 02
0
Custom Binary Format Challenges
...rammersManual.html >>>> >>>> It sounds like your highest level is a module, hence you should write a >>>> module pass. There is example code on LLVM Programmer's Manual on how to do >>>> a function pass: >>>> >>>> Function* targetFunc = ...; >>>> class OurFunctionPass : public FunctionPass { >>>> public: >>>> OurFunctionPass(): callCounter(0) { } >>>> >>>> virtual runOnFunction(Function& F) { >>>> for (BasicBlock &B : F) { >>&gt...
2018 Apr 02
1
Custom Binary Format Challenges
...gt;>>> >>>>> It sounds like your highest level is a module, hence you should write >>>>> a module pass. There is example code on LLVM Programmer's Manual on how to >>>>> do a function pass: >>>>> >>>>> Function* targetFunc = ...; >>>>> class OurFunctionPass : public FunctionPass { >>>>> public: >>>>> OurFunctionPass(): callCounter(0) { } >>>>> >>>>> virtual runOnFunction(Function& F) { >>>>> for (BasicBlock &...
2002 Sep 16
1
[LLVMdev] questions about llvm
...;*inst)) { // we know we've encountered a call instruction, so we // need to determine if it's a call to the // function pointed to by m_func or not. if(callInst->getCalledFunction() == targetFunc) ++callCounter; } } } private: unsigned callCounter; }; ------------------------------------------ I don't understand in this line: if (CallInst* callInst = dyn_cast<CallInst>(&*inst)) { Where...