<div dir="ltr">Hi Jon,<div><br></div><div>It should be possible for you to get rid of this error by populating the array of live in registers</div><div>with the registers that are used by the call instruction in the basic block that contains this</div><div>instruction.</div><div><br></div><div>So, for you error above, the basic block BB#126 would have an array of live ins that would</div><div>contain the following registers: [ '%edi', '%rsi', '%rdx', '%rcx', '%r8', '%r9d', '%al' ]. You don't</div><div>need to include %rsp in this array. I don't think you don't need to include '%eax' as well as it's</div><div>defined by the call instruction.</div><div><br></div><div>Alex</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-07-28 1:52 GMT-07:00 Johnny Bory <span dir="ltr"><<a href="mailto:johnny.bory.12@gmail.com" target="_blank">johnny.bory.12@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="font-size:12.8000001907349px">Hi,</span><br style="font-size:12.8000001907349px"><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">i have got some troubles while writing an X86 machine pass to instrumentate indirect calls . </span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Basically, every time i run into a CALL64r i would like to have this situation:</span><br style="font-size:12.8000001907349px"><font face="monospace, monospace" style="font-size:12.8000001907349px">                 ------<br>                | .... |<br>                | CMP  |</font><div style="font-size:12.8000001907349px"><font face="monospace, monospace">                | JE   |</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">                 ------</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">                  |  |</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">                ---  -----</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">                |        |</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">                ----    ---- </font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">               |EXIT|  |CALL|</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">                ----   |....|</font></div><div style="font-size:12.8000001907349px"><font face="monospace, monospace">                        ----</font><br><font face="arial, helvetica, sans-serif">So i do a splice, fix up successors and predecessors, but since the call implicitly uses some register the compilation fails with a lot of this:<br><br>  *** Bad machine code: Using an undefined physical register ***</font></div><div style="font-size:12.8000001907349px"><font face="arial, helvetica, sans-serif">- function:    foo</font></div><div style="font-size:12.8000001907349px"><font face="arial, helvetica, sans-serif">- basic block: BB#126 (null) (0x6127658)</font></div><div style="font-size:12.8000001907349px"><font face="arial, helvetica, sans-serif">- instruction: CALL64r %vreg41, <regmask>, %RSP<imp-use>, %EDI<imp-use>, %RSI<imp-use>, %RDX<imp-use>, %RCX<imp-use>, %R8<imp-use>, %R9D<imp-use>, %AL<imp-use>, %RSP<imp-def>, %EAX<imp-def>; GR64:%vreg41<br><br>How can i get rid of this errors?<br><br>Thank you very much,<br><br>-- Jon</font></div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>