[PATCH] D32636: [x86][inline-asm][llvm]Amend size directive deduction mechanism of unsized memory operands

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 09:31:38 PDT 2017


rnk added a comment.

In https://reviews.llvm.org/D32636#746140, @rnk wrote:

> https://reviews.llvm.org/rL166316 was the commit that originally added the AOK_SizeDirective logic for inline asm. @mcrosier said "This allows the backend to do proper instruction selection." I think now that we have the unsized mem operand matching loop, we don't need this rewrite at all, it's just getting in the way.


I take this back, we do need it. I had a vague memory that MSVC doesn't do any of this memory operand size disambiguation based on frontend information, but that's not true. There are a few instructions that take registers, but can have varying memory operand size, like movzx:

  void t13() {
    char i = 1;
    short j = 2;
    __asm movzx eax, [i]
    __asm movzx eax, [j]
  }

MSVC's object file disassembles as:

  00000000: 0F B6 05 00 00 00  movzx       eax,byte ptr [_i]
            00
  00000007: 0F B7 05 00 00 00  movzx       eax,word ptr [_j]
            00

We need the size from the frontend to disambiguate this.


Repository:
  rL LLVM

https://reviews.llvm.org/D32636





More information about the llvm-commits mailing list