Hi Jon,
It should be possible for you to get rid of this error by populating the
array of live in registers
with the registers that are used by the call instruction in the basic block
that contains this
instruction.
So, for you error above, the basic block BB#126 would have an array of live
ins that would
contain the following registers: [ '%edi', '%rsi',
'%rdx', '%rcx', '%r8',
'%r9d', '%al' ]. You don't
need to include %rsp in this array. I don't think you don't need to
include
'%eax' as well as it's
defined by the call instruction.
Alex
2015-07-28 1:52 GMT-07:00 Johnny Bory <johnny.bory.12 at gmail.com>:
> Hi,
>
> i have got some troubles while writing an X86 machine pass to
> instrumentate indirect calls .
> Basically, every time i run into a CALL64r i would like to have this
> situation:
> ------
> | .... |
> | CMP |
> | JE |
> ------
> | |
> --- -----
> | |
> ---- ----
> |EXIT| |CALL|
> ---- |....|
> ----
> 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:
>
> *** Bad machine code: Using an undefined physical register ***
> - function: foo
> - basic block: BB#126 (null) (0x6127658)
> - 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
>
> How can i get rid of this errors?
>
> Thank you very much,
>
> -- Jon
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150728/96704fa9/attachment.html>