mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-27 05:30:49 +00:00
Add VirtRegMap::hasKnownPreference().
Virtual registers with a known preferred register are prioritized by RAGreedy. This function makes the condition explicit without depending on getRegAllocPref(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169179 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ade047463f
commit
fc6374439e
@ -134,6 +134,11 @@ namespace llvm {
|
||||
return getPhys(VirtReg) == getRegAllocPref(VirtReg);
|
||||
}
|
||||
|
||||
/// @brief returns true if VirtReg has a known preferred register.
|
||||
/// This returns false if VirtReg has a preference that is a virtual
|
||||
/// register that hasn't been assigned yet.
|
||||
bool hasKnownPreference(unsigned VirtReg);
|
||||
|
||||
/// @brief records virtReg is a split live interval from SReg.
|
||||
void setIsSplitFromReg(unsigned virtReg, unsigned SReg) {
|
||||
Virt2SplitMap[virtReg] = SReg;
|
||||
|
@ -413,7 +413,7 @@ void RAGreedy::enqueue(LiveInterval *LI) {
|
||||
Prio = (1u << 31) + Size;
|
||||
|
||||
// Boost ranges that have a physical register hint.
|
||||
if (TargetRegisterInfo::isPhysicalRegister(VRM->getRegAllocPref(Reg)))
|
||||
if (VRM->hasKnownPreference(Reg))
|
||||
Prio |= (1u << 30);
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,15 @@ unsigned VirtRegMap::getRegAllocPref(unsigned virtReg) {
|
||||
return TRI->ResolveRegAllocHint(Hint.first, physReg, *MF);
|
||||
}
|
||||
|
||||
bool VirtRegMap::hasKnownPreference(unsigned VirtReg) {
|
||||
std::pair<unsigned, unsigned> Hint = MRI->getRegAllocationHint(VirtReg);
|
||||
if (TargetRegisterInfo::isPhysicalRegister(Hint.second))
|
||||
return true;
|
||||
if (TargetRegisterInfo::isVirtualRegister(Hint.second))
|
||||
return hasPhys(Hint.second);
|
||||
return false;
|
||||
}
|
||||
|
||||
int VirtRegMap::assignVirt2StackSlot(unsigned virtReg) {
|
||||
assert(TargetRegisterInfo::isVirtualRegister(virtReg));
|
||||
assert(Virt2StackSlotMap[virtReg] == NO_STACK_SLOT &&
|
||||
|
Loading…
Reference in New Issue
Block a user