This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Replace OperandMatchResultTy with ParseStatus (NFC)
ClosedPublic

Authored by barannikov88 on Jul 1 2023, 4:16 PM.

Details

Summary

ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:

return Error(L, "msg");

when with MatchOperandResultTy it had to be:

Error(L, "msg");
return MatchOperand_ParseFail;

It also has more appropriate name since parse* methods are not only for
parsing operands.

Diff Detail

Event Timeline

barannikov88 created this revision.Jul 1 2023, 4:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2023, 4:16 PM
barannikov88 requested review of this revision.Jul 1 2023, 4:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2023, 4:16 PM

Noticed while refactoring.

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

For now, parseRegister can only return Success or NoMatch. If it ever returns Failure, all callsites should be updated.

2460

If parseImmediate fails, two errors are reported.

asb accepted this revision.Jul 3 2023, 3:32 AM

LGTM. I think this is a nice cleanup - thank you.

This revision is now accepted and ready to land.Jul 3 2023, 3:32 AM