[PATCH] D115192: [RISCV] Improve tracking of EndLoc in the assembly parser.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 14:59:19 PST 2021


craig.topper created this revision.
craig.topper added reviewers: asb, jrtc27, luismarques.
Herald added subscribers: VincentWu, luke957, achieveartificialintelligence, StephenFan, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, kristof.beyls.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

The SMLoc::getFromPointer(S.getPointer() - 1) pattern used in
several place didn't make sense since that puts the End before the
Start location.

This patch corrects this to properly calculate the end location as
we parse. Unsure how much this matters, a lot of these are for custom
operand parsing. If the custom parsing succeeds, the instruction
matching probably won't fail, so the end loc won't be used to build
a range for a diagnostic.

I've also fixed the creation functions for the CSR and VType operands
to assign the EndLoc of the RISCVOperand class using the StartLoc
instead of an empty SMLoc. I don't think these will ever be accessed,
but it makes the code look less like we forgot to assign it. This is
consistent with some operands on the ARM target.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115192

Files:
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115192.392195.patch
Type: text/x-patch
Size: 4066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211206/bf872abc/attachment.bin>


More information about the llvm-commits mailing list