[PATCH] D41728: [TableGen][AsmMatcherEmitter] Remove boolean 'Hack' parameter

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 09:09:07 PST 2018


sdesmalen created this revision.
sdesmalen added reviewers: fhahn, rengolin, apazos, dsanders, sabuasal.

An instruction alias should be able to specify the same
(tied) operand twice in the asm string if the asm parser makes
sure the tied operand constraint is satisfied.


https://reviews.llvm.org/D41728

Files:
  utils/TableGen/AsmMatcherEmitter.cpp


Index: utils/TableGen/AsmMatcherEmitter.cpp
===================================================================
--- utils/TableGen/AsmMatcherEmitter.cpp
+++ utils/TableGen/AsmMatcherEmitter.cpp
@@ -574,7 +574,7 @@
 
   /// validate - Return true if this matchable is a valid thing to match against
   /// and perform a bunch of validity checking.
-  bool validate(StringRef CommentDelimiter, bool Hack) const;
+  bool validate(StringRef CommentDelimiter) const;
 
   /// findAsmOperand - Find the AsmOperand with the specified name and
   /// suboperand index.
@@ -1080,7 +1080,7 @@
     addAsmOperand(String.substr(Prev), IsIsolatedToken);
 }
 
-bool MatchableInfo::validate(StringRef CommentDelimiter, bool Hack) const {
+bool MatchableInfo::validate(StringRef CommentDelimiter) const {
   // Reject matchables with no .s string.
   if (AsmString.empty())
     PrintFatalError(TheDef->getLoc(), "instruction with empty asm string");
@@ -1114,15 +1114,8 @@
                       "matchable with operand modifier '" + Tok +
                       "' not supported by asm matcher.  Mark isCodeGenOnly!");
 
-    // Verify that any operand is only mentioned once.
-    // We reject aliases and ignore instructions for now.
+    // If an operand is mentioned more than once, issue a warning.
     if (Tok[0] == '$' && !OperandNames.insert(Tok).second) {
-      if (!Hack)
-        PrintFatalError(TheDef->getLoc(),
-                        "ERROR: matchable with tied operand '" + Tok +
-                        "' can never be matched!");
-      // FIXME: Should reject these.  The ARM backend hits this with $lane in a
-      // bunch of instructions.  It is unclear what the right answer is.
       DEBUG({
         errs() << "warning: '" << TheDef->getName() << "': "
                << "ignoring instruction with tied operand '"
@@ -1556,7 +1549,7 @@
 
       // Ignore instructions which shouldn't be matched and diagnose invalid
       // instruction definitions with an error.
-      if (!II->validate(CommentDelimiter, true))
+      if (!II->validate(CommentDelimiter))
         continue;
 
       Matchables.push_back(std::move(II));
@@ -1587,7 +1580,7 @@
       II->initialize(*this, SingletonRegisters, Variant, HasMnemonicFirst);
 
       // Validate the alias definitions.
-      II->validate(CommentDelimiter, false);
+      II->validate(CommentDelimiter);
 
       Matchables.push_back(std::move(II));
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41728.128616.patch
Type: text/x-patch
Size: 2423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180104/ff44889e/attachment.bin>


More information about the llvm-commits mailing list