[mips] Partially fix PR34391
authorSimon Dardis <simon.dardis@imgtec.com>
Tue, 10 Oct 2017 13:34:45 +0000 (13:34 +0000)
committerSimon Dardis <simon.dardis@imgtec.com>
Tue, 10 Oct 2017 13:34:45 +0000 (13:34 +0000)
commita17a7b619ab336e72c16ced3372a4cbc67709351
tree8f4258b87e1f951033a1cecef7c64e265bb0ce69
parentf01516db8de1b7f7599b3e21f687adc6f2d71df2
[mips] Partially fix PR34391

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 altering the special handling to cope with unexpected inputs
and fine-tune the handling of cases where an register name that is not
available in the current ABI is regarded as not a match for the custom parser
but also not as an outright error.

Also enforces the binutils restriction that only constants are accepted.

This partially resolves PR34391.

Thanks to Ed Maste for reporting the issue!

Reviewers: nitesh.jain, arichardson

Differential Revision: https://reviews.llvm.org/D37476

llvm-svn: 315310
llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/test/MC/Mips/macro-aliases-invalid-wrong-error.s [new file with mode: 0644]
llvm/test/MC/Mips/macro-aliases.s [new file with mode: 0644]