https://bugs.llvm.org/show_bug.cgi?id=33797

            Bug ID: 33797
           Summary: Wrong Namespace generated for target, Namespace field
                    in .td files are ignored.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedb...@nondot.org
          Reporter: ehssan.a...@gmail.com
                CC: llvm-bugs@lists.llvm.org

Usually the target name and the namespace is the same and we cannot produce
this bug, but in my case my target name was "Laser" and the name space I used
in .tf files such as xxxRegisterInfo.td or xxxInstrFormats.td  was "LASER" and
I could produce this bug. 

Following change solved the problem:

In llvm/utils/TableGen:

--- AsmMatcherEmitter.cpp.orig  2016-06-24 00:09:49.000000000 +0700
+++ AsmMatcherEmitter.cpp       2017-07-14 09:33:39.591947889 +0700
@@ -2235,7 +2235,7 @@
   OS << "    switch (Operand.getReg()) {\n";
   OS << "    default: OpKind = InvalidMatchClass; break;\n";
   for (const auto &RC : Info.RegisterClasses)
-    OS << "    case " << Info.Target.getName() << "::"
+    OS << "    case " << Info.Target.getInstNamespace() << "::"
        << RC.first->getName() << ": OpKind = " << RC.second->Name
        << "; break;\n";
   OS << "    }\n";
@@ -3046,7 +3046,7 @@
       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 << ", ";

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to