summaryrefslogtreecommitdiffstats
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
commit55b8683d246f2f563dcfa39899af27d47144379f (patch)
tree3109048b5b32b2345ff1fc8847a53b012fca8d9f
parent3e96211bc85e98a32d50c8e107c4453dd1c9f38f (diff)
downloadbcm5719-llvm-55b8683d246f2f563dcfa39899af27d47144379f.tar.gz
bcm5719-llvm-55b8683d246f2f563dcfa39899af27d47144379f.zip
Fix PR1001, patch by Nikhil Patil!
llvm-svn: 31880
-rw-r--r--llvm/utils/TableGen/DAGISelEmitter.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp
index 1acd549b1f7..0b176088a0e 100644
--- a/llvm/utils/TableGen/DAGISelEmitter.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud