mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Remove the old TRI::ResolveRegAllocHint() and getRawAllocationOrder() hooks.
These functions have been replaced by TRI::getRegAllocationHints() which provides the same capabilities. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
46f6fe7a45
commit
f714156460
@ -614,19 +614,6 @@ public:
|
||||
virtual const int *getRegClassPressureSets(
|
||||
const TargetRegisterClass *RC) const = 0;
|
||||
|
||||
/// getRawAllocationOrder - Returns the register allocation order for a
|
||||
/// specified register class with a target-dependent hint. The returned list
|
||||
/// may contain reserved registers that cannot be allocated.
|
||||
///
|
||||
/// Register allocators need only call this function to resolve
|
||||
/// target-dependent hints, but it should work without hinting as well.
|
||||
virtual ArrayRef<MCPhysReg>
|
||||
getRawAllocationOrder(const TargetRegisterClass *RC,
|
||||
unsigned HintType, unsigned HintReg,
|
||||
const MachineFunction &MF) const {
|
||||
return RC->getRawAllocationOrder(MF);
|
||||
}
|
||||
|
||||
/// Get a list of 'hint' registers that the register allocator should try
|
||||
/// first when allocating a physical register for the virtual register
|
||||
/// VirtReg. These registers are effectively moved to the front of the
|
||||
@ -647,15 +634,6 @@ public:
|
||||
const MachineFunction &MF,
|
||||
const VirtRegMap *VRM = 0) const;
|
||||
|
||||
/// ResolveRegAllocHint - Resolves the specified register allocation hint
|
||||
/// to a physical register. Returns the physical register if it is successful.
|
||||
virtual unsigned ResolveRegAllocHint(unsigned Type, unsigned Reg,
|
||||
const MachineFunction &MF) const {
|
||||
if (Type == 0 && Reg && isPhysicalRegister(Reg))
|
||||
return Reg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// avoidWriteAfterWrite - Return true if the register allocator should avoid
|
||||
/// writing a register from RC in two consecutive instructions.
|
||||
/// This can avoid pipeline stalls on certain architectures.
|
||||
|
@ -232,156 +232,6 @@ ARMBaseRegisterInfo::getRegAllocationHints(unsigned VirtReg,
|
||||
}
|
||||
}
|
||||
|
||||
/// getRawAllocationOrder - Returns the register allocation order for a
|
||||
/// specified register class with a target-dependent hint.
|
||||
ArrayRef<uint16_t>
|
||||
ARMBaseRegisterInfo::getRawAllocationOrder(const TargetRegisterClass *RC,
|
||||
unsigned HintType, unsigned HintReg,
|
||||
const MachineFunction &MF) const {
|
||||
const TargetFrameLowering *TFI = MF.getTarget().getFrameLowering();
|
||||
// Alternative register allocation orders when favoring even / odd registers
|
||||
// of register pairs.
|
||||
|
||||
// No FP, R9 is available.
|
||||
static const uint16_t GPREven1[] = {
|
||||
ARM::R0, ARM::R2, ARM::R4, ARM::R6, ARM::R8, ARM::R10,
|
||||
ARM::R1, ARM::R3, ARM::R12,ARM::LR, ARM::R5, ARM::R7,
|
||||
ARM::R9, ARM::R11
|
||||
};
|
||||
static const uint16_t GPROdd1[] = {
|
||||
ARM::R1, ARM::R3, ARM::R5, ARM::R7, ARM::R9, ARM::R11,
|
||||
ARM::R0, ARM::R2, ARM::R12,ARM::LR, ARM::R4, ARM::R6,
|
||||
ARM::R8, ARM::R10
|
||||
};
|
||||
|
||||
// FP is R7, R9 is available.
|
||||
static const uint16_t GPREven2[] = {
|
||||
ARM::R0, ARM::R2, ARM::R4, ARM::R8, ARM::R10,
|
||||
ARM::R1, ARM::R3, ARM::R12,ARM::LR, ARM::R5, ARM::R6,
|
||||
ARM::R9, ARM::R11
|
||||
};
|
||||
static const uint16_t GPROdd2[] = {
|
||||
ARM::R1, ARM::R3, ARM::R5, ARM::R9, ARM::R11,
|
||||
ARM::R0, ARM::R2, ARM::R12,ARM::LR, ARM::R4, ARM::R6,
|
||||
ARM::R8, ARM::R10
|
||||
};
|
||||
|
||||
// FP is R11, R9 is available.
|
||||
static const uint16_t GPREven3[] = {
|
||||
ARM::R0, ARM::R2, ARM::R4, ARM::R6, ARM::R8,
|
||||
ARM::R1, ARM::R3, ARM::R10,ARM::R12,ARM::LR, ARM::R5, ARM::R7,
|
||||
ARM::R9
|
||||
};
|
||||
static const uint16_t GPROdd3[] = {
|
||||
ARM::R1, ARM::R3, ARM::R5, ARM::R6, ARM::R9,
|
||||
ARM::R0, ARM::R2, ARM::R10,ARM::R12,ARM::LR, ARM::R4, ARM::R7,
|
||||
ARM::R8
|
||||
};
|
||||
|
||||
// No FP, R9 is not available.
|
||||
static const uint16_t GPREven4[] = {
|
||||
ARM::R0, ARM::R2, ARM::R4, ARM::R6, ARM::R10,
|
||||
ARM::R1, ARM::R3, ARM::R12,ARM::LR, ARM::R5, ARM::R7, ARM::R8,
|
||||
ARM::R11
|
||||
};
|
||||
static const uint16_t GPROdd4[] = {
|
||||
ARM::R1, ARM::R3, ARM::R5, ARM::R7, ARM::R11,
|
||||
ARM::R0, ARM::R2, ARM::R12,ARM::LR, ARM::R4, ARM::R6, ARM::R8,
|
||||
ARM::R10
|
||||
};
|
||||
|
||||
// FP is R7, R9 is not available.
|
||||
static const uint16_t GPREven5[] = {
|
||||
ARM::R0, ARM::R2, ARM::R4, ARM::R10,
|
||||
ARM::R1, ARM::R3, ARM::R12,ARM::LR, ARM::R5, ARM::R6, ARM::R8,
|
||||
ARM::R11
|
||||
};
|
||||
static const uint16_t GPROdd5[] = {
|
||||
ARM::R1, ARM::R3, ARM::R5, ARM::R11,
|
||||
ARM::R0, ARM::R2, ARM::R12,ARM::LR, ARM::R4, ARM::R6, ARM::R8,
|
||||
ARM::R10
|
||||
};
|
||||
|
||||
// FP is R11, R9 is not available.
|
||||
static const uint16_t GPREven6[] = {
|
||||
ARM::R0, ARM::R2, ARM::R4, ARM::R6,
|
||||
ARM::R1, ARM::R3, ARM::R10,ARM::R12,ARM::LR, ARM::R5, ARM::R7, ARM::R8
|
||||
};
|
||||
static const uint16_t GPROdd6[] = {
|
||||
ARM::R1, ARM::R3, ARM::R5, ARM::R7,
|
||||
ARM::R0, ARM::R2, ARM::R10,ARM::R12,ARM::LR, ARM::R4, ARM::R6, ARM::R8
|
||||
};
|
||||
|
||||
// We only support even/odd hints for GPR and rGPR.
|
||||
if (RC != &ARM::GPRRegClass && RC != &ARM::rGPRRegClass)
|
||||
return RC->getRawAllocationOrder(MF);
|
||||
|
||||
if (HintType == ARMRI::RegPairEven) {
|
||||
if (isPhysicalRegister(HintReg) && getRegisterPairEven(HintReg, MF) == 0)
|
||||
// It's no longer possible to fulfill this hint. Return the default
|
||||
// allocation order.
|
||||
return RC->getRawAllocationOrder(MF);
|
||||
|
||||
if (!TFI->hasFP(MF)) {
|
||||
if (!STI.isR9Reserved())
|
||||
return makeArrayRef(GPREven1);
|
||||
else
|
||||
return makeArrayRef(GPREven4);
|
||||
} else if (FramePtr == ARM::R7) {
|
||||
if (!STI.isR9Reserved())
|
||||
return makeArrayRef(GPREven2);
|
||||
else
|
||||
return makeArrayRef(GPREven5);
|
||||
} else { // FramePtr == ARM::R11
|
||||
if (!STI.isR9Reserved())
|
||||
return makeArrayRef(GPREven3);
|
||||
else
|
||||
return makeArrayRef(GPREven6);
|
||||
}
|
||||
} else if (HintType == ARMRI::RegPairOdd) {
|
||||
if (isPhysicalRegister(HintReg) && getRegisterPairOdd(HintReg, MF) == 0)
|
||||
// It's no longer possible to fulfill this hint. Return the default
|
||||
// allocation order.
|
||||
return RC->getRawAllocationOrder(MF);
|
||||
|
||||
if (!TFI->hasFP(MF)) {
|
||||
if (!STI.isR9Reserved())
|
||||
return makeArrayRef(GPROdd1);
|
||||
else
|
||||
return makeArrayRef(GPROdd4);
|
||||
} else if (FramePtr == ARM::R7) {
|
||||
if (!STI.isR9Reserved())
|
||||
return makeArrayRef(GPROdd2);
|
||||
else
|
||||
return makeArrayRef(GPROdd5);
|
||||
} else { // FramePtr == ARM::R11
|
||||
if (!STI.isR9Reserved())
|
||||
return makeArrayRef(GPROdd3);
|
||||
else
|
||||
return makeArrayRef(GPROdd6);
|
||||
}
|
||||
}
|
||||
return RC->getRawAllocationOrder(MF);
|
||||
}
|
||||
|
||||
/// ResolveRegAllocHint - Resolves the specified register allocation hint
|
||||
/// to a physical register. Returns the physical register if it is successful.
|
||||
unsigned
|
||||
ARMBaseRegisterInfo::ResolveRegAllocHint(unsigned Type, unsigned Reg,
|
||||
const MachineFunction &MF) const {
|
||||
if (Reg == 0 || !isPhysicalRegister(Reg))
|
||||
return 0;
|
||||
if (Type == 0)
|
||||
return Reg;
|
||||
else if (Type == (unsigned)ARMRI::RegPairOdd)
|
||||
// Odd register.
|
||||
return getRegisterPairOdd(Reg, MF);
|
||||
else if (Type == (unsigned)ARMRI::RegPairEven)
|
||||
// Even register.
|
||||
return getRegisterPairEven(Reg, MF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ARMBaseRegisterInfo::UpdateRegAllocHint(unsigned Reg, unsigned NewReg,
|
||||
MachineFunction &MF) const {
|
||||
@ -523,114 +373,6 @@ unsigned ARMBaseRegisterInfo::getEHHandlerRegister() const {
|
||||
llvm_unreachable("What is the exception handler register");
|
||||
}
|
||||
|
||||
unsigned ARMBaseRegisterInfo::getRegisterPairEven(unsigned Reg,
|
||||
const MachineFunction &MF) const {
|
||||
const MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
switch (Reg) {
|
||||
default: break;
|
||||
// Return 0 if either register of the pair is a special register.
|
||||
// So no R12, etc.
|
||||
case ARM::R1: return ARM::R0;
|
||||
case ARM::R3: return ARM::R2;
|
||||
case ARM::R5: return ARM::R4;
|
||||
case ARM::R7:
|
||||
return (MRI.isReserved(ARM::R7) || MRI.isReserved(ARM::R6))
|
||||
? 0 : ARM::R6;
|
||||
case ARM::R9: return MRI.isReserved(ARM::R9) ? 0 :ARM::R8;
|
||||
case ARM::R11: return MRI.isReserved(ARM::R11) ? 0 : ARM::R10;
|
||||
|
||||
case ARM::S1: return ARM::S0;
|
||||
case ARM::S3: return ARM::S2;
|
||||
case ARM::S5: return ARM::S4;
|
||||
case ARM::S7: return ARM::S6;
|
||||
case ARM::S9: return ARM::S8;
|
||||
case ARM::S11: return ARM::S10;
|
||||
case ARM::S13: return ARM::S12;
|
||||
case ARM::S15: return ARM::S14;
|
||||
case ARM::S17: return ARM::S16;
|
||||
case ARM::S19: return ARM::S18;
|
||||
case ARM::S21: return ARM::S20;
|
||||
case ARM::S23: return ARM::S22;
|
||||
case ARM::S25: return ARM::S24;
|
||||
case ARM::S27: return ARM::S26;
|
||||
case ARM::S29: return ARM::S28;
|
||||
case ARM::S31: return ARM::S30;
|
||||
|
||||
case ARM::D1: return ARM::D0;
|
||||
case ARM::D3: return ARM::D2;
|
||||
case ARM::D5: return ARM::D4;
|
||||
case ARM::D7: return ARM::D6;
|
||||
case ARM::D9: return ARM::D8;
|
||||
case ARM::D11: return ARM::D10;
|
||||
case ARM::D13: return ARM::D12;
|
||||
case ARM::D15: return ARM::D14;
|
||||
case ARM::D17: return ARM::D16;
|
||||
case ARM::D19: return ARM::D18;
|
||||
case ARM::D21: return ARM::D20;
|
||||
case ARM::D23: return ARM::D22;
|
||||
case ARM::D25: return ARM::D24;
|
||||
case ARM::D27: return ARM::D26;
|
||||
case ARM::D29: return ARM::D28;
|
||||
case ARM::D31: return ARM::D30;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned ARMBaseRegisterInfo::getRegisterPairOdd(unsigned Reg,
|
||||
const MachineFunction &MF) const {
|
||||
const MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
switch (Reg) {
|
||||
default: break;
|
||||
// Return 0 if either register of the pair is a special register.
|
||||
// So no R12, etc.
|
||||
case ARM::R0: return ARM::R1;
|
||||
case ARM::R2: return ARM::R3;
|
||||
case ARM::R4: return ARM::R5;
|
||||
case ARM::R6:
|
||||
return (MRI.isReserved(ARM::R7) || MRI.isReserved(ARM::R6))
|
||||
? 0 : ARM::R7;
|
||||
case ARM::R8: return MRI.isReserved(ARM::R9) ? 0 :ARM::R9;
|
||||
case ARM::R10: return MRI.isReserved(ARM::R11) ? 0 : ARM::R11;
|
||||
|
||||
case ARM::S0: return ARM::S1;
|
||||
case ARM::S2: return ARM::S3;
|
||||
case ARM::S4: return ARM::S5;
|
||||
case ARM::S6: return ARM::S7;
|
||||
case ARM::S8: return ARM::S9;
|
||||
case ARM::S10: return ARM::S11;
|
||||
case ARM::S12: return ARM::S13;
|
||||
case ARM::S14: return ARM::S15;
|
||||
case ARM::S16: return ARM::S17;
|
||||
case ARM::S18: return ARM::S19;
|
||||
case ARM::S20: return ARM::S21;
|
||||
case ARM::S22: return ARM::S23;
|
||||
case ARM::S24: return ARM::S25;
|
||||
case ARM::S26: return ARM::S27;
|
||||
case ARM::S28: return ARM::S29;
|
||||
case ARM::S30: return ARM::S31;
|
||||
|
||||
case ARM::D0: return ARM::D1;
|
||||
case ARM::D2: return ARM::D3;
|
||||
case ARM::D4: return ARM::D5;
|
||||
case ARM::D6: return ARM::D7;
|
||||
case ARM::D8: return ARM::D9;
|
||||
case ARM::D10: return ARM::D11;
|
||||
case ARM::D12: return ARM::D13;
|
||||
case ARM::D14: return ARM::D15;
|
||||
case ARM::D16: return ARM::D17;
|
||||
case ARM::D18: return ARM::D19;
|
||||
case ARM::D20: return ARM::D21;
|
||||
case ARM::D22: return ARM::D23;
|
||||
case ARM::D24: return ARM::D25;
|
||||
case ARM::D26: return ARM::D27;
|
||||
case ARM::D28: return ARM::D29;
|
||||
case ARM::D30: return ARM::D31;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// emitLoadConstPool - Emits a load from constpool to materialize the
|
||||
/// specified immediate.
|
||||
void ARMBaseRegisterInfo::
|
||||
|
@ -111,19 +111,12 @@ public:
|
||||
unsigned getRegPressureLimit(const TargetRegisterClass *RC,
|
||||
MachineFunction &MF) const;
|
||||
|
||||
ArrayRef<uint16_t> getRawAllocationOrder(const TargetRegisterClass *RC,
|
||||
unsigned HintType, unsigned HintReg,
|
||||
const MachineFunction &MF) const;
|
||||
|
||||
void getRegAllocationHints(unsigned VirtReg,
|
||||
ArrayRef<MCPhysReg> Order,
|
||||
SmallVectorImpl<MCPhysReg> &Hints,
|
||||
const MachineFunction &MF,
|
||||
const VirtRegMap *VRM) const;
|
||||
|
||||
unsigned ResolveRegAllocHint(unsigned Type, unsigned Reg,
|
||||
const MachineFunction &MF) const;
|
||||
|
||||
void UpdateRegAllocHint(unsigned Reg, unsigned NewReg,
|
||||
MachineFunction &MF) const;
|
||||
|
||||
@ -181,11 +174,6 @@ public:
|
||||
|
||||
virtual void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
private:
|
||||
unsigned getRegisterPairEven(unsigned Reg, const MachineFunction &MF) const;
|
||||
|
||||
unsigned getRegisterPairOdd(unsigned Reg, const MachineFunction &MF) const;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
Loading…
Reference in New Issue
Block a user