[llvm-commits] [llvm] r156121 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h utils/TableGen/RegisterInfoEmitter.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu May 3 15:49:00 PDT 2012


Author: stoklund
Date: Thu May  3 17:49:00 2012
New Revision: 156121

URL: http://llvm.org/viewvc/llvm-project?rev=156121&view=rev
Log:
Add TargetRegisterClass::getSuperRegIndices().

This is a pointer into one of the tables used by
getMatchingSuperRegClass(). It makes it possible to use a shared
implementation of that function.

Modified:
    llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
    llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp

Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=156121&r1=156120&r2=156121&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Thu May  3 17:49:00 2012
@@ -43,6 +43,7 @@
   const MCRegisterClass *MC;
   const vt_iterator VTs;
   const uint32_t *SubClassMask;
+  const uint16_t *SuperRegIndices;
   const sc_iterator SuperClasses;
   const sc_iterator SuperRegClasses;
   ArrayRef<uint16_t> (*OrderFunc)(const MachineFunction&);
@@ -163,6 +164,18 @@
     return SubClassMask;
   }
 
+  /// getSuperRegIndices - Returns a 0-terminated list of sub-register indices
+  /// that projec some super-register class into this register class. The list
+  /// has an entry for each Idx such that:
+  ///
+  ///   There exists SuperRC where:
+  ///     For all Reg in SuperRC:
+  ///       this->contains(Reg:Idx)
+  ///
+  const uint16_t *getSuperRegIndices() const {
+    return SuperRegIndices;
+  }
+
   /// getSuperClasses - Returns a NULL terminated list of super-classes.  The
   /// classes are ordered by ID which is also a topological ordering from large
   /// to small classes.  The list does NOT include the current class.

Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=156121&r1=156120&r2=156121&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Thu May  3 17:49:00 2012
@@ -845,7 +845,7 @@
     //
     // The 0-terminated list of subreg indices starts at:
     //
-    //   SuperRegIdxSeqs + SuperRegIdxOffset[RC]
+    //   RC->getSuperRegIndices() = SuperRegIdxSeqs + ...
     //
     // The corresponding bitmasks follow the sub-class mask in memory. Each
     // mask has RCMaskWords uint32_t entries.
@@ -946,7 +946,8 @@
          << '&' << Target.getName() << "MCRegisterClasses[" << RC.getName()
          << "RegClassID],\n    "
          << "VTLists + " << VTSeqs.get(RC.VTs) << ",\n    "
-         << RC.getName() << "SubClassMask,\n    ";
+         << RC.getName() << "SubClassMask,\n    SuperRegIdxSeqs + "
+         << SuperRegIdxSeqs.get(SuperRegIdxLists[i]) << ",\n    ";
       if (RC.getSuperClasses().empty())
         OS << "NullRegClasses,\n    ";
       else
@@ -1062,8 +1063,7 @@
        << "  assert(A && B && \"Missing regclass\");\n"
        << "  assert(Idx && Idx <= " << SubRegIndices.size()
        << " && \"Bad subreg\");\n"
-       << "  const uint16_t *SRI = SuperRegIdxSeqs + "
-          "SuperRegIdxOffset[B->getID()];\n"
+       << "  const uint16_t *SRI = B->getSuperRegIndices();\n"
        << "  unsigned Offset = 0;\n"
        << "  while (SRI[Offset] != Idx) {\n"
        << "    if (!SRI[Offset])\n      return 0;\n"





More information about the llvm-commits mailing list