LLVM Instruction
allows you to determine the operator and operands. How can you determine the name of the reg that the instruction is assigning to?
This question: How to tell if LLVM Instruction has a Left-Hand Side asks if there's a way to determine if there is a LHS assignment, and the answer is "almost always". But how do we determine it's name? E.g. how do we differentiate %1 = xor i8 %2, i8 %3
from %5 = xor i8 %2, i8 %3
UPDATE
To illustrate, the following C compiles to the following IR:
int c1(int a, int b, int c) {
int d, e, f;
if (a < b && b >= c) {
...
How do I determine that the first instruction of c1
assigns to %4
?
; Function Attrs: norecurse nounwind optsize readnone uwtable
define dso_local i32 @c1(i32 %0, i32 %1, i32 %2) local_unnamed_addr #1 {
%4 = icmp sge i32 %0, %1
...