summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-11-20 18:54:33 +0000
committerChris Lattner <sabre@nondot.org>2006-11-20 18:54:33 +0000
commitf7560ed6b1d5049799e5fc8ffb07aee83a80e5a8 (patch)
treec1e4ce4d3d8ccf7166f2a3f9734ecbcd50530b77 /utils
parent3b6f4978735ff529e59f77423fd9f8a21ca77a8d (diff)
downloadllvm-f7560ed6b1d5049799e5fc8ffb07aee83a80e5a8.tar.gz
llvm-f7560ed6b1d5049799e5fc8ffb07aee83a80e5a8.tar.bz2
llvm-f7560ed6b1d5049799e5fc8ffb07aee83a80e5a8.tar.xz
Fix PR1001, patch by Nikhil Patil!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 1acd549b1f..0b176088a0 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -3408,7 +3408,17 @@ static std::string getLegalCName(std::string OpName) {
}
void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
- std::string InstNS = Target.inst_begin()->second.Namespace;
+ // Get the namespace to insert instructions into. Make sure not to pick up
+ // "TargetInstrInfo" by accidentally getting the namespace off the PHI
+ // instruction or something.
+ std::string InstNS;
+ for (CodeGenTarget::inst_iterator i = Target.inst_begin(),
+ e = Target.inst_end(); i != e; ++i) {
+ InstNS = i->second.Namespace;
+ if (InstNS != "TargetInstrInfo")
+ break;
+ }
+
if (!InstNS.empty()) InstNS += "::";
// Group the patterns by their top-level opcodes.