[LLVMdev] incorrect x86 instruction size calculation
clattner at apple.com
Thu Dec 17 13:29:48 PST 2009
On Dec 16, 2009, at 11:21 AM, Butterworth, John W. wrote:
> I‘m trying to write some backends for LLVM that generate code that complies with SFI validation rules by re-implementing SFI for the LLVM x86 backend based on the Google NaCl project.
> However, in trying to implement 32-byte code alignment, X86InstrInfo::GetInstSizeInBytes() is returning incorrect instruction sizes for certain instructions (that I have seen so far): MOV32mi, LEA32r, MOV32mr, and MOV32rm.
This piece of code is rather unfortunate. It is cloned from the JIT and reimplements some of its logic, apparently incorrectly. I believe that the current clients in the tree work ok with over-approximations of the length, they don't need exact answers.
> Has anyone else encountered this? If this turns out to be a bug, rather than some misuse/misinterpretation of the function on my part then I can resubmit it via that channel. Also if I need to submit more information let me know and I will do so.
This definitely sounds like a bug, and improvements are certainly welcome.
Long term, I'm hoping that the MC framework will ultimately provide a more principled and robust way to do this sort of thing, but it will still be several months before it will be robust enough to switch this code over to use it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev