Alberto Barbaro via llvm-dev
2018-Dec-12 18:23 UTC
[llvm-dev] How to get the destination in a LoadInst
Hi all, I have %5 = load i32, i32* %3, align 4 LoadInst and I would like to get reference to the destination ( in this case %5 ). How can I do that? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181212/1d0bd00c/attachment.html>
Doerfert, Johannes Rudolf via llvm-dev
2018-Dec-12 20:37 UTC
[llvm-dev] How to get the destination in a LoadInst
The LoadInst is %5. I'm not sure what you mean by reference though. On 12/12, Alberto Barbaro via llvm-dev wrote:> Hi all, > I have %5 = load i32, i32* %3, align 4 LoadInst and I would like to get > reference to the destination ( in this case %5 ). How can I do that? > > Thanks> _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Johannes Doerfert Researcher Argonne National Laboratory Lemont, IL 60439, USA jdoerfert at anl.gov -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 228 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181212/05a2d469/attachment.sig>
Alberto Barbaro via llvm-dev
2018-Dec-12 21:57 UTC
[llvm-dev] How to get the destination in a LoadInst
Hi, I would like to get the '5'. I would like to know where the loaded value is stored. I don't know which method I should use of the LoadInst class. Hope this clarifies Thanks On Wed, Dec 12, 2018, 20:37 Doerfert, Johannes Rudolf <jdoerfert at anl.gov wrote:> The LoadInst is %5. I'm not sure what you mean by reference though. > > On 12/12, Alberto Barbaro via llvm-dev wrote: > > Hi all, > > I have %5 = load i32, i32* %3, align 4 LoadInst and I would like to get > > reference to the destination ( in this case %5 ). How can I do that? > > > > Thanks > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > -- > > Johannes Doerfert > Researcher > > Argonne National Laboratory > Lemont, IL 60439, USA > > jdoerfert at anl.gov >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181212/fcdfba8a/attachment.html>
Cranmer, Joshua via llvm-dev
2018-Dec-12 22:26 UTC
[llvm-dev] How to get the destination in a LoadInst
I suspect you have some confusion as to how LLVM works. In LLVM terms, an Instruction is essentially an opcode, some opcode-specific flags, and a list of Value operands that it uses. Instructions are themselves Values, so that means that to use the result of an instruction, you pass the Instruction itself to the method that accepts a Value. There is no “destination” of an Instruction in structural terms. In the textual format of LLVM, Instructions are represented by printing out %<name> = <textual representation of an instruction>, and subsequent uses of the instruction are referred to in the %<name> format. Names of instructions (and a few other values) must be unique, with the exception of the empty string. The %<name> representation for an empty name string is replaced with a unique autoincrementing integer that is not readily accessible via the APIs (you need to go through the ModuleSlotTracker to get to it). If you’re really trying to get that exact string for an instruction, you are generally doing something wrong and there is an easier way to go about whatever it is you want to do. From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Alberto Barbaro via llvm-dev Sent: Wednesday, December 12, 2018 13:24 To: llvm-dev at lists.llvm.org Subject: [llvm-dev] How to get the destination in a LoadInst Hi all, I have %5 = load i32, i32* %3, align 4 LoadInst and I would like to get reference to the destination ( in this case %5 ). How can I do that? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181212/f906a499/attachment.html>
Michael Kruse via llvm-dev
2018-Dec-12 22:40 UTC
[llvm-dev] How to get the destination in a LoadInst
Am Mi., 12. Dez. 2018 um 12:24 Uhr schrieb Alberto Barbaro via llvm-dev <llvm-dev at lists.llvm.org>:> I have %5 = load i32, i32* %3, align 4 LoadInst and I would like to get reference to the destination ( in this case %5 ). How can I do that?Once you have a 'reference to %5' what do you intend to do with it? This might help to understand question. Michael
Alberto Barbaro via llvm-dev
2018-Dec-12 23:05 UTC
[llvm-dev] How to get the destination in a LoadInst
Thanks Joshua and Michael, Just to to clarify, I'm experimenting with the Interpreter class and observing the instructions that are executed by it. Just for becoming more confident with LLVM in general I'd like for each instruction to access to the various parts of it. In this instance I would like to access to the %Name that is shown in the textual representation. When I call Instruction.dump() all is printed correctly so I thought there was a way to get the %Name ( in my case 5). So my final goal is to obtain it. I understand that is dinamically generated based on. The execution but I think that in my case I could access to it. Am I wrong? I hope now all is more clear :) Thanks again On Wed, Dec 12, 2018, 22:41 Michael Kruse <llvmdev at meinersbur.de wrote:> Am Mi., 12. Dez. 2018 um 12:24 Uhr schrieb Alberto Barbaro via > llvm-dev <llvm-dev at lists.llvm.org>: > > I have %5 = load i32, i32* %3, align 4 LoadInst and I would like to get > reference to the destination ( in this case %5 ). How can I do that? > > Once you have a 'reference to %5' what do you intend to do with it? > This might help to understand question. > > Michael >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181212/88b5fea3/attachment.html>
David Greene via llvm-dev
2018-Dec-13 15:39 UTC
[llvm-dev] How to get the destination in a LoadInst
"Doerfert, Johannes Rudolf via llvm-dev" <llvm-dev at lists.llvm.org> writes:> The LoadInst is %5. I'm not sure what you mean by reference though.This is a common misunderstanding, one that I think is encouraged by the textual form of IR. "%5 = load" makes it looks like %5 is a destination operand in LoadInst. LLVM IR looks like assembly and in (most) assembly syntax, destinations are instruction operands. Something like "%5 -> load" might have made things more clear, but of course it's too late for that. :) -David