similar to: [LLVMdev] How can I get the destination operand of an instruction?

Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] How can I get the destination operand of an instruction?"

2012 May 09
0
[LLVMdev] How can I get the destination operand of an instruction?
Launcher <st.liucheng at gmail.com> writes: > I am able to access the source operands of an instruction using either > getOperand() or op_iterator, However, I can't find any method available for > destination operand. Someone suggests that instruction itself can represent > the destination operand. > http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-January/037518.html
2012 May 09
2
[LLVMdev] How can I get the destination operand of an instruction?
Sorry, I have typo in my question. I will be careful next time. This is how I obtain the source operands of an instruction. // ----------------------------------------------------------------- BasicBlock::iterator it; ... for(int k=0; k<OpNum; k++){ errs()<<it->getOperand(k)<<" "; } ... // -------------------------------------------------------------------- Also I
2010 Jun 30
4
[LLVMdev] [HEADSUP] Another attempt at CallInst operand rotation
Hi all, I am almost ready for the last step with landing my long-standing patch. I have converted (almost) all low-level interface users of CallInst to respective high-level interfaces. What remains is a handful of hunks to flip the switch. But before I do the final commit I'd like to coerce all external users to code against the high-level interface too. This will (almost, but see below)
2009 May 09
2
[LLVMdev] LLVM related question
I will start with that i am vary grateful for your time.And continue with, i am sorry if my Qs aren't quite accurate( i just started with the LLVM compiler). On Sat, May 9, 2009 at 5:23 PM, Eli Friedman <eli.friedman at gmail.com> wrote: > On Sat, May 9, 2009 at 5:35 AM, Rotem Varon <varonrotem at gmail.com> wrote: > > I need to add a new optimization to the LLVM
2009 Sep 28
2
[LLVMdev] Printing Function Arguments
I am processing the LLVM instructions and right now I am at the 'call' instruction. For now I just want to print the argument type. For example in the following: %0 = tail call i32 (...)* @__FFF (i32 8) nounwind; <i32> [#uses=1] I need to get access to 'i32' and '8' separately. I do: CallInst *CI = dyn_cast<CallInst>(I); Value *v = CI->getOperand(1)
2013 Mar 04
2
[LLVMdev] llvm cannot iterate a [3 x i8]
Hello everyone, I am trying to "parse" a part of LLVM IR. More exactly, from @.str = private unnamed_addr constant [3 x i8] c"DS\00", section "llvm.metadata" I want to get "DS". It is the single place in the whole bytecode from where I can get it. I have : ... Value *VV = cast<Value>(LD100->getOperand(1)->getOperand(0));
2014 Dec 11
2
[LLVMdev] Dereferencing null pointers
Hi, I would like to understand better the meaning of constant null pointer in LLVM IR. Can the optimizer assume that dereferencing a null pointer is always unreachable? Or is it only the case for address space 0? Is it ok to have null pointer be a valid pointer for an address space other than 0? In InstCombine pass in InstCombiner::visitLoadInst(LoadInst &LI) I see that we replace load of
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
2014 Dec 11
2
[LLVMdev] Dereferencing null pointers
Sorry for the confusion, I pasted the code I fixed locally... Here is the code at top of the trunk: // load (select (cond, null, P)) -> load P if (Constant *C = dyn_cast<Constant>(SI->getOperand(1))) if (C->isNullValue()) { LI.setOperand(0, SI->getOperand(2)); return &LI; } So it is a bug? -----Original Message----- From:
2009 Sep 28
3
[LLVMdev] Printing Function Arguments
Hi Nick, Thanks, that seemed to work. Nick Lewycky wrote: > > ivtm wrote: >> I am processing the LLVM instructions and right now I am at the 'call' >> instruction. >> For now I just want to print the argument type. >> >> For example in the following: >> >> %0 = tail call i32 (...)* @__FFF (i32 8) nounwind; <i32> [#uses=1]
2012 Apr 19
3
[LLVMdev] def-use chains and use-def chains
Hi, I need to find out all the places where the value of a variable is being used. For this I have to implement reaching definitions(def-use chains). When I searched for its implementation I found Iterating over def-use & use-def chains <http://llvm.org/docs/ProgrammersManual.html#iterate_chains>. will this work for finding the places where a variable is reaching? I tried to use
2005 Jul 11
2
[LLVMdev] Getting started with LLVM Passes
... here is some generally useful information I should have cc'd to llvmdev in the first place ... -Chris -- http://nondot.org/sabre/ http://llvm.cs.uiuc.edu/ ---------- Forwarded message ---------- Date: Sun, 10 Jul 2005 21:41:55 -0500 (CDT) From: Chris Lattner <sabre at nondot.org> To: Sean Peisert <peisert at gmail.com> Subject: Re: [LLVMdev] Getting started with LLVM
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>
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
2008 Mar 12
3
[LLVMdev] Question about use-def chain
Programmers’ manual says we can iterate over a use-def chain by op_iterator. It works fine except for load and store instruction of stack variables. For example, a simple bitcode is like the below. i = alloca i32 store i32 0, i32* %i, align 4 %tmp1 = load i32* %i, align 4 If I apply a use-def chain to load instruction, I get alloca instruction. I think store instruction is a correct
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 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
2013 Jan 10
2
[LLVMdev] LLVM Instruction*->getOperand() not working properly for ICMP
Hello everyone ! In my pass I inspect the penultimate instruction from every basic block in runOnFunction(). I am interested in ICMP instructions only. if(BB->size()>1) if(last->getPrevNode()) { previous = last->getPrevNode(); ok=1; } I want to get the operands of previous, which is of type Instruction*. Due tests based on getNumOperands, ICMP has 2 (as
2009 May 09
0
[LLVMdev] LLVM related question
On Sat, May 9, 2009 at 8:37 AM, Rotem Varon <varonrotem at gmail.com> wrote: > Its not x86 IR nor  x86 assembly. I have x86 IR "like" instructions ( add > R1, R2, R3    and so...) >> >>  If it's really >> x86 assembly, you can use LLVM's code generator to get x86 assembly, > > Do you mean the "llvm-gcc -S file.c" , or can i have the
2005 Jul 12
0
[LLVMdev] Getting started with LLVM Passes
Chris, I've now figured out how to track and single out specific instructions, which was ridiculously easy. Thanks! I'm now on to trying to find more detail about those instructions, such as the values and addresses of the operands in memory (or, in the case of operands which are pointers, trying to get the pointer values, addresses, and values stored at location specified by