This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][NFC] Use !format to simplify some code
AcceptedPublic

Authored by wangpc on Jul 27 2023, 6:57 AM.

Details

Summary

To show the usage of !format.

Diff Detail

Event Timeline

wangpc created this revision.Jul 27 2023, 6:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2023, 6:57 AM
wangpc requested review of this revision.Jul 27 2023, 6:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2023, 6:57 AM
craig.topper added inline comments.Jul 27 2023, 8:50 AM
llvm/lib/Target/RISCV/RISCVInstrInfo.td
205

Why do we need !format for DecoderMethod?

craig.topper added inline comments.Jul 31 2023, 12:47 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.td
202–206

Instead of a foreach, can we have a class or two that takes the number of bits as a parameter?

Then we can have something like

uimm1 : UImmOperand<1>, UImmLeaf<1>;
uimm5 : UImmOperand<5>, UImmLeaf<5>;

That would make it much easier to find whether uimm1 or uimm5 already exist with a grep when we need them.

wangpc updated this revision to Diff 546031.Aug 1 2023, 6:43 AM

Address comments.

wangpc marked 2 inline comments as done.Aug 1 2023, 7:00 AM
craig.topper accepted this revision.Aug 1 2023, 9:53 AM

LGTM

llvm/lib/Target/RISCV/RISCVInstrInfo.td
165

space before :

This revision is now accepted and ready to land.Aug 1 2023, 9:53 AM