Factor the code for determining the target-specific instruction
namespace out of the isel emitters and into common code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55079 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 9f0f155..12667d5 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1604,17 +1604,8 @@
 void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
   const CodeGenTarget &Target = CGP.getTargetInfo();
   
-  // 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;
-  }
-  
+  // Get the namespace to insert instructions into.
+  std::string InstNS = Target.getInstNamespace();
   if (!InstNS.empty()) InstNS += "::";
   
   // Group the patterns by their top-level opcodes.