mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
Make dense maps keyed on physical registers smallerusing
MRegisterInfo::getNumRegs() instead of MRegisterInfo::FirstVirtualRegister. Also use MRegisterInfo::is{Physical,Virtual}Register where appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11477 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -187,10 +187,9 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
// physical register. This is a purely local property, because all physical
|
// physical register. This is a purely local property, because all physical
|
||||||
// register references as presumed dead across basic blocks.
|
// register references as presumed dead across basic blocks.
|
||||||
//
|
//
|
||||||
MachineInstr *PhysRegInfoA[MRegisterInfo::FirstVirtualRegister];
|
MachineInstr *PhysRegInfoA[RegInfo->getNumRegs()];
|
||||||
bool PhysRegUsedA[MRegisterInfo::FirstVirtualRegister];
|
bool PhysRegUsedA[RegInfo->getNumRegs()];
|
||||||
std::fill(PhysRegInfoA, PhysRegInfoA+MRegisterInfo::FirstVirtualRegister,
|
std::fill(PhysRegInfoA, PhysRegInfoA+RegInfo->getNumRegs(), (MachineInstr*)0);
|
||||||
(MachineInstr*)0);
|
|
||||||
PhysRegInfo = PhysRegInfoA;
|
PhysRegInfo = PhysRegInfoA;
|
||||||
PhysRegUsed = PhysRegUsedA;
|
PhysRegUsed = PhysRegUsedA;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void PEI::saveCallerSavedRegisters(MachineFunction &Fn) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// This bitset contains an entry for each physical register for the target...
|
// This bitset contains an entry for each physical register for the target...
|
||||||
std::vector<bool> ModifiedRegs(MRegisterInfo::FirstVirtualRegister);
|
std::vector<bool> ModifiedRegs(RegInfo->getNumRegs());
|
||||||
unsigned MaxCallFrameSize = 0;
|
unsigned MaxCallFrameSize = 0;
|
||||||
bool HasCalls = false;
|
bool HasCalls = false;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace {
|
|||||||
std::vector<unsigned> Virt2PhysRegMap;
|
std::vector<unsigned> Virt2PhysRegMap;
|
||||||
|
|
||||||
unsigned &getVirt2PhysRegMapSlot(unsigned VirtReg) {
|
unsigned &getVirt2PhysRegMapSlot(unsigned VirtReg) {
|
||||||
assert(VirtReg >= MRegisterInfo::FirstVirtualRegister &&"Illegal VREG #");
|
assert(MRegisterInfo::isVirtualRegister(VirtReg) &&"Illegal VREG #");
|
||||||
assert(VirtReg-MRegisterInfo::FirstVirtualRegister <Virt2PhysRegMap.size()
|
assert(VirtReg-MRegisterInfo::FirstVirtualRegister <Virt2PhysRegMap.size()
|
||||||
&& "VirtReg not in map!");
|
&& "VirtReg not in map!");
|
||||||
return Virt2PhysRegMap[VirtReg-MRegisterInfo::FirstVirtualRegister];
|
return Virt2PhysRegMap[VirtReg-MRegisterInfo::FirstVirtualRegister];
|
||||||
|
@ -154,7 +154,7 @@ void RegAllocSimple::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
// Made to combat the incorrect allocation of r2 = add r1, r1
|
// Made to combat the incorrect allocation of r2 = add r1, r1
|
||||||
std::map<unsigned, unsigned> Virt2PhysRegMap;
|
std::map<unsigned, unsigned> Virt2PhysRegMap;
|
||||||
|
|
||||||
RegsUsed.resize(MRegisterInfo::FirstVirtualRegister);
|
RegsUsed.resize(RegInfo->getNumRegs());
|
||||||
|
|
||||||
// a preliminary pass that will invalidate any registers that
|
// a preliminary pass that will invalidate any registers that
|
||||||
// are used by the instruction (including implicit uses)
|
// are used by the instruction (including implicit uses)
|
||||||
|
@ -164,7 +164,7 @@ namespace {
|
|||||||
// getDefinition - Return the machine instruction that defines the specified
|
// getDefinition - Return the machine instruction that defines the specified
|
||||||
// SSA virtual register.
|
// SSA virtual register.
|
||||||
MachineInstr *getDefinition(unsigned Reg) {
|
MachineInstr *getDefinition(unsigned Reg) {
|
||||||
assert(Reg >= MRegisterInfo::FirstVirtualRegister &&
|
assert(MRegisterInfo::isVirtualRegister(Reg) &&
|
||||||
"use-def chains only exist for SSA registers!");
|
"use-def chains only exist for SSA registers!");
|
||||||
assert(Reg - MRegisterInfo::FirstVirtualRegister < DefiningInst.size() &&
|
assert(Reg - MRegisterInfo::FirstVirtualRegister < DefiningInst.size() &&
|
||||||
"Unknown register number!");
|
"Unknown register number!");
|
||||||
|
@ -399,7 +399,7 @@ void Printer::printOp(const MachineOperand &MO,
|
|||||||
}
|
}
|
||||||
// FALLTHROUGH
|
// FALLTHROUGH
|
||||||
case MachineOperand::MO_MachineRegister:
|
case MachineOperand::MO_MachineRegister:
|
||||||
if (MO.getReg() < MRegisterInfo::FirstVirtualRegister)
|
if (MRegisterInfo::isPhysicalRegister(MO.getReg()))
|
||||||
// Bug Workaround: See note in Printer::doInitialization about %.
|
// Bug Workaround: See note in Printer::doInitialization about %.
|
||||||
O << "%" << RI.get(MO.getReg()).Name;
|
O << "%" << RI.get(MO.getReg()).Name;
|
||||||
else
|
else
|
||||||
|
@ -399,7 +399,7 @@ void Printer::printOp(const MachineOperand &MO,
|
|||||||
}
|
}
|
||||||
// FALLTHROUGH
|
// FALLTHROUGH
|
||||||
case MachineOperand::MO_MachineRegister:
|
case MachineOperand::MO_MachineRegister:
|
||||||
if (MO.getReg() < MRegisterInfo::FirstVirtualRegister)
|
if (MRegisterInfo::isPhysicalRegister(MO.getReg()))
|
||||||
// Bug Workaround: See note in Printer::doInitialization about %.
|
// Bug Workaround: See note in Printer::doInitialization about %.
|
||||||
O << "%" << RI.get(MO.getReg()).Name;
|
O << "%" << RI.get(MO.getReg()).Name;
|
||||||
else
|
else
|
||||||
|
@ -329,7 +329,7 @@ static unsigned getX86RegNum(unsigned RegNo) {
|
|||||||
case X86::ST4: case X86::ST5: case X86::ST6: case X86::ST7:
|
case X86::ST4: case X86::ST5: case X86::ST6: case X86::ST7:
|
||||||
return RegNo-X86::ST0;
|
return RegNo-X86::ST0;
|
||||||
default:
|
default:
|
||||||
assert(RegNo >= MRegisterInfo::FirstVirtualRegister &&
|
assert(MRegisterInfo::isVirtualRegister(RegNo) &&
|
||||||
"Unknown physical register!");
|
"Unknown physical register!");
|
||||||
assert(0 && "Register allocator hasn't allocated reg correctly yet!");
|
assert(0 && "Register allocator hasn't allocated reg correctly yet!");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -164,7 +164,7 @@ namespace {
|
|||||||
// getDefinition - Return the machine instruction that defines the specified
|
// getDefinition - Return the machine instruction that defines the specified
|
||||||
// SSA virtual register.
|
// SSA virtual register.
|
||||||
MachineInstr *getDefinition(unsigned Reg) {
|
MachineInstr *getDefinition(unsigned Reg) {
|
||||||
assert(Reg >= MRegisterInfo::FirstVirtualRegister &&
|
assert(MRegisterInfo::isVirtualRegister(Reg) &&
|
||||||
"use-def chains only exist for SSA registers!");
|
"use-def chains only exist for SSA registers!");
|
||||||
assert(Reg - MRegisterInfo::FirstVirtualRegister < DefiningInst.size() &&
|
assert(Reg - MRegisterInfo::FirstVirtualRegister < DefiningInst.size() &&
|
||||||
"Unknown register number!");
|
"Unknown register number!");
|
||||||
|
Reference in New Issue
Block a user