This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add a common base class for RVInstI variations. NFC
ClosedPublic

Authored by craig.topper on Jul 28 2023, 11:21 PM.

Details

Summary

We have multiple variations of InstrFormatI that pack different
fields into the upper 12 bits. The other 20 bits are all the same.

Add base class to capture this commonality and allow subclasses to
explicitly define Inst{31-20}.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 28 2023, 11:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2023, 11:21 PM
craig.topper requested review of this revision.Jul 28 2023, 11:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2023, 11:21 PM
jrtc27 added inline comments.Jul 28 2023, 11:30 PM
llvm/lib/Target/RISCV/RISCVInstrFormats.td
404–406

Use RVInstIBase in another place

Address review comment

asb accepted this revision.Jul 31 2023, 12:39 PM

Thanks, I think this is overall better. I'd thought that having other top-level classes with explicit Inst{...} assignments might be easier to follow, but this patch demonstrates how that incentivises people to inherit from RVInstI and assign imm12 which isn't particularly easy to review.

This revision is now accepted and ready to land.Jul 31 2023, 12:39 PM
This revision was landed with ongoing or failed builds.Jul 31 2023, 1:08 PM
This revision was automatically updated to reflect the committed changes.