Qiuping yi
2010-Apr-06 08:32 UTC
[LLVMdev] How to get the left-hand operand of an instruction?
Hi, I am a new novice of LLVM, and I want know how to get the left-hand operand of an instruction? For example: how to get the %temp2 operand in the next instruction: %temp2 = malloc i8, i32 %n Thanks a lot! Best Regards! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100406/be299269/attachment.html>
Duncan Sands
2010-Apr-06 09:03 UTC
[LLVMdev] How to get the left-hand operand of an instruction?
Hi Qiuping yi,> I am a new novice of LLVM, and I want know how to get the left-hand > operand of an instruction? > > For example: > how to get the %temp2 operand in the next instruction: > > %temp2 = malloc i8, i32 %nthere is no left-hand side, temp2 is just a name for the instruction. Since the LLVM IR is in SSA form, registers have exactly one definition, and thus there is no point in distinguishing between a register and the instruction that defines it. In short, whenever you would like to make use of "%temp2", just use the instruction ("malloc i8, i32 %n") directly. Ciao, Duncan.
Liu Jian
2010-Apr-06 09:41 UTC
[LLVMdev] How to get the left-hand operand of an instruction?
Yes, Duncan is right. You can use ("malloc i8, i32 %n") as a value to mark its uses. cheers, Liu Jian ---- email to: gjk.liu at gmail.com On Tue, Apr 6, 2010 at 5:03 PM, Duncan Sands <baldrick at free.fr> wrote:> Hi Qiuping yi, > > > I am a new novice of LLVM, and I want know how to get the left-hand > > operand of an instruction? > > > > For example: > > how to get the %temp2 operand in the next instruction: > > > > %temp2 = malloc i8, i32 %n > > there is no left-hand side, temp2 is just a name for the instruction. > Since the LLVM IR is in SSA form, registers have exactly one definition, > and thus there is no point in distinguishing between a register and the > instruction that defines it. In short, whenever you would like to make > use of "%temp2", just use the instruction ("malloc i8, i32 %n") directly. > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100406/3944d8ab/attachment.html>
increaseing
2010-Apr-06 11:37 UTC
[LLVMdev] How to get the left-hand operand of an instruction?
Hi Duncan, I have catched your reply and solved the problem. Thank you for the elaborate reply. Best Regards! 2010/4/6 Duncan Sands <baldrick at free.fr>> Hi increaseing, please ask on the list rather than writing to me directly. > That way others can answer, and the discussion is archived for the benefit > of people with the same question in the future. > > Best wishes, > > Duncan. > > I have another question: >> If I want to catch the point pointing to an allocated regin using malloc >> and its length(for example, x.p and n in the next statement), what >> should I do? >> x.p = malloc(n); >> Thank you very much! >> Best Regards! >> >> >> 2010/4/6 Duncan Sands <baldrick at free.fr <mailto:baldrick at free.fr>> >> >> >> Hi Qiuping yi, >> >> > I am a new novice of LLVM, and I want know how to get the left-hand >> > operand of an instruction? >> > >> > For example: >> > how to get the %temp2 operand in the next instruction: >> > >> > %temp2 = malloc i8, i32 %n >> >> there is no left-hand side, temp2 is just a name for the instruction. >> Since the LLVM IR is in SSA form, registers have exactly one >> definition, >> and thus there is no point in distinguishing between a register and the >> instruction that defines it. In short, whenever you would like to make >> use of "%temp2", just use the instruction ("malloc i8, i32 %n") >> directly. >> >> Ciao, >> >> Duncan. >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> >> http://llvm.cs.uiuc.edu <http://llvm.cs.uiuc.edu/> >> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100406/964f9aba/attachment.html>