[PATCH] D23496: [TableGen] Make AsmMatcherEmitter unconditionally expose OperandMatchResultTy enum

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 01:47:00 PDT 2016


asb created this revision.
asb added reviewers: stoklund, craig.topper.
asb added a subscriber: llvm-commits.

As it stands, the OperandMatchResultTy is only included in the generated header if there is custom operand parsing. However, almost all backends make use of `MatchOperand_Success` and friends from OperandMatchResultTy for e.g. parseRegister. This is a pain when starting an AsmParser for a new backend that doesn't yet have custom operand parsing.

It could be argued that if this enum is used semi-universally it should be included in a normal header file rather than generated AsmMatcherEmitter. If so, where should it be defined? I'd be happy to submit such a patch if there were consensus that is the better way to handle this.

https://reviews.llvm.org/D23496

Files:
  utils/TableGen/AsmMatcherEmitter.cpp

Index: utils/TableGen/AsmMatcherEmitter.cpp
===================================================================
--- utils/TableGen/AsmMatcherEmitter.cpp
+++ utils/TableGen/AsmMatcherEmitter.cpp
@@ -2891,12 +2891,13 @@
      << " bool matchingInlineAsm,\n"
      << "                                unsigned VariantID = 0);\n";
 
-  if (!Info.OperandMatchInfo.empty()) {
     OS << "\n  enum OperandMatchResultTy {\n";
     OS << "    MatchOperand_Success,    // operand matched successfully\n";
     OS << "    MatchOperand_NoMatch,    // operand did not match\n";
     OS << "    MatchOperand_ParseFail   // operand matched but had errors\n";
     OS << "  };\n";
+
+  if (!Info.OperandMatchInfo.empty()) {
     OS << "  OperandMatchResultTy MatchOperandParserImpl(\n";
     OS << "    OperandVector &Operands,\n";
     OS << "    StringRef Mnemonic);\n";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23496.68003.patch
Type: text/x-patch
Size: 857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160815/1f8e2b36/attachment.bin>


More information about the llvm-commits mailing list