This is an archive of the discontinued LLVM Phabricator instance.

[mips] Partially fix PR34391
ClosedPublic

Authored by sdardis on Sep 5 2017, 7:46 AM.

Details

Summary

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 ab outright error.

Also enforces the binutils restriction that only constants are accepted.

This partially resolves PR34391.

Thanks to Ed Maste for reporting the issue!

Diff Detail

Repository
rL LLVM

Event Timeline

sdardis created this revision.Sep 5 2017, 7:46 AM
nitesh.jain accepted this revision.Sep 18 2017, 10:16 PM

LGTM.

Thanks

This revision is now accepted and ready to land.Sep 18 2017, 10:16 PM
sdardis planned changes to this revision.Sep 20 2017, 11:37 AM

Found an issue when doing some final testing. One of the invalid tests (test/mc/mips2/invalid-mips3.s) reports a wrong operand error, as the parser uses the generic parser rather than the operand specific parser. It parses '$a4' as an immediate and rejects it, as the register matcher doesn't match $a4 as a register as the O32 abi is in use.

sdardis updated this revision to Diff 116078.Sep 20 2017, 2:46 PM
sdardis retitled this revision from [mips] Fix PR34391 to [mips] Partially fix PR34391.
sdardis edited the summary of this revision. (Show Details)

Address failures by handling non-constants in the parser. Also handle the differences between register names/symbols between ABIs.

This revision is now accepted and ready to land.Sep 20 2017, 2:46 PM
arichardson accepted this revision.Sep 29 2017, 5:18 AM

This fixes the crashes we had when compiling some CheriBSD kernel assembly.

This revision was automatically updated to reflect the committed changes.