This is an archive of the discontinued LLVM Phabricator instance.

[mips] Handle UImm16_AltRelaxed match type
ClosedPublic

Authored by abeserminji on Sep 11 2017, 5:59 AM.

Details

Summary

Currently, UImm16_AltRelaxed match type is not handled in MatchAndEmitInstruction(...) function, which may result in llvm_unreachable() behavior.
This patch adds necessary case for this match type.

Diff Detail

Repository
rL LLVM

Event Timeline

abeserminji created this revision.Sep 11 2017, 5:59 AM
sdardis accepted this revision.Sep 12 2017, 3:49 AM

Hm, as far as I can see is what's currently happening--with dati $4, $4, 0x1FFFF for mips64r6 for example--is that the matcher is picking the mips64r6 instruction first, fails to parse it as the third operand is out of range, attempts to parse 'dati $4, $4, 0x1FFFF' as a microMIPS64R6 instruction, fails again as the third operand is out of range but returns an error based on the last mnemonic matched despite that mnemonic being invalid as the target is mips64r6 and not in micromips mode. Since the microMIPS64r6 and MIPS64r6 instruction definitions disagree with each other, we don't get the expected match result, nor do we hit llvm_unreachable due to the error arising from attempting to match that instruction to the microMIPS64r6 instruction definition.

No need for a test case since as far as I can see it's impossible to hit the error path without fixing the microMIPS64r6 instruction definitions, but we're deprecating that backend anyway.

LGTM.

This revision is now accepted and ready to land.Sep 12 2017, 3:49 AM
This revision was automatically updated to reflect the committed changes.