This is an archive of the discontinued LLVM Phabricator instance.

[M68k][Disassembler] Fix decoding conflict
ClosedPublic

Authored by 0x59616e on May 18 2022, 1:44 AM.

Details

Summary

This diff fixes decoding conflict between these pair of instructions:

ADD(16|32)dd / ADD(16|32)dr
SUB(16|32)dd / SUB(16|32)dr
AND(16|32)dd / AND(16|32)dr
OR(16|32)dd  / OR(16|32)dr

Diff Detail

Event Timeline

0x59616e created this revision.May 18 2022, 1:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 1:44 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
0x59616e requested review of this revision.May 18 2022, 1:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 1:44 AM
RKSimon added inline comments.May 18 2022, 1:46 AM
llvm/lib/Target/M68k/Disassembler/M68kDisassembler.cpp
130

Some kind of description comment for this kind of thing is always useful.

0x59616e updated this revision to Diff 430300.May 18 2022, 2:38 AM
0x59616e marked an inline comment as done.

Add comment

ricky26 added inline comments.May 18 2022, 2:46 AM
llvm/lib/Target/M68k/M68kInstrArithmetic.td
79

How does this avoid the conflict? Presumably the 'r' version could still specify a data register and it would have the same encoding? 🤔

0x59616e marked an inline comment as done.May 18 2022, 3:12 AM
0x59616e added inline comments.
llvm/lib/Target/M68k/M68kInstrArithmetic.td
79

In our cases, the decoder emitter will recurse down to only two cases, that is, the one with 'r' addressing mode and the 'd' addressing mode. In this special case, decoder emitter will prefer the one with less entropy, i.e. 'd' addressing mode.

0x59616e marked an inline comment as done.May 18 2022, 3:16 AM
ricky26 accepted this revision.May 18 2022, 5:21 AM

LGTM

This revision is now accepted and ready to land.May 18 2022, 5:21 AM
This revision was landed with ongoing or failed builds.May 18 2022, 6:11 PM
This revision was automatically updated to reflect the committed changes.