[PATCH] D37476: [mips] Fix PR34391

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 07:48:10 PDT 2017


sdardis created this revision.
Herald added a subscriber: arichardson.

Previously, the parsing of the 'subu $reg, ($reg,) imm' relied on a parser
which also rendered the operand to the instruction. In some cases the
general parser could construct an MCExpr which was not a MCConstantExpr
which MipsAsmParser was expecting.

Address this by removing the special handling and reusing the same handling
of operands as the rest of the asm instructions but during rendering inverting
the immediate. This allows the parser to gracefully fail when encountering
something unexpected.

Also enforce the binutils restriction that only constants are accepted.

This resolves PR34391.

Thanks to Ed Maste for reporting the issue!


Repository:
  rL LLVM

https://reviews.llvm.org/D37476

Files:
  lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  lib/Target/Mips/MipsInstrInfo.td
  test/MC/Mips/macro-aliases-invalid.s
  test/MC/Mips/macro-aliases.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37476.113857.patch
Type: text/x-patch
Size: 6038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170905/08e18964/attachment.bin>


More information about the llvm-commits mailing list