[llvm-dev] Finding the last producer of a register value

fami Hoseini via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 2 17:58:29 PST 2016


Hello,
I have a question which might be repetitive to some extent, but I'd be
greatful if anyone can give me a clear answer. I have worked with LLVM
front-end. There, it is easy to find def-use chain for IR instructions
using USER::op_iterator and Value::use_iterator.
Now I want to do some analysis on the machine code in the backend, for
which I need to find this def-use chain again. What I need is basically to
get a source register of one instruction and identify the last instruction
that defines its value.
I read in the forum that MachineRegisterInfo::defusechain_iterators can be
used to find all define and use of a register, and yet they might not be in
order of the their appearance in the machine function. It's a bit strange
to me, since providing an easy tool for this purpose seems necessary to me
for creating multiple code optimizations. Could you please tell me if there
is a way (perhaps in the newer versions) to do this  analysis with low
complexity?

Thank you in advance,
Fami
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161202/faac440a/attachment.html>


More information about the llvm-dev mailing list