[all-commits] [llvm/llvm-project] fd6cd1: [RISCV] Refactor parseVTypeI and use ParseFail if ...

Craig Topper via All-commits all-commits at lists.llvm.org
Wed May 17 10:31:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fd6cd1a249136e93e73cc09c3408871255c5ae72
      https://github.com/llvm/llvm-project/commit/fd6cd1a249136e93e73cc09c3408871255c5ae72
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-05-17 (Wed, 17 May 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
    M llvm/test/MC/RISCV/rvv/invalid.s

  Log Message:
  -----------
  [RISCV] Refactor parseVTypeI and use ParseFail if we parsed more than one identifier.

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.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D150753




More information about the All-commits mailing list