[llvm-commits] [PATCH] x86: Always emit displacements when parentheses are present

Kaelyn Uhrain rikka at google.com
Thu Sep 29 16:58:13 PDT 2011


Hi,

In X86AsmPrinter::printLeaMemReference, immediate displacements for memory
references currently are not being emitted if the memory reference has
parentheses and the displacement is zero. This breaks inline assembly code
that adds a constant to the displacement, e.g.: "leal 128+%0, %%edx" where
%0 is a memory reference. Currently the emitted code would look like "leal
128+(%esp)" which triggers a warning (that an operand is missing and zero is
being assumed) with GNU as and is not accepted at all by llvm-mc. With this
patch "leal 128+0(%esp)" is emitted, which is happily accepted by both gas
and llvm-mc.

Cheers,
Kaelyn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110929/b15a6ff3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x86-asm-explicit-zero-displacement.diff
Type: text/x-patch
Size: 2229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110929/b15a6ff3/attachment.bin>


More information about the llvm-commits mailing list