summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-12-03 23:23:50 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-12-03 23:23:50 +0000
commit74052b041bb751e3712dfd16aee8f6a8be757e28 (patch)
tree95fa5c9530c00d3c4d3479919b636eebc34ee20b /llvm/lib/CodeGen
parenta667aade366b724e19e359d9cb6b9b8651daaa1b (diff)
downloadbcm5719-llvm-74052b041bb751e3712dfd16aee8f6a8be757e28.tar.gz
bcm5719-llvm-74052b041bb751e3712dfd16aee8f6a8be757e28.zip
Add VirtRegMap::hasKnownPreference().
Virtual registers with a known preferred register are prioritized by RAGreedy. This function makes the condition explicit without depending on getRegAllocPref(). llvm-svn: 169179
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp2
-rw-r--r--llvm/lib/CodeGen/VirtRegMap.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 3d1b580207d..994264338dd 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -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);
}
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index cf674575ba4..dcfad664145 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -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 &&
OpenPOWER on IntegriCloud