Skip to content

Commit

Permalink
Use MRI::getSimpleHint() instead of getRegAllocPref() in remaining ca…
Browse files Browse the repository at this point in the history
…ses.

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
  • Loading branch information
stoklund committed Dec 4, 2012
1 parent dc8126b commit 980bddf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 1 addition & 3 deletions include/llvm/CodeGen/VirtRegMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/CodeGen/RegAllocPBQP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions lib/CodeGen/VirtRegMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 980bddf

Please sign in to comment.