similar to: [LLVMdev] Extract operations as function

Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] Extract operations as function"

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); > >
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
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 Aug 29
3
[LLVMdev] [PATCH] Split init.trampoline into init.trampoline & adjust.trampoline
Hi! Attached patches split init.trampoline into adjust.trampoline and init.trampoline, like in gcc. As mentioned in the previous mail, I've not made a documentation patch, since I'm not sure about what the documented semantics of llvm.adjust.trampoline should be. Thanks! -- Sanjoy Das http://playingwithpointers.com -------------- next part -------------- A non-text attachment was
2014 Jun 26
2
[LLVMdev] eraseFromParent and stack dump
Hello, I am creating a new instruction and I want to replace the use of a specified instruction. This is the code I have written Instruction *new_instr = BinaryOperator::Create(Instruction::Sub, op1, op2, ""); b->getInstList().insertAfter(old_instr, new_instr); //b is the BasicBlock old_instr->replaceAllUsesWith(new_instr); old_instr->eraseFromParent(); When I print the
2011 Jan 21
2
[LLVMdev] How to change the type of an Instruction?
Hello guys, I wonder how I can change the type of an integer variable. For instance, given the instruction "%3 = add i32 %1, %2" I would like to alter the instruction to "%3 = add i16 %1, %2". Is there any way to do this? Best wishes, Douglas -------------- next part -------------- An HTML attachment was scrubbed... URL:
2011 Jan 24
3
[LLVMdev] How to change the type of an Instruction?
Hi, Nick, thanks for the reply. I still have a problem: I only need to "clone" an Instruction, changing its type. That is, I would like to keep all characteristics of the old Instruction and create a new one only with a different type. I am trying create a new Instruction thus: %3 = add nsw i32 %1, %2 ; <i16> [#uses=2] //Old Instruction Value* Op0 = I->getOperand(0); Value*
2018 Aug 08
3
Error Calling eraseFromParent()
LLVM is built in Release mode. The version is 6.0.0. I think that a similar code worked on verison 3.9.0. It is probably a null pointer dereference occurring in eraseFromParent(). I checked and reconfirmed that the instruction had no uses. Perhaps I should rebuild LLVM. Thanks. On Wed, Aug 8, 2018 at 9:03 PM, mayuyu.io <admin at mayuyu.io> wrote: > Hmmmm that’s strange. Do you get an
2011 Jan 21
0
[LLVMdev] How to change the type of an Instruction?
On 21 January 2011 12:56, Douglas do Couto Teixeira < douglasdocouto at gmail.com> wrote: > Hello guys, > > I wonder how I can change the type of an integer variable. For instance, > given the instruction "%3 = add i32 %1, %2" I would like to alter the > instruction to "%3 = add i16 %1, %2". Is there any way to do this? > No. Instead you create a new
2018 Aug 07
2
Error Calling eraseFromParent()
Hi. This is part of my code: ... if (auto* op = dyn_cast<BinaryOperator>(&I)) { Value* lhs = op->getOperand(0); Value* rhs = op->getOperand(1); Value* mul = builder.CreateMul(lhs, rhs); for (auto& U : op->uses()) { User* user = U.getUser(); user->setOperand(U.getOperandNo(), mul); } I.eraseFromParent(); } ... This leads to the following
2018 Aug 08
2
Error Calling eraseFromParent()
Hi. Thanks. I changed the code but the problem exists. This is my new code which is again very simple: ... bool runOnFunction(Function &F) override { vector<Instruction *> dels; dels.clear(); for (inst_iterator It = inst_begin(&F), Ie = inst_end(&F); It != Ie;) { Instruction *I = &*(It++); if (auto* op = dyn_cast<BinaryOperator>(I)) { IRBuilder<NoFolder>
2011 Jan 24
3
[LLVMdev] How to change the type of an Instruction?
On Mon, Jan 24, 2011 at 3:01 PM, Nick Lewycky <nicholas at mxc.ca> wrote: > On 01/24/2011 04:41 AM, Douglas do Couto Teixeira wrote: > >> Hi, >> >> Nick, thanks for the reply. >> I still have a problem: I only need to "clone" an Instruction, changing >> its type. That is, I would like to keep all characteristics of the old >> Instruction
2018 Aug 07
2
Error Calling eraseFromParent()
Thanks Bjorn! But The problem is still there. On Wed, Aug 8, 2018 at 2:04 AM, Björn Pettersson A < bjorn.a.pettersson at ericsson.com> wrote: > It looks quite dangerous to erase the instruction I inside the loop when > iterating over all instructions in the function. > I guess it depends on how the range based iterator is implemented if that > works or not. > > I think
2018 Aug 07
2
Error Calling eraseFromParent()
The code is really simple. But I can not the reason for the segmentation fault. I only know that the eraseFromParent() function leads to it. The whole code is: ... bool runOnFunction(Function &F) override { for (auto &I : instructions(F)) { if (auto* op = dyn_cast<BinaryOperator>(&I)) { IRBuilder<> builder(op); Value* lhs = op->getOperand(0); Value* rhs =
2011 Aug 11
5
[LLVMdev] IR code modification/transformation
Hi, I have a question about the llvm passes. I'm iterating over a basicblock and I can get an instruction and print it. Now, I want to iterate over the instruction and be able to modify the values of the instruction. For example, if my instruction is an add "<result> = add i32 4, %var" I want to transform it in a sub "<result> = sub i32 4, %var". I looked up
2011 Jan 24
0
[LLVMdev] How to change the type of an Instruction?
On 01/24/2011 04:41 AM, Douglas do Couto Teixeira wrote: > Hi, > > Nick, thanks for the reply. > I still have a problem: I only need to "clone" an Instruction, changing > its type. That is, I would like to keep all characteristics of the old > Instruction and create a new one only with a different type. Sure, but what about its operands? An "add" instruction
2013 Dec 03
1
[LLVMdev] Help with creating and replacing instructions in LLVM
Hi, I have the following instruction in my IR- %call2 = call i8* @strcpy(i8* %1, i8* %2) #2 I 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
2011 Jan 24
0
[LLVMdev] How to change the type of an Instruction?
On 1/24/11 12:05 PM, Douglas do Couto Teixeira wrote: > > > On Mon, Jan 24, 2011 at 3:01 PM, Nick Lewycky <nicholas at mxc.ca > <mailto:nicholas at mxc.ca>> wrote: > > On 01/24/2011 04:41 AM, Douglas do Couto Teixeira wrote: > > Hi, > > Nick, thanks for the reply. > I still have a problem: I only need to "clone" an
2012 Apr 21
4
[LLVMdev] Remove function from module
Thanks, but I replaceAllUsesWith() - works well, but I still get bug in eraseFromParent(): While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi An asserting value handle still pointed to this value! UNREACHABLE executed at /Users/neonomaly/LLVM/LLVM/lib/VMCore/Value.cpp:561! Yours sincerely, Kadysev Mikhail 21.04.2012, в 23:45, Nick Lewycky написал(а): > Михаил wrote: >> How correctly
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