[llvm-dev] How to get the destination in a LoadInst

Cranmer, Joshua via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 12 14:26:53 PST 2018

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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181212/f906a499/attachment.html>

More information about the llvm-dev mailing list