Use MRI::getSimpleHint() instead of getRegAllocPref() in remaining cases.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 4 Dec 2012 00:30:22 +0000 (00:30 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 4 Dec 2012 00:30:22 +0000 (00:30 +0000)
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

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

include/llvm/CodeGen/VirtRegMap.h
lib/CodeGen/RegAllocPBQP.cpp
lib/CodeGen/VirtRegMap.cpp

index 5fe6297f1821f750d1c0b377470d53a67e8f5a5d..f5357a4099a5e364709179fefbdb3e24a3b96ee3 100644 (file)
@@ -130,9 +130,7 @@ namespace llvm {
     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
index 24442d7676fb933d47b901ee7e89ccc4ae630644..cdd92afe8a076d93390fb9338a651ef0babb003d 100644 (file)
@@ -526,7 +526,7 @@ void RegAllocPBQP::finalizeAlloc() const {
          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);
index dcfad6641453622e87384cb9d15a6f29efee9e63..820eed083b70a98e3c7df8f566e0dbff445d169f 100644 (file)
@@ -88,6 +88,15 @@ unsigned VirtRegMap::getRegAllocPref(unsigned virtReg) {
   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))