<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Sounds like Hu found a solution, so this is just for the record:</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 21, 2017, at 2:23 AM, Nemanja Ivanovic <<a href="mailto:nemanja.i.ibm@gmail.com" class="">nemanja.i.ibm@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I just realized that I forgot to mention where you can get the info about a physical register unused in the function (if that's what you're after):<br class="">MachineRegisterInfo::isConstantPhysReg()<br class=""></div></div></blockquote>isConstantPhysReg() is not really a test for checking whether a register is completely unused in a function. That is done with MachineRegisterInfo::isPhysRegUsed().</div><div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sat, Jan 21, 2017 at 11:17 AM, Nemanja Ivanovic <span dir="ltr" class=""><<a href="mailto:nemanja.i.ibm@gmail.com" target="_blank" class="">nemanja.i.ibm@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class=""><div class="">I'm not sure exactly what you're after.<br class=""></div>I was under the impression that you want to know which register is live at a specific point (an instruction). If that's the case, how do one of the two suggested solutions not suffice?<br class="">If a register is live-in to a block and not killed before your instruction or it has a def and no kill within the block, it is live. Otherwise it is dead and available. Isn't it?<br class=""></div>Or are you interested in whether a physical register is unused in the entire function?<br class=""></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sat, Jan 21, 2017 at 10:21 AM, Hong Hu <span dir="ltr" class=""><<a href="mailto:huhong789@gmail.com" target="_blank" class="">huhong789@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_default" style="font-size:small">Hi Nemanja and Matthias,</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">Thanks for the reply. </div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">I checked both Register Scavenger and LivePhysReg. It seems that both work on the BasicBlock level, right? </div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">Is it possible to perform such analysis in a whole function? For example, considering the calling convention (where the rsi, rdi will be in use from the beginning) and the return convention (where rax will be in use in the last bb).</div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="m_1648218633823925671m_-3948889503114184922gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">Regards,<div class="">Hu Hong</div></div></div></div>
<br class=""><div class="gmail_quote">On 20 January 2017 at 03:55, Matthias Braun <span dir="ltr" class=""><<a href="mailto:mbraun@apple.com" target="_blank" class="">mbraun@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">There is also the LivePhysReg facility that I would recomment if you just want to query for a free register and do not need the full feature set of the RegisterScavenger.</div><span class="m_1648218633823925671m_-3948889503114184922HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">- Matthias</div></font></span><div class=""><div class="m_1648218633823925671m_-3948889503114184922h5"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 19, 2017, at 5:50 AM, Nemanja Ivanovic via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_1648218633823925671m_-3948889503114184922m_1628503878704883635Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">I believe what you're after is the register scavenger.<br class=""></div><div class="">It's in: include/llvm/CodeGen/RegisterS<wbr class="">cavenging.h</div>Implementation: lib/CodeGen/RegisterScavenging<wbr class="">.cpp<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jan 19, 2017 at 1:36 PM, Hong Hu via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div style="font-size:small" class="">Hi All,</div><div style="font-size:small" class=""><br class=""></div><div style="font-size:small" class="">Given a machine instruction, is it possible to tell which register(s) is still not in use? </div><div style="font-size:small" class=""><br class=""></div><div style="font-size:small" class="">For example, given one instruction A, if the one follows it (say B) defines register rax, then I can tell rax should spare at instruction A. </div><div style="font-size:small" class=""><br class=""></div><div style="font-size:small" class="">The purpose is to use the spare register to replace registers used by A, for instrumentation purpose.</div><div style="font-size:small" class=""><br class=""></div><div class=""><div class="m_1648218633823925671m_-3948889503114184922m_1628503878704883635m_-6826991358958350244gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">Regards,<div class="">Hu Hong</div></div></div></div>
</div>
<br class="">______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div>
</blockquote></div><br class=""></div>
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>