This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Rework how implied SP operands work in the disassembler. NFC
ClosedPublic

Authored by craig.topper on May 5 2023, 12:03 AM.

Details

Summary

Previously we added the SP operands when an immediate operand was added
to certain opcodes.

This patch moves it to a post processing step using the information
in MCInstrDesc. This avoids an explicit opcode list in RISCVDisassembler.cpp.

In considered using a custom DecoderMethod, but the bit swizzling we
need to do for the immediates on these instructions made that
unattractive.

Diff Detail

Event Timeline

craig.topper created this revision.May 5 2023, 12:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2023, 12:03 AM
craig.topper requested review of this revision.May 5 2023, 12:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2023, 12:03 AM
asb accepted this revision.May 16 2023, 8:20 AM

LGTM.

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

I know you just copied this from the previous function, but perhaps change to "Add implied SP operand for C.*SP compressed instructions. [...]"

This revision is now accepted and ready to land.May 16 2023, 8:20 AM
evandro removed a subscriber: evandro.May 17 2023, 3:55 PM