[llvm-bugs] [Bug 33797] New: Wrong Namespace generated for target, Namespace field in .td files are ignored.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 14 23:48:12 PDT 2017


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: unassignedbugs at nondot.org
          Reporter: ehssan.aali at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170715/880d207a/attachment-0001.html>


More information about the llvm-bugs mailing list