From: Jakob Stoklund Olesen Date: Tue, 4 Dec 2012 00:30:22 +0000 (+0000) Subject: Use MRI::getSimpleHint() instead of getRegAllocPref() in remaining cases. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=980bddfb1c26e2e9374d1645f9ae26c44742606f;p=oota-llvm.git 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169188 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/VirtRegMap.h b/include/llvm/CodeGen/VirtRegMap.h index 5fe6297f182..f5357a4099a 100644 --- a/include/llvm/CodeGen/VirtRegMap.h +++ b/include/llvm/CodeGen/VirtRegMap.h @@ -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 diff --git a/lib/CodeGen/RegAllocPBQP.cpp b/lib/CodeGen/RegAllocPBQP.cpp index 24442d7676f..cdd92afe8a0 100644 --- a/lib/CodeGen/RegAllocPBQP.cpp +++ b/lib/CodeGen/RegAllocPBQP.cpp @@ -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); diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index dcfad664145..820eed083b7 100644 --- a/lib/CodeGen/VirtRegMap.cpp +++ b/lib/CodeGen/VirtRegMap.cpp @@ -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 Hint = MRI->getRegAllocationHint(VirtReg); if (TargetRegisterInfo::isPhysicalRegister(Hint.second))