[llvm-commits] [llvm] r169188 - in /llvm/trunk: include/llvm/CodeGen/VirtRegMap.h lib/CodeGen/RegAllocPBQP.cpp lib/CodeGen/VirtRegMap.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Dec 3 16:30:23 PST 2012


Author: stoklund
Date: Mon Dec  3 18:30:22 2012
New Revision: 169188

URL: http://llvm.org/viewvc/llvm-project?rev=169188&view=rev
Log:
Use MRI::getSimpleHint() instead of getRegAllocPref() in remaining cases.

Targets can provide multiple hints now, so getRegAllocPref() doesn't
make sense any longer because it only returns one preferred register.
Replace it with getSimpleHint() in the remaining heuristics. This
function only

Modified:
    llvm/trunk/include/llvm/CodeGen/VirtRegMap.h
    llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
    llvm/trunk/lib/CodeGen/VirtRegMap.cpp

Modified: llvm/trunk/include/llvm/CodeGen/VirtRegMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/VirtRegMap.h?rev=169188&r1=169187&r2=169188&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/VirtRegMap.h (original)
+++ llvm/trunk/include/llvm/CodeGen/VirtRegMap.h Mon Dec  3 18:30:22 2012
@@ -130,9 +130,7 @@
     unsigned getRegAllocPref(unsigned virtReg);
 
     /// @brief returns true if VirtReg is assigned to its preferred physreg.
-    bool hasPreferredPhys(unsigned VirtReg) {
-      return getPhys(VirtReg) == getRegAllocPref(VirtReg);
-    }
+    bool hasPreferredPhys(unsigned VirtReg);
 
     /// @brief returns true if VirtReg has a known preferred register.
     /// This returns false if VirtReg has a preference that is a virtual

Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=169188&r1=169187&r2=169188&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Mon Dec  3 18:30:22 2012
@@ -526,7 +526,7 @@
          itr != end; ++itr) {
     LiveInterval *li = &lis->getInterval(*itr);
 
-    unsigned physReg = vrm->getRegAllocPref(li->reg);
+    unsigned physReg = mri->getSimpleHint(li->reg);
 
     if (physReg == 0) {
       const TargetRegisterClass *liRC = mri->getRegClass(li->reg);

Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=169188&r1=169187&r2=169188&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Mon Dec  3 18:30:22 2012
@@ -88,6 +88,15 @@
   return TRI->ResolveRegAllocHint(Hint.first, physReg, *MF);
 }
 
+bool VirtRegMap::hasPreferredPhys(unsigned VirtReg) {
+  unsigned Hint = MRI->getSimpleHint(VirtReg);
+  if (!Hint)
+    return 0;
+  if (TargetRegisterInfo::isVirtualRegister(Hint))
+    Hint = getPhys(Hint);
+  return getPhys(VirtReg) == Hint;
+}
+
 bool VirtRegMap::hasKnownPreference(unsigned VirtReg) {
   std::pair<unsigned, unsigned> Hint = MRI->getRegAllocationHint(VirtReg);
   if (TargetRegisterInfo::isPhysicalRegister(Hint.second))





More information about the llvm-commits mailing list