diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-04-20 18:19:48 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-04-20 18:19:48 +0000 |
commit | 6bfba2e5af163442a1c6b11fe14aa9df9101cfd7 (patch) | |
tree | bfad3009de9ca920990bcde1d0b9a90e96e549be /lib/CodeGen/RegAllocBasic.cpp | |
parent | e341e8ce1ada854e7f8fcfcf18bb2e17be2ac0ee (diff) | |
download | external_llvm-6bfba2e5af163442a1c6b11fe14aa9df9101cfd7.zip external_llvm-6bfba2e5af163442a1c6b11fe14aa9df9101cfd7.tar.gz external_llvm-6bfba2e5af163442a1c6b11fe14aa9df9101cfd7.tar.bz2 |
Prefer cheap registers for busy live ranges.
On the x86-64 and thumb2 targets, some registers are more expensive to encode
than others in the same register class.
Add a CostPerUse field to the TableGen register description, and make it
available from TRI->getCostPerUse. This represents the cost of a REX prefix or a
32-bit instruction encoding required by choosing a high register.
Teach the greedy register allocator to prefer cheap registers for busy live
ranges (as indicated by spill weight).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocBasic.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocBasic.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocBasic.cpp b/lib/CodeGen/RegAllocBasic.cpp index dd50498..d92d80f 100644 --- a/lib/CodeGen/RegAllocBasic.cpp +++ b/lib/CodeGen/RegAllocBasic.cpp @@ -278,6 +278,7 @@ void RegAllocBase::assign(LiveInterval &VirtReg, unsigned PhysReg) { << " to " << PrintReg(PhysReg, TRI) << '\n'); assert(!VRM->hasPhys(VirtReg.reg) && "Duplicate VirtReg assignment"); VRM->assignVirt2Phys(VirtReg.reg, PhysReg); + MRI->setPhysRegUsed(PhysReg); PhysReg2LiveUnion[PhysReg].unify(VirtReg); ++NumAssigned; } |