This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][MC] Fold UIMM related code
ClosedPublic

Authored by sunshaoce on Jun 23 2022, 10:49 PM.

Diff Detail

Event Timeline

sunshaoce created this revision.Jun 23 2022, 10:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 10:49 PM
sunshaoce requested review of this revision.Jun 23 2022, 10:49 PM
craig.topper added a comment.EditedJun 23 2022, 11:09 PM

If isUImm4() isn't used by the assembly parser then it's not missing is it?

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
579

Why not use a template function?

sunshaoce updated this revision to Diff 439678.Jun 24 2022, 2:38 AM

Address comment

sunshaoce retitled this revision from [RISCV][MC] Fold UIMM related code and add the missing isUImm functions to [RISCV][MC] Fold UIMM related code.Jun 24 2022, 2:38 AM
sunshaoce edited the summary of this revision. (Show Details)

Personally, I would just leave the raw case statements, but I don't really care that much either way.
Overall, LGTM.

BTW, I guess in C++ you can't do an alias specialization of a function template (e.g. using isUImm2 = IsUImm<2>;), which would avoid introducing those wrapper functions, right? I'm not really sure why that is (the equivalent thing in D just works, and the template model is similar), but I also am not sure I want to find out :)

This revision is now accepted and ready to land.Jun 24 2022, 2:52 PM
This revision was landed with ongoing or failed builds.Jun 24 2022, 7:51 PM
This revision was automatically updated to reflect the committed changes.
sunshaoce marked an inline comment as done.