[PATCH] D152192: [RISCV] Make .option arch parser less mind-bending

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 13:26:58 PDT 2023


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

Currently the early-return flow in the infinite loop makes it hard to
find the non-error termination points amongst the sea of errors. Rewrite
it with a more conventional control flow that has a clear loop guard (in
place of one of the early returns) and a break (in place of the other),
and with greater code reuse.

This has a small effect on the errors given for malformed input, as seen
in the affected test, and is probably more helpful as a result. Note
that we also bail early now if parseComma fails, as is standard.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152192

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152192.528562.patch
Type: text/x-patch
Size: 4981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230605/c9c61601/attachment.bin>


More information about the llvm-commits mailing list