summaryrefslogtreecommitdiff
path: root/lib/CodeGen/VirtRegMap.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-07-08 20:46:18 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-07-08 20:46:18 +0000
commit51458ed09e6db0e424cd528e10b879f59915abe4 (patch)
tree56a25a53a83111d5cbeb0b0b9a55510310d35052 /lib/CodeGen/VirtRegMap.h
parent0b44aea7b564c5c28ac0acaaba8805ce7c625fd3 (diff)
downloadllvm-51458ed09e6db0e424cd528e10b879f59915abe4.tar.gz
llvm-51458ed09e6db0e424cd528e10b879f59915abe4.tar.bz2
llvm-51458ed09e6db0e424cd528e10b879f59915abe4.tar.xz
Be more aggressive about following hints.
RAGreedy::tryAssign will now evict interference from the preferred register even when another register is free. To support this, add the EvictionCost struct that counts how many hints are broken by an eviction. We don't want to break one hint just to satisfy another. Rename canEvict to shouldEvict, and add the first bit of eviction policy that doesn't depend on spill weights: Always make room in the preferred register as long as the evictees can be split and aren't already assigned to their preferred register. Also make the CSR avoidance more accurate. When looking for a cheaper register it is OK to use a new volatile register. Only CSR aliases that have never been used before should be avoided. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/VirtRegMap.h')
-rw-r--r--lib/CodeGen/VirtRegMap.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/VirtRegMap.h b/lib/CodeGen/VirtRegMap.h
index ba50f4e423..03abff3569 100644
--- a/lib/CodeGen/VirtRegMap.h
+++ b/lib/CodeGen/VirtRegMap.h
@@ -208,6 +208,11 @@ namespace llvm {
/// @brief returns the register allocation preference.
unsigned getRegAllocPref(unsigned virtReg);
+ /// @brief returns true if VirtReg is assigned to its preferred physreg.
+ bool hasPreferredPhys(unsigned VirtReg) {
+ return getPhys(VirtReg) == getRegAllocPref(VirtReg);
+ }
+
/// @brief records virtReg is a split live interval from SReg.
void setIsSplitFromReg(unsigned virtReg, unsigned SReg) {
Virt2SplitMap[virtReg] = SReg;