similar to: [LLVMdev] Help with creating and replacing instructions in LLVM

Displaying 20 results from an estimated 400 matches similar to: "[LLVMdev] Help with creating and replacing instructions in LLVM"

2013 Dec 03
1
[LLVMdev] Help needed with creating new and replacing an old instruction
Hi,I have the following instruction in my IR-%call2 = call i8* @strcpy(i8* %1, i8* %2) #2I intend to change call to strcpy with strncpy. I have included the following code in runOnFunction, so that when it is strcpy's turn to be invoked, strncpy is invoked instead.Assuming I* is the strcpy instruction,CallInst* x=new
2013 Dec 03
0
[LLVMdev] Help needed with creating new and replacing an old instruction
<div><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <div>Hi,</div><div><br></div><div>I have the following instruction in my IR-</div><div><b>%call2 = call i8* @strcpy(i8* %1, i8* %2)</b> #2</div><div><br></div><div>I intend to change call to
2015 Nov 24
2
How to create a sprintf call in IR
Hi, I created a global char array, char buffer[1024]. I want to call a function to append the string information to the buffer repeatedly. For example, I need to implement the following code, where length, a, b, c, are global variables. int length = 0; length += sprintf(buffer+length, "str%d", a); length += sprintf(buffer+length, "str%c", b); length += sprintf(buffer+length,
2013 Dec 04
3
[LLVMdev] Quick doubt about IR
Hi, While looking over the IR generated by my source code, I came across the following: %arr = alloca [30 x i8], align 1 In the source code this particular line of code is represented by: int arr[30]; I was wondering how I could change the capacity of arr from 30 to any other integral value via a function-pass. I know that 'alloca' can be used for reserving space on stack; further,
2011 May 12
0
[LLVMdev] Extract operations as function
Hi Manish, > I am planning to extract every operation as function. > > eg. z=x+y; ==> z=func(x,y,op); > > I wish to write a custom definition of op. Which I would like to define in func. > > It would be really helpful if someone could suggest passes already available in > llvm to look for or point some references how should one proceed on it. I think you should write
2011 May 12
2
[LLVMdev] Extract operations as function
Great!! Thanks Duncan. By step 1 that you mentioned it seems I can write my function func(x,y,op) in mypass.cpp itself. Please elaborate how can add it to the module? On Thu, May 12, 2011 at 1:22 AM, Duncan Sands <baldrick at free.fr> wrote: > Hi Manish, > > > I am planning to extract every operation as function. > > > > eg. z=x+y; ==> z=func(x,y,op); > >
2013 Dec 04
0
[LLVMdev] Quick doubt about IR
Create a new alloca instruction, insert it into the IR right before (or after) the old one, RAUW the value, then delete the old instruction. You should be able to find a variety of examples of this sort of thing in most of the IR level optimization passes. I’d look at InstCombine in particular. -Jim On Dec 4, 2013, at 1:40 PM, Shivam Bhagi <shivam.bhagi at outlook.com> wrote: > Hi,
2019 Jan 17
3
LLVM 7.0.1 Error no matching constructor for initialization of SmallVector
Hello With LLVM 4.0 my code is being compiled correctly. but with LLVM 7.0.1 I am getting following error; *llvm-7.0.1.src/include/llvm/IR/Module.h:356:43: error: no matching constructor for initialization of 'SmallVector<llvm::Type *, sizeof...(ArgsTy)>' SmallVector<Type*, sizeof...(ArgsTy)> ArgTys{Args...};* What is the reason? Please help. Thank You
2011 May 12
0
[LLVMdev] Extract operations as function
Hi Manish, > Great!! Thanks Duncan. > By step 1 that you mentioned it seems I can write my function func(x,y,op) in > mypass.cpp itself. Please elaborate how can add it to the module? the minimum is to add a prototype for "func" to the module. For that you can use getOrInsertFunction. If you want to insert the code defining "func" too, then insert the prototype,
2011 Jul 07
2
[LLVMdev] Filename in dynamically loaded function pass
Hi All, I would like to know if there is an API/method that I can use to get the name of the file being processed in a dynamically loaded function pass. In other words, if I invoke a pass as follows opt -load pass.so -hello src.bc -o src.hello.bc where pass.so is a functionpass, I would like to get the filename "src.bc", in the doInitialization/doFinalization method. My intent is to
2011 May 12
2
[LLVMdev] Extract operations as function
Hi, I am planning to extract every operation as function. eg. z=x+y; ==> z=func(x,y,op); I wish to write a custom definition of op. Which I would like to define in func. It would be really helpful if someone could suggest passes already available in llvm to look for or point some references how should one proceed on it. Is codeExtractor.cpp useful for this. I was also thinking of going like
2011 Jul 07
0
[LLVMdev] Filename in dynamically loaded function pass
On 7 July 2011 02:27, Kodakara, Sreekumar V <sreekumar.v.kodakara at intel.com> wrote: > I would like to know if there is an API/method that I can use to get the > name of the file being processed in a dynamically loaded function pass. In > other words, if I invoke a pass as follows > > opt  -load pass.so -hello  src.bc –o src.hello.bc > > where pass.so is a
2014 Feb 21
12
[LLVMdev] asan coverage
> > > > We may need some additional info. What kind of additional info? > I haven't put a ton of thought into > this, but I'm hoping we can either (a) use debug info as is or add some > extra (valid) debug info to support this, or (b) add an extra > debug-info-like section to instrumented binaries with the information we > need. > I'd try this data
2010 Nov 02
2
[LLVMdev] ConstantInt to Value*?
How to convert ConstantInt* to value*? -- regards, soumya prasad ukil -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101102/af73eabb/attachment.html>
2011 Apr 22
0
[LLVMdev] llvm-gcc
>>  i would like to add the value of  the size od a basic bloc to this >>> global variable >>> how to convert the size of a basic bloc to integer? >> >> Size = number of LLVM IR instructions there? If yes, just grab the >> number, convert it to ConstantIn and use as an initializer / store to >> variable. >> > > There's a typo in the
2011 Apr 19
2
[LLVMdev] llvm-gcc
On 4/19/11 4:37 PM, Anton Korobeynikov wrote: >> llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc >> it shows to me i should install llvm-gcc4.5 >> when i have installed llvm-gcc 4.5 i get all the times a wrong bc file >> as output, because when i try to execute it with lli it says to me >> invalid signature. > There is no llvm-gcc 4.5. Report this bug to Ubuntu,
2013 Sep 10
1
[LLVMdev] Global Variable Recall
Hi All, I need to call global variable by its name from the following code for(Function::iterator i=F->begin();i!=F->end();++i) { BasicBlock*Bb =&*i; GlobalVariable* GV = new GlobalVariable(type,false, F->getLinkage(),0, "F$"+Bb->getName()); GV->setInitializer(Constant::getNullValue (typ)); GList.push_back(GV); } Could I solve that by
2013 Nov 26
0
[LLVMdev] Help needed with a pass
I'm a newbie to LLVM and I've really been struggling to write a pass which changes the behavior of the following function: #include<stdlib.h>#include<stdio.h>#include<string.h>void foo(char* bar){const char* path;path=getenv(<SOME_ENV_VAR>); if (path!=NULL){strcpy(bar,path);}else{printf("env_var not set!");}} In the pass, I hope to invoke
2008 Nov 16
2
[LLVMdev] How do I insert a printf call in the IR?
Thanks a lot Nick -march=cpp was very helpful. But I still have a small problem, I am trying to insert a printf in a transformation pass. So when the original program already has a printf, on executing the transformation pass, it tries to create function "printf1" instead of "printf" Am I missing something here? Thanks again! Mrunal ----- Original Message ----- From:
2009 May 05
4
[LLVMdev] A problem creating operands for a new IR instruction to the mailing list
I have a question about inserting instructions into the LLVM IR. I can insert instructions, but my operands do not have the right type, so it fails an assertion at runtime. I am trying to insert an immediate load instructions, as a means of claiming a new register. Here is what I do: Builder.SetInsertPoint(LLVMBB, I); // The following line looks to me like it would have a chance of loading