[PATCH] D150753: [RISCV] Refactor parseVTypeI and use ParseFail if we parsed more than one identifier.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 23:04:06 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: kito-cheng, asb, frasercrmck, rogfer01, reames.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

Previously we lexed into a SmallVector and unlexed the tokens if
the parsing failed.

This patch gets rid of the SmallVector and the unlexing.

If the first token fails to parse, return MatchFail. This allows us
to fallback to parsing as an immediate. If we successfully parsed the
first token, use ParseFail if any later tokens fail to parse. This
avoids needing to UnLex the tokens.

I've used a state machine to keep track of what component we've
parsed so far.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150753

Files:
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/test/MC/RISCV/rvv/invalid.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150753.522906.patch
Type: text/x-patch
Size: 7190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230517/7c0d39fb/attachment.bin>


More information about the llvm-commits mailing list