mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-03 18:37:56 +00:00
Use getNumVirtualRegs().
Whitespace cleanups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11389 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
87af94b291
commit
4de473bc59
@ -58,12 +58,6 @@ namespace {
|
||||
&& "VirtReg not in map!");
|
||||
return Virt2PhysRegMap[VirtReg-MRegisterInfo::FirstVirtualRegister];
|
||||
}
|
||||
unsigned &getOrInsertVirt2PhysRegMapSlot(unsigned VirtReg) {
|
||||
assert(VirtReg >= MRegisterInfo::FirstVirtualRegister &&"Illegal VREG #");
|
||||
if (VirtReg-MRegisterInfo::FirstVirtualRegister >= Virt2PhysRegMap.size())
|
||||
Virt2PhysRegMap.resize(VirtReg-MRegisterInfo::FirstVirtualRegister+1);
|
||||
return Virt2PhysRegMap[VirtReg-MRegisterInfo::FirstVirtualRegister];
|
||||
}
|
||||
|
||||
// PhysRegsUsed - This array is effectively a map, containing entries for
|
||||
// each physical register that currently has a value (ie, it is in
|
||||
@ -73,7 +67,7 @@ namespace {
|
||||
// because it is used by a future instruction. If the entry for a physical
|
||||
// register is -1, then the physical register is "not in the map".
|
||||
//
|
||||
int PhysRegsUsed[MRegisterInfo::FirstVirtualRegister];
|
||||
std::vector<int> PhysRegsUsed;
|
||||
|
||||
// PhysRegsUseOrder - This contains a list of the physical registers that
|
||||
// currently have a virtual register value in them. This list provides an
|
||||
@ -319,7 +313,7 @@ void RA::assignVirtToPhysReg(unsigned VirtReg, unsigned PhysReg) {
|
||||
// Update information to note the fact that this register was just used, and
|
||||
// it holds VirtReg.
|
||||
PhysRegsUsed[PhysReg] = VirtReg;
|
||||
getOrInsertVirt2PhysRegMapSlot(VirtReg) = PhysReg;
|
||||
getVirt2PhysRegMapSlot(VirtReg) = PhysReg;
|
||||
PhysRegsUseOrder.push_back(PhysReg); // New use of PhysReg
|
||||
}
|
||||
|
||||
@ -471,7 +465,7 @@ unsigned RA::getReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
|
||||
unsigned RA::reloadVirtReg(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator &I,
|
||||
unsigned VirtReg) {
|
||||
if (unsigned PR = getOrInsertVirt2PhysRegMapSlot(VirtReg)) {
|
||||
if (unsigned PR = getVirt2PhysRegMapSlot(VirtReg)) {
|
||||
MarkPhysRegRecentlyUsed(PR);
|
||||
return PR; // Already have this value available!
|
||||
}
|
||||
@ -594,7 +588,7 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
||||
unsigned DestPhysReg;
|
||||
|
||||
// If DestVirtReg already has a value, use it.
|
||||
if (!(DestPhysReg = getOrInsertVirt2PhysRegMapSlot(DestVirtReg)))
|
||||
if (!(DestPhysReg = getVirt2PhysRegMapSlot(DestVirtReg)))
|
||||
DestPhysReg = getReg(MBB, MI, DestVirtReg);
|
||||
markVirtRegModified(DestVirtReg);
|
||||
MI->SetMachineOperandReg(i, DestPhysReg); // Assign the output register
|
||||
@ -664,12 +658,11 @@ bool RA::runOnMachineFunction(MachineFunction &Fn) {
|
||||
TM = &Fn.getTarget();
|
||||
RegInfo = TM->getRegisterInfo();
|
||||
|
||||
memset(PhysRegsUsed, -1, RegInfo->getNumRegs()*sizeof(unsigned));
|
||||
PhysRegsUsed.assign(RegInfo->getNumRegs(), -1);
|
||||
|
||||
// Reserve some space for a moderate number of registers. If we know what the
|
||||
// max virtual register number was we could use that instead and save some
|
||||
// runtime overhead...
|
||||
Virt2PhysRegMap.resize(1024);
|
||||
// initialize the virtual->physical register map to have a 'null'
|
||||
// mapping for all virtual registers
|
||||
Virt2PhysRegMap.assign(MF->getSSARegMap()->getNumVirtualRegs(), 0);
|
||||
|
||||
if (!DisableKill)
|
||||
LV = &getAnalysis<LiveVariables>();
|
||||
@ -680,6 +673,7 @@ bool RA::runOnMachineFunction(MachineFunction &Fn) {
|
||||
AllocateBasicBlock(*MBB);
|
||||
|
||||
StackSlotForVirtReg.clear();
|
||||
PhysRegsUsed.clear();
|
||||
VirtRegModified.clear();
|
||||
Virt2PhysRegMap.clear();
|
||||
return true;
|
||||
@ -688,4 +682,3 @@ bool RA::runOnMachineFunction(MachineFunction &Fn) {
|
||||
FunctionPass *llvm::createLocalRegisterAllocator() {
|
||||
return new RA();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user