This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Refactor RISCVDisassembler::getInstruction to remove repeated code. NFC
ClosedPublic

Authored by craig.topper on Feb 6 2023, 4:31 PM.

Details

Summary

For 4 byte instructions we were always setting size to 4 eventually. Same
for 2 byte instructions. So do it as soon as we know the from the opcode.

Add a return to the end of the 4 byte code so we don't have to have an else
around the 2 byte code.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 6 2023, 4:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2023, 4:31 PM
craig.topper requested review of this revision.Feb 6 2023, 4:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2023, 4:31 PM
reames accepted this revision.Feb 6 2023, 5:06 PM

LGTM

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
450

whitespace change

This revision is now accepted and ready to land.Feb 6 2023, 5:06 PM
craig.topper added inline comments.Feb 6 2023, 5:23 PM
llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
450

It was intentional. The 2 byte code had a blank line after Insn. I was making them consistent.

This revision was landed with ongoing or failed builds.Feb 6 2023, 9:24 PM
This revision was automatically updated to reflect the committed changes.