[PATCH] D154276: [RISCV] Use parseDirective returning ternary status
Sergei Barannikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 30 19:13:16 PDT 2023
barannikov88 created this revision.
barannikov88 added a reviewer: craig.topper.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
barannikov88 requested review of this revision.
Herald added subscribers: llvm-commits, wangpc, eopXD, MaskRay.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154276
Files:
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
Index: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
===================================================================
--- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -116,7 +116,7 @@
bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
SMLoc NameLoc, OperandVector &Operands) override;
- bool ParseDirective(AsmToken DirectiveID) override;
+ ParseStatus parseDirective(AsmToken DirectiveID) override;
bool parseVTypeToken(StringRef Identifier, VTypeState &State, unsigned &Sew,
unsigned &Lmul, bool &Fractional, bool &TailAgnostic,
@@ -2606,11 +2606,7 @@
return false;
}
-bool RISCVAsmParser::ParseDirective(AsmToken DirectiveID) {
- // This returns false if this function recognizes the directive
- // regardless of whether it is successfully handles or reports an
- // error. Otherwise it returns true to give the generic parser a
- // chance at recognizing it.
+ParseStatus RISCVAsmParser::parseDirective(AsmToken DirectiveID) {
StringRef IDVal = DirectiveID.getString();
if (IDVal == ".option")
@@ -2622,7 +2618,7 @@
if (IDVal == ".variant_cc")
return parseDirectiveVariantCC();
- return true;
+ return ParseStatus::NoMatch;
}
bool RISCVAsmParser::resetToArch(StringRef Arch, SMLoc Loc, std::string &Result,
@@ -2978,7 +2974,7 @@
if (getParser().parseIdentifier(Name))
return TokError("expected symbol name");
if (parseEOL())
- return false;
+ return true;
getTargetStreamer().emitDirectiveVariantCC(
*getContext().getOrCreateSymbol(Name));
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154276.536496.patch
Type: text/x-patch
Size: 1670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230701/ab443e99/attachment.bin>
More information about the llvm-commits
mailing list