Revert "Emit the SubRegTable with the smallest possible integer type."
authorJim Grosbach <grosbach@apple.com>
Thu, 1 Mar 2012 17:30:35 +0000 (17:30 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 1 Mar 2012 17:30:35 +0000 (17:30 +0000)
This reverts commit 151760.

We want to move getSubReg() from TargetRegisterInfo into MCRegisterInfo,
but to do that, the type of the lookup table needs to be the same for
all targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151814 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmMatcherEmitter.cpp
utils/TableGen/CodeGenTarget.cpp
utils/TableGen/CodeGenTarget.h
utils/TableGen/RegisterInfoEmitter.cpp

index 88e787cfd2110252696980a2035a36c716f7b8bb..80467ff3dc7e19b634398a65966809eb200fa548 100644 (file)
@@ -2008,6 +2008,15 @@ static bool EmitMnemonicAliases(raw_ostream &OS, const AsmMatcherInfo &Info) {
   return true;
 }
 
+static const char *getMinimalTypeForRange(uint64_t Range) {
+  assert(Range < 0xFFFFFFFFULL && "Enum too large");
+  if (Range > 0xFFFF)
+    return "uint32_t";
+  if (Range > 0xFF)
+    return "uint16_t";
+  return "uint8_t";
+}
+
 static void EmitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target,
                               const AsmMatcherInfo &Info, StringRef ClassName) {
   // Emit the static custom operand parsing table;
index 1eb1a54e5653b806b807ec02c75d62d16af1890a..cf6793570a2633529a072fe29c4fd19ce28cb996 100644 (file)
@@ -108,14 +108,6 @@ std::string llvm::getQualifiedName(const Record *R) {
   return Namespace + "::" + R->getName();
 }
 
-const char *llvm::getMinimalTypeForRange(uint64_t Range) {
-  assert(Range < 0xFFFFFFFFULL && "Enum too large");
-  if (Range > 0xFFFF)
-    return "uint32_t";
-  if (Range > 0xFF)
-    return "uint16_t";
-  return "uint8_t";
-}
 
 /// getTarget - Return the current instance of the Target class.
 ///
index a0df08bf95469cc0baa62c55e1489402e9363b96..85463da59731f857032a382253e64a4e8f0c4160 100644 (file)
@@ -58,10 +58,6 @@ std::string getEnumName(MVT::SimpleValueType T);
 /// namespace qualifier if the record contains one.
 std::string getQualifiedName(const Record *R);
 
-/// getMinimalTypeForRange - Helper method to get the minimum data type required
-/// to represent Range.
-const char *getMinimalTypeForRange(uint64_t Range);
-
 /// CodeGenTarget - This class corresponds to the Target class in the .td files.
 ///
 class CodeGenTarget {
index 949213b0a1ef25cfe0994d36d3957fe4c8433e39..7171e50dc35c97aed62d47c8dc6c71b543af9051 100644 (file)
@@ -733,8 +733,8 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
 
   // Emit the data table for getSubReg().
   if (SubRegIndices.size()) {
-    OS << "static const " << getMinimalTypeForRange(Regs.size()) << ' '
-       << TargetName << "SubRegTable[][" << SubRegIndices.size() << "] = {\n";
+    OS << "static const unsigned short " << TargetName << "SubRegTable[]["
+      << SubRegIndices.size() << "] = {\n";
     for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
       const CodeGenRegister::SubRegMap &SRM = Regs[i]->getSubRegs();
       OS << "  /* " << Regs[i]->TheDef->getName() << " */\n";