mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
Allow overlaps between virtreg and physreg live ranges.
The RegisterCoalescer understands overlapping live ranges where one register is defined as a copy of the other. With this change, register allocators using LiveRegMatrix can do the same, at least for copies between physical and virtual registers. When a physreg is defined by a copy from a virtreg, allow those live ranges to overlap: %CL<def> = COPY %vreg11:sub_8bit; GR32_ABCD:%vreg11 %vreg13<def,tied1> = SAR32rCL %vreg13<tied0>, %CL<imp-use,kill> We can assign %vreg11 to %ECX, overlapping the live range of %CL. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163336 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#define DEBUG_TYPE "regalloc"
|
||||
#include "LiveRegMatrix.h"
|
||||
#include "RegisterCoalescer.h"
|
||||
#include "VirtRegMap.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
@@ -117,8 +118,9 @@ bool LiveRegMatrix::checkRegUnitInterference(LiveInterval &VirtReg,
|
||||
unsigned PhysReg) {
|
||||
if (VirtReg.empty())
|
||||
return false;
|
||||
CoalescerPair CP(VirtReg.reg, PhysReg, *TRI);
|
||||
for (MCRegUnitIterator Units(PhysReg, TRI); Units.isValid(); ++Units)
|
||||
if (VirtReg.overlaps(LIS->getRegUnit(*Units)))
|
||||
if (VirtReg.overlaps(LIS->getRegUnit(*Units), CP, *LIS->getSlotIndexes()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user