mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Remove RegisterClassInfo::isReserved() and isAllocatable().
Clients can use the equivalent functions in MRI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165990 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -106,25 +106,6 @@ public:
|
|||||||
return CalleeSaved[N-1];
|
return CalleeSaved[N-1];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isReserved - Returns true when PhysReg is a reserved register.
|
|
||||||
///
|
|
||||||
/// Reserved registers may belong to an allocatable register class, but the
|
|
||||||
/// target has explicitly requested that they are not used.
|
|
||||||
///
|
|
||||||
bool isReserved(unsigned PhysReg) const {
|
|
||||||
return Reserved.test(PhysReg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// isAllocatable - Returns true when PhysReg belongs to an allocatable
|
|
||||||
/// register class and it hasn't been reserved.
|
|
||||||
///
|
|
||||||
/// Allocatable registers may show up in the allocation order of some virtual
|
|
||||||
/// register, so a register allocator needs to track its liveness and
|
|
||||||
/// availability.
|
|
||||||
bool isAllocatable(unsigned PhysReg) const {
|
|
||||||
return TRI->isInAllocatableClass(PhysReg) && !isReserved(PhysReg);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
|
@@ -635,7 +635,7 @@ bool AggressiveAntiDepBreaker::FindSuitableFreeRegisters(
|
|||||||
--R;
|
--R;
|
||||||
const unsigned NewSuperReg = Order[R];
|
const unsigned NewSuperReg = Order[R];
|
||||||
// Don't consider non-allocatable registers
|
// Don't consider non-allocatable registers
|
||||||
if (!RegClassInfo.isAllocatable(NewSuperReg)) continue;
|
if (!MRI.isAllocatable(NewSuperReg)) continue;
|
||||||
// Don't replace a register with itself.
|
// Don't replace a register with itself.
|
||||||
if (NewSuperReg == SuperReg) continue;
|
if (NewSuperReg == SuperReg) continue;
|
||||||
|
|
||||||
@@ -818,7 +818,7 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
|
|||||||
DEBUG(dbgs() << "\tAntidep reg: " << TRI->getName(AntiDepReg));
|
DEBUG(dbgs() << "\tAntidep reg: " << TRI->getName(AntiDepReg));
|
||||||
assert(AntiDepReg != 0 && "Anti-dependence on reg0?");
|
assert(AntiDepReg != 0 && "Anti-dependence on reg0?");
|
||||||
|
|
||||||
if (!RegClassInfo.isAllocatable(AntiDepReg)) {
|
if (!MRI.isAllocatable(AntiDepReg)) {
|
||||||
// Don't break anti-dependencies on non-allocatable registers.
|
// Don't break anti-dependencies on non-allocatable registers.
|
||||||
DEBUG(dbgs() << " (non-allocatable)\n");
|
DEBUG(dbgs() << " (non-allocatable)\n");
|
||||||
continue;
|
continue;
|
||||||
|
@@ -29,6 +29,7 @@ AllocationOrder::AllocationOrder(unsigned VirtReg,
|
|||||||
const TargetRegisterClass *RC = VRM.getRegInfo().getRegClass(VirtReg);
|
const TargetRegisterClass *RC = VRM.getRegInfo().getRegClass(VirtReg);
|
||||||
std::pair<unsigned, unsigned> HintPair =
|
std::pair<unsigned, unsigned> HintPair =
|
||||||
VRM.getRegInfo().getRegAllocationHint(VirtReg);
|
VRM.getRegInfo().getRegAllocationHint(VirtReg);
|
||||||
|
const MachineRegisterInfo &MRI = VRM.getRegInfo();
|
||||||
|
|
||||||
// HintPair.second is a register, phys or virt.
|
// HintPair.second is a register, phys or virt.
|
||||||
Hint = HintPair.second;
|
Hint = HintPair.second;
|
||||||
@@ -52,7 +53,7 @@ AllocationOrder::AllocationOrder(unsigned VirtReg,
|
|||||||
unsigned *P = new unsigned[Order.size()];
|
unsigned *P = new unsigned[Order.size()];
|
||||||
Begin = P;
|
Begin = P;
|
||||||
for (unsigned i = 0; i != Order.size(); ++i)
|
for (unsigned i = 0; i != Order.size(); ++i)
|
||||||
if (!RCI.isReserved(Order[i]))
|
if (!MRI.isReserved(Order[i]))
|
||||||
*P++ = Order[i];
|
*P++ = Order[i];
|
||||||
End = P;
|
End = P;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ AllocationOrder::AllocationOrder(unsigned VirtReg,
|
|||||||
|
|
||||||
// The hint must be a valid physreg for allocation.
|
// The hint must be a valid physreg for allocation.
|
||||||
if (Hint && (!TargetRegisterInfo::isPhysicalRegister(Hint) ||
|
if (Hint && (!TargetRegisterInfo::isPhysicalRegister(Hint) ||
|
||||||
!RC->contains(Hint) || RCI.isReserved(Hint)))
|
!RC->contains(Hint) || MRI.isReserved(Hint)))
|
||||||
Hint = 0;
|
Hint = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -527,7 +527,7 @@ BreakAntiDependencies(const std::vector<SUnit>& SUnits,
|
|||||||
if (Edge->getKind() == SDep::Anti) {
|
if (Edge->getKind() == SDep::Anti) {
|
||||||
AntiDepReg = Edge->getReg();
|
AntiDepReg = Edge->getReg();
|
||||||
assert(AntiDepReg != 0 && "Anti-dependence on reg0?");
|
assert(AntiDepReg != 0 && "Anti-dependence on reg0?");
|
||||||
if (!RegClassInfo.isAllocatable(AntiDepReg))
|
if (!MRI.isAllocatable(AntiDepReg))
|
||||||
// Don't break anti-dependencies on non-allocatable registers.
|
// Don't break anti-dependencies on non-allocatable registers.
|
||||||
AntiDepReg = 0;
|
AntiDepReg = 0;
|
||||||
else if (KeepRegs.test(AntiDepReg))
|
else if (KeepRegs.test(AntiDepReg))
|
||||||
|
@@ -509,7 +509,7 @@ RAFast::LiveRegMap::iterator RAFast::allocVirtReg(MachineInstr *MI,
|
|||||||
|
|
||||||
// Ignore invalid hints.
|
// Ignore invalid hints.
|
||||||
if (Hint && (!TargetRegisterInfo::isPhysicalRegister(Hint) ||
|
if (Hint && (!TargetRegisterInfo::isPhysicalRegister(Hint) ||
|
||||||
!RC->contains(Hint) || !RegClassInfo.isAllocatable(Hint)))
|
!RC->contains(Hint) || !MRI->isAllocatable(Hint)))
|
||||||
Hint = 0;
|
Hint = 0;
|
||||||
|
|
||||||
// Take hint when possible.
|
// Take hint when possible.
|
||||||
@@ -838,7 +838,7 @@ void RAFast::AllocateBasicBlock() {
|
|||||||
// Add live-in registers as live.
|
// Add live-in registers as live.
|
||||||
for (MachineBasicBlock::livein_iterator I = MBB->livein_begin(),
|
for (MachineBasicBlock::livein_iterator I = MBB->livein_begin(),
|
||||||
E = MBB->livein_end(); I != E; ++I)
|
E = MBB->livein_end(); I != E; ++I)
|
||||||
if (RegClassInfo.isAllocatable(*I))
|
if (MRI->isAllocatable(*I))
|
||||||
definePhysReg(MII, *I, regReserved);
|
definePhysReg(MII, *I, regReserved);
|
||||||
|
|
||||||
SmallVector<unsigned, 8> VirtDead;
|
SmallVector<unsigned, 8> VirtDead;
|
||||||
@@ -970,7 +970,7 @@ void RAFast::AllocateBasicBlock() {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!RegClassInfo.isAllocatable(Reg)) continue;
|
if (!MRI->isAllocatable(Reg)) continue;
|
||||||
if (MO.isUse()) {
|
if (MO.isUse()) {
|
||||||
usePhysReg(MO);
|
usePhysReg(MO);
|
||||||
} else if (MO.isEarlyClobber()) {
|
} else if (MO.isEarlyClobber()) {
|
||||||
@@ -1058,7 +1058,7 @@ void RAFast::AllocateBasicBlock() {
|
|||||||
unsigned Reg = MO.getReg();
|
unsigned Reg = MO.getReg();
|
||||||
|
|
||||||
if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
|
if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
|
||||||
if (!RegClassInfo.isAllocatable(Reg)) continue;
|
if (!MRI->isAllocatable(Reg)) continue;
|
||||||
definePhysReg(MI, Reg, (MO.isImplicit() || MO.isDead()) ?
|
definePhysReg(MI, Reg, (MO.isImplicit() || MO.isDead()) ?
|
||||||
regFree : regReserved);
|
regFree : regReserved);
|
||||||
continue;
|
continue;
|
||||||
|
@@ -895,7 +895,7 @@ bool RegisterCoalescer::canJoinPhys(CoalescerPair &CP) {
|
|||||||
/// Always join simple intervals that are defined by a single copy from a
|
/// Always join simple intervals that are defined by a single copy from a
|
||||||
/// reserved register. This doesn't increase register pressure, so it is
|
/// reserved register. This doesn't increase register pressure, so it is
|
||||||
/// always beneficial.
|
/// always beneficial.
|
||||||
if (!RegClassInfo.isReserved(CP.getDstReg())) {
|
if (!MRI->isReserved(CP.getDstReg())) {
|
||||||
DEBUG(dbgs() << "\tCan only merge into reserved registers.\n");
|
DEBUG(dbgs() << "\tCan only merge into reserved registers.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1070,7 +1070,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) {
|
|||||||
/// Attempt joining with a reserved physreg.
|
/// Attempt joining with a reserved physreg.
|
||||||
bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) {
|
bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) {
|
||||||
assert(CP.isPhys() && "Must be a physreg copy");
|
assert(CP.isPhys() && "Must be a physreg copy");
|
||||||
assert(RegClassInfo.isReserved(CP.getDstReg()) && "Not a reserved register");
|
assert(MRI->isReserved(CP.getDstReg()) && "Not a reserved register");
|
||||||
LiveInterval &RHS = LIS->getInterval(CP.getSrcReg());
|
LiveInterval &RHS = LIS->getInterval(CP.getSrcReg());
|
||||||
DEBUG(dbgs() << "\t\tRHS = " << PrintReg(CP.getSrcReg()) << ' ' << RHS
|
DEBUG(dbgs() << "\t\tRHS = " << PrintReg(CP.getSrcReg()) << ' ' << RHS
|
||||||
<< '\n');
|
<< '\n');
|
||||||
|
@@ -337,7 +337,7 @@ static void collectOperands(const MachineInstr *MI,
|
|||||||
PhysRegOperands &PhysRegOpers,
|
PhysRegOperands &PhysRegOpers,
|
||||||
VirtRegOperands &VirtRegOpers,
|
VirtRegOperands &VirtRegOpers,
|
||||||
const TargetRegisterInfo *TRI,
|
const TargetRegisterInfo *TRI,
|
||||||
const RegisterClassInfo *RCI) {
|
const MachineRegisterInfo *MRI) {
|
||||||
for(ConstMIBundleOperands OperI(MI); OperI.isValid(); ++OperI) {
|
for(ConstMIBundleOperands OperI(MI); OperI.isValid(); ++OperI) {
|
||||||
const MachineOperand &MO = *OperI;
|
const MachineOperand &MO = *OperI;
|
||||||
if (!MO.isReg() || !MO.getReg())
|
if (!MO.isReg() || !MO.getReg())
|
||||||
@@ -345,7 +345,7 @@ static void collectOperands(const MachineInstr *MI,
|
|||||||
|
|
||||||
if (TargetRegisterInfo::isVirtualRegister(MO.getReg()))
|
if (TargetRegisterInfo::isVirtualRegister(MO.getReg()))
|
||||||
VirtRegOpers.collect(MO, TRI);
|
VirtRegOpers.collect(MO, TRI);
|
||||||
else if (RCI->isAllocatable(MO.getReg()))
|
else if (MRI->isAllocatable(MO.getReg()))
|
||||||
PhysRegOpers.collect(MO, TRI);
|
PhysRegOpers.collect(MO, TRI);
|
||||||
}
|
}
|
||||||
// Remove redundant physreg dead defs.
|
// Remove redundant physreg dead defs.
|
||||||
@@ -451,7 +451,7 @@ bool RegPressureTracker::recede() {
|
|||||||
|
|
||||||
PhysRegOperands PhysRegOpers;
|
PhysRegOperands PhysRegOpers;
|
||||||
VirtRegOperands VirtRegOpers;
|
VirtRegOperands VirtRegOpers;
|
||||||
collectOperands(CurrPos, PhysRegOpers, VirtRegOpers, TRI, RCI);
|
collectOperands(CurrPos, PhysRegOpers, VirtRegOpers, TRI, MRI);
|
||||||
|
|
||||||
// Boost pressure for all dead defs together.
|
// Boost pressure for all dead defs together.
|
||||||
increasePhysRegPressure(PhysRegOpers.DeadDefs);
|
increasePhysRegPressure(PhysRegOpers.DeadDefs);
|
||||||
@@ -524,7 +524,7 @@ bool RegPressureTracker::advance() {
|
|||||||
|
|
||||||
PhysRegOperands PhysRegOpers;
|
PhysRegOperands PhysRegOpers;
|
||||||
VirtRegOperands VirtRegOpers;
|
VirtRegOperands VirtRegOpers;
|
||||||
collectOperands(CurrPos, PhysRegOpers, VirtRegOpers, TRI, RCI);
|
collectOperands(CurrPos, PhysRegOpers, VirtRegOpers, TRI, MRI);
|
||||||
|
|
||||||
// Kill liveness at last uses.
|
// Kill liveness at last uses.
|
||||||
for (unsigned i = 0, e = PhysRegOpers.Uses.size(); i < e; ++i) {
|
for (unsigned i = 0, e = PhysRegOpers.Uses.size(); i < e; ++i) {
|
||||||
@@ -666,7 +666,7 @@ void RegPressureTracker::bumpUpwardPressure(const MachineInstr *MI) {
|
|||||||
// Account for register pressure similar to RegPressureTracker::recede().
|
// Account for register pressure similar to RegPressureTracker::recede().
|
||||||
PhysRegOperands PhysRegOpers;
|
PhysRegOperands PhysRegOpers;
|
||||||
VirtRegOperands VirtRegOpers;
|
VirtRegOperands VirtRegOpers;
|
||||||
collectOperands(MI, PhysRegOpers, VirtRegOpers, TRI, RCI);
|
collectOperands(MI, PhysRegOpers, VirtRegOpers, TRI, MRI);
|
||||||
|
|
||||||
// Boost max pressure for all dead defs together.
|
// Boost max pressure for all dead defs together.
|
||||||
// Since CurrSetPressure and MaxSetPressure
|
// Since CurrSetPressure and MaxSetPressure
|
||||||
@@ -752,7 +752,7 @@ void RegPressureTracker::bumpDownwardPressure(const MachineInstr *MI) {
|
|||||||
// Account for register pressure similar to RegPressureTracker::recede().
|
// Account for register pressure similar to RegPressureTracker::recede().
|
||||||
PhysRegOperands PhysRegOpers;
|
PhysRegOperands PhysRegOpers;
|
||||||
VirtRegOperands VirtRegOpers;
|
VirtRegOperands VirtRegOpers;
|
||||||
collectOperands(MI, PhysRegOpers, VirtRegOpers, TRI, RCI);
|
collectOperands(MI, PhysRegOpers, VirtRegOpers, TRI, MRI);
|
||||||
|
|
||||||
// Kill liveness at last uses. Assume allocatable physregs are single-use
|
// Kill liveness at last uses. Assume allocatable physregs are single-use
|
||||||
// rather than checking LiveIntervals.
|
// rather than checking LiveIntervals.
|
||||||
|
Reference in New Issue
Block a user