[PATCH] D15874: Revert AsmParser changes

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 9 15:07:07 PST 2016


craig.topper added a comment.

I don't see the removal of the Hexagon AsmParser directory here or the tests.


================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2577
@@ -2596,4 +2576,3 @@
   OS << "  // Get the next operand index.\n";
-  OS << "  unsigned NextOpNum = Operands.size()"
-     << (HasMnemonicFirst ? " - 1" : "") << ";\n";
+  OS << "  unsigned NextOpNum = Operands.size();\n";
 
----------------
This should be Operands.size() - 1

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2585
@@ +2584,3 @@
+  OS << Info.OperandMatchInfo.size() << ");\n";
+  OS << "  if(!Mnemonic.empty())\n";
+  OS << "    MnemonicRange = std::equal_range(OperandMatchTable,";
----------------
This Mnemonic.empty() check wasn't here before

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2897
@@ -2927,5 +2896,3 @@
   OS << "  // Eliminate obvious mismatches.\n";
-  OS << "  if (Operands.size() > "
-     << (MaxNumOperands + HasMnemonicFirst) << ") {\n";
-  OS << "    ErrorInfo = "
-     << (MaxNumOperands + HasMnemonicFirst) << ";\n";
+  OS << "  if (Operands.size() > " << MaxNumOperands << ") {\n";
+  OS << "    ErrorInfo = " << MaxNumOperands << ";\n";
----------------
This was MaxNumOperands + 1 before

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2908
@@ +2907,3 @@
+  OS << "  StringRef Mnemonic;\n";
+  OS << "  if (Operands[0]->isToken())\n";
+  OS << "    Mnemonic = ((" << Target.getName()
----------------
This isToken check did not exist before your changes

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2942
@@ +2941,3 @@
+        "MnemonicRange(Start, End);\n";
+  OS << "  unsigned SIndex = Mnemonic.empty() ? 0 : 1;\n";
+  OS << "  if (!Mnemonic.empty())\n";
----------------
The Mnemonic.empty() check and the SIndex variable did not exist before your changes.

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2956
@@ -3004,4 +2955,3 @@
   OS << "    bool OperandsValid = true;\n";
-  OS << "    for (unsigned i = " << (HasMnemonicFirst ? "0" : "SIndex")
-     << "; i != " << MaxNumOperands << "; ++i) {\n";
+  OS << "    for (unsigned i = SIndex; i != " << MaxNumOperands << "; ++i) {\n";
   OS << "      auto Formal = static_cast<MatchClassKind>(it->Classes[i]);\n";
----------------
This should go back i = 0

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2958
@@ -3007,4 +2957,3 @@
   OS << "      auto Formal = static_cast<MatchClassKind>(it->Classes[i]);\n";
-  OS << "      if (i" << (HasMnemonicFirst ? "+1" : "")
-     << " >= Operands.size()) {\n";
+  OS << "      if (i >= Operands.size()) {\n";
   OS << "        OperandsValid = (Formal == " <<"InvalidMatchClass);\n";
----------------
This was i+1 before your changes

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2960
@@ -3010,4 +2959,3 @@
   OS << "        OperandsValid = (Formal == " <<"InvalidMatchClass);\n";
-  OS << "        if (!OperandsValid) ErrorInfo = i"
-     << (HasMnemonicFirst ? "+1" : "") << ";\n";
+  OS << "        if (!OperandsValid) ErrorInfo = i;\n";
   OS << "        break;\n";
----------------
As was this

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2963
@@ -3014,4 +2962,3 @@
   OS << "      }\n";
-  OS << "      MCParsedAsmOperand &Actual = *Operands[i"
-     << (HasMnemonicFirst ? "+1" : "") << "];\n";
+  OS << "      MCParsedAsmOperand &Actual = *Operands[i];\n";
   OS << "      unsigned Diag = validateOperandClass(Actual, Formal);\n";
----------------
And this

================
Comment at: utils/TableGen/AsmMatcherEmitter.cpp:2979
@@ -3031,4 +2978,3 @@
   OS << "      if (!HadMatchOtherThanPredicate &&\n";
-  OS << "          (it == MnemonicRange.first || ErrorInfo <= i"
-     << (HasMnemonicFirst ? "+1" : "") << ")) {\n";
-  OS << "        ErrorInfo = i" << (HasMnemonicFirst ? "+1" : "") << ";\n";
+  OS << "          (it == MnemonicRange.first || ErrorInfo <= i)) {\n";
+  OS << "        ErrorInfo = i;\n";
----------------
And i+1 here and below


Repository:
  rL LLVM

http://reviews.llvm.org/D15874





More information about the llvm-commits mailing list