[PATCH] Correctly assemble unsized call instructions.

Reid Kleckner rnk at google.com
Mon Jul 28 16:09:54 PDT 2014


Oops, I wrote these comments and never sent them.  :(

================
Comment at: lib/Target/X86/AsmParser/X86AsmParser.cpp:1557
@@ -1552,1 +1556,3 @@
+  } else {
+  //  Size = is64BitMode() ? 64 : (is32BitMode() ? 32 : 16);
   }
----------------
I assume this is intended to be uncommented?

================
Comment at: lib/Target/X86/AsmParser/X86Operand.h:213
@@ -211,3 +212,3 @@
   bool isMem16() const {
     return Kind == Memory && (!Mem.Size || Mem.Size == 16);
   }
----------------
Returning true for Size == 0 seems suspect to me.  What tests fail if we remove that clause?  My guess is that we start failing to match instructions like 'mov %eax, (%ebx)', because now isMem32 will return false for '(%ebx)'.

I think maybe the real fix is to remove this clause, and then add an 'isMemUnsized()' predicate, which the asm matcher uses to figure out memory operand sizes when the size is implied by the at&t size suffix (movll, movw) or the size of another operand (mov %eax, (%ebx)).

================
Comment at: test/MC/X86/intel-syntax-unsized-operand.s:11
@@ +10,2 @@
+call dword ptr [edx]
+call word ptr [edx]
----------------
What do we do for other instructions that take a single memory operand, like 'inc' and 'dec'?

http://reviews.llvm.org/D4612






More information about the llvm-commits mailing list