<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Wrong Namespace generated for target, Namespace field in .td files are ignored."
href="https://bugs.llvm.org/show_bug.cgi?id=33797">33797</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong Namespace generated for target, Namespace field in .td files are ignored.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ehssan.aali@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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 << ", ";</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>