Use CodeGenRegister class to make reading in of register information more
systematic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15805 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp
index 9e52cbc..e0d251f 100644
--- a/utils/TableGen/CodeGenTarget.cpp
+++ b/utils/TableGen/CodeGenTarget.cpp
@@ -103,11 +103,24 @@
   return TargetRec->getValueAsDef("AssemblyWriter");
 }
 
+void CodeGenTarget::ReadRegisters() const {
+  std::vector<Record*> Regs = Records.getAllDerivedDefinitions("Register");
+  if (Regs.empty())
+    throw std::string("No 'Register' subclasses defined!");
+
+  Registers.reserve(Regs.size());
+  Registers.assign(Regs.begin(), Regs.end());
+}
+
+const std::string &CodeGenRegister::getName() const {
+  return TheDef->getName();
+}
+
 
 void CodeGenTarget::ReadInstructions() const {
   std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
 
-  if (Insts.size() == 0)
+  if (Insts.empty())
     throw std::string("No 'Instruction' subclasses defined!");
 
   std::string InstFormatName =