[llvm] r307358 - [TableGen] Fix some mismatches in the use of Namespace fields versus Target name in some of our emitters.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 22:19:25 PDT 2017


Author: ctopper
Date: Thu Jul  6 22:19:25 2017
New Revision: 307358

URL: http://llvm.org/viewvc/llvm-project?rev=307358&view=rev
Log:
[TableGen] Fix some mismatches in the use of Namespace fields versus Target name in some of our emitters.

Some of our emitters were using the name of the Target to reference things that were created by others emitters using Namespace.

Apparently all targets have the same Target name as their instruction and register Namespace field?

Someone on IRC had a target that didn't do this and was getting build errors. This patch is a necessary, but maybe not sufficient fix.

Modified:
    llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
    llvm/trunk/utils/TableGen/RegisterBankEmitter.cpp

Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=307358&r1=307357&r2=307358&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Thu Jul  6 22:19:25 2017
@@ -2222,7 +2222,7 @@ static void emitValidateOperandClass(Asm
   OS << "    switch (Operand.getReg()) {\n";
   OS << "    default: OpKind = InvalidMatchClass; break;\n";
   for (const auto &RC : Info.RegisterClasses)
-    OS << "    case " << Info.Target.getName() << "::"
+    OS << "    case " << RC.first->getValueAsString("Namespace") << "::"
        << RC.first->getName() << ": OpKind = " << RC.second->Name
        << "; break;\n";
   OS << "    }\n";
@@ -2989,7 +2989,7 @@ void AsmMatcherEmitter::run(raw_ostream
       std::string LenMnemonic = char(MI->Mnemonic.size()) + MI->Mnemonic.str();
       OS << "  { " << StringTable.GetOrAddStringOffset(LenMnemonic, false)
          << " /* " << MI->Mnemonic << " */, "
-         << Target.getName() << "::"
+         << Target.getInstNamespace() << "::"
          << MI->getResultInst()->TheDef->getName() << ", "
          << MI->ConversionFnKind << ", ";
 

Modified: llvm/trunk/utils/TableGen/RegisterBankEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterBankEmitter.cpp?rev=307358&r1=307357&r2=307358&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/RegisterBankEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/RegisterBankEmitter.cpp Thu Jul  6 22:19:25 2017
@@ -227,7 +227,7 @@ void RegisterBankEmitter::emitBaseClassI
       OS << "    // " << LowestIdxInWord << "-" << (LowestIdxInWord + 31) << "\n";
       for (const auto &RC : RCs) {
         std::string QualifiedRegClassID =
-            (Twine(TargetName) + "::" + RC->getName() + "RegClassID").str();
+            (Twine(RC->Namespace) + "::" + RC->getName() + "RegClassID").str();
         OS << "    (1u << (" << QualifiedRegClassID << " - "
            << LowestIdxInWord << ")) |\n";
       }




More information about the llvm-commits mailing list