similar to: Writing Module Pass to modify arguments of a function

Displaying 20 results from an estimated 4000 matches similar to: "Writing Module Pass to modify arguments of a function"

2016 Apr 24
2
Retrieving numeric value of instruction operand
Hi John, Thank you so much for the valuable answer! :) However, i have one tough issue that i need to solve, in my pass : let's say here %s = add %a, %b I need to check if the value of %a or %b is 2 or 4 and then apply a transformation to the other operand accordingly, for example if the value of %a = 2 the i'll multiply %b by 2 in my transform pass. I'm having a hard time
2016 Apr 24
2
Retrieving numeric value of instruction operand
hey john, yes indeed, that's what I'm trying, retreiving the values of %a and %b in an LLVM pass, sorry about the confusion. On Apr 24, 2016 7:18 AM, "John Criswell" <jtcriswel at gmail.com> wrote: > Dear Ammar, > > It is not clear what you are asking. %a and %b in your code below are not > constants; there is no way, at compile time, to determine what
2016 May 04
2
llvm dynamic execution trace
Hi Dean, thank you for the response! I'm a newbie to LLVM, a student working on an LLVM project so I'm not quite sure of what you're suggesting, please excuse my naivety. To clarify there used to exist this http://llvm.org/releases/1.0/docs/CommandGuide/lli.html where you could type "lli -trace 'filename.bc' and you would get a dump of the dynamic excutiion trace. I
2016 Apr 26
2
Writing a pass to retrieve instruction operand value
Hi Everyone, I asked a question on the dev list related to the topic to which John Criswell and Jeremy Lakeman kindly provided some valuable insight. I'm still stuck on the issue and i'm hoping i didn't phrase the question well enough. I have a *foo.c* file that is : *#include <stdio.h>* *int foo(int a, int b){* * return a+b;* *}* *int main() {* *int x=foo(3,1); *
2016 May 04
2
llvm dynamic execution trace
hi everyone, I'm trying to get something like the lli - trace functionality that has been deprecated. I need the same thing that the trace command was doing i. e. the dynamic execution trace, any idea on what it has moved to if it still exists or how to implement it? Best Regards, Ammar Naqvi -------------- next part -------------- An HTML attachment was scrubbed... URL:
2016 Apr 24
2
Retrieving numeric value of instruction operand
Hello Everyone, I need some help in retrieving the numeric value of an instruction operand from LLVM IR. this is what the IR looks like for a simple add function that adds two i32 integers define i32 @summ(i32 %a, i32 %b) #0 { entry: %add = add nsw i32 %b, %a ret i32 %add } i would like to know the integer value of %a and %b. I've tried -i->getOpcodeName() which gives me the
2018 Sep 06
2
Replacing a function from one module into another one
Hi Philip, Thanks for the reference, I was able to follow it and copy the code that I saw necessary, but I still have some issues (references are still not updated). I created the function: void populateVMap(llvm::ValueToValueMapTy &VMap, llvm::Function *fOld, llvm::Function *fNew) { llvm::Function::arg_iterator DestI = fOld->arg_begin(); for (llvm::Function::const_arg_iterator J =
2011 Feb 28
2
[LLVMdev] Extending FunctionType
On Mon, Feb 28, 2011 at 5:10 PM, John Criswell <criswell at illinois.edu> wrote: > On 2/28/11 10:04 AM, Frits van Bommel wrote: >> I don't think a full clone is necessary, since he wants to replace the >> function. He only needs to create the new function and splice in the >> body of the old one. > > That is exactly what MakeFunctionClone() does.  It creates a
2018 Sep 06
2
Replacing a function from one module into another one
Hi Philip, The error happens when the program finishes and it automatically calls the destructors, so it is not an error specifically inside my program. Here's the full code: #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/MCJIT.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/TargetSelect.h" #include
2018 Sep 04
2
Replacing a function from one module into another one
Hi Philip, Thank you very much for your answer, the vector declaration example worked. I'm pretty sure the ValueToValueMapTy is the last thing I need because I even saw there is another function that could help me llvm*:*:RemapFunction <http://llvm.org/doxygen/namespacellvm.html#addf0183e92893bdbcde00fc9091dda93>; but my problem is that I don't know how to populate the
2013 May 29
0
[LLVMdev] CloneFunctionInto() Error
Does cloning copies the function with its address or it constructs a new address to the new function? Is this real copying for the CFG or just opaque one to do some work? If it's not real copying, please I need a method that can help me in copying the function in another with new pointer to another address. Please I need answer urgent Thanks On 29 May 2013 10:14, Rasha Omar <rasha.sala7
2012 May 15
1
[LLVMdev] CloneFunctionInto() overwrites alignment attribute
Hi everybody, I am trying to clone a function body into an existing declaration. That declaration has the same number of parameters but they differ in type and alignment. Fortunately, it does not care about the type. Unfortunately, CloneFunctionInto() copies the attributes from the old function to the new one unconditionally, overwriting the alignment attribute. Also, the Attribute interface
2018 Sep 03
2
Replacing a function from one module into another one
Thank you Ahmad, I figured out that, although the type of both p(oInst) and p(nInst) were the same, I had to: for (unsigned int i = 0; i < callOInst->getNumArgOperands(); i++) { callOInst->getArgOperand(i)->mutateType(callNInst->getArgOperand(i)->getType()); } that solves the issue at the calling instruction in the main function, but now I see that *linkModules* does not work
2013 May 29
2
[LLVMdev] CloneFunctionInto() Error
Dear All, I need your help urgently I have to copy the CFG of each function using CloneFunction or CloneFunctionInto. After I made the copy function. Print the basic blocks then get this error : While deleting: i32 % Use still stuck around after Def is destroyed: %mul2_ = mul nsw i32 %6, 3 Use still stuck around after Def is destroyed: store i32 3, i32* %x_, align 4 opt: Value.cpp:75: virtual
2019 Nov 12
2
Using Libfuzzer on a library - linking the library to the fuzz target
Hi Mitch, Thank you for the response. 1. You don't need to build the library with `-fsanitize-coverage=...`, using `-fsanitize=fuzzer-no-link,address` should be sufficient. - Acknowledged 2. (although you can actually build object files/shared libraries with -fsanitize=fuzzer, and the libFuzzer main won't be linked, if this makes your build process easier). - with just the *fuzzer
2018 Aug 01
2
LLJVM make error
That source file was removed from LLVM in r232397 on March 16, 2015. It looks like lljvm hasn't been updated in a long time. LLVM's C++ APIs are not stable, so there is no expectation that a project built against LLVM's C++ API in 2015 would build or reasonably function against LLVM trunk. The project probably works against LLVM 3.6.2 which was (I believe) the last LLVM release to
2018 Sep 02
2
Replacing a function from one module into another one
Hello and thanks for the answer, I'm still facing issues, I'll do my best to explain my situation, as I explained, I have two modules, each one with its own main and functions, I would like to replace in the *oldModule* a function call that is calling *foo2* (defined in *oldModule*) to instead call *foo3*, which is defined in the *refModule. *So in summary, I have: 1. The original
2016 Jul 15
2
clone function
On 14 July 2016 at 20:07, Mehdi Amini <mehdi.amini at apple.com> wrote: > > On Jul 14, 2016, at 7:58 AM, Pierre Gagelin via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > Hi, > > I am trying to use the CloneFunction from llvm/Transforms/Utils/Cloning.h > and I don't understand how the ValueToValueMapTy argument should be > initialized. For instance,
2017 Jun 16
2
CloneFunctionInto produces invalid debug info
The if you are cloning into the same LLVM module the CU should not cloned. If don't mind sharing your code, I can try to help diagnose why the CU gets cloned... just send me a patch that applies to trunk and instructions. -- adrian > On Jun 16, 2017, at 1:54 PM, Sergei Larin <slarin at codeaurora.org> wrote: > > Sorry… It takes a pass that was not accepted for upstreaming….
2014 Oct 02
2
[LLVMdev] Use list preservation when using Instruction::clone
I'm trying to create a clone of a function using Function::Create() and CloneFunctionInto. However, I'm running into an issue. I believe that the instructions in the function clone still have Use edges to values in the original function. This is a problem for my purposes. For example, consider an original function F. I create a new function G belonging to the same module and call