Eliminate users of MachineOperand::isPhysicalRegister

llvm-svn: 11278
This commit is contained in:
Chris Lattner 2004-02-10 20:41:10 +00:00
parent 2aea68ccfd
commit 373fba5c1d
3 changed files with 8 additions and 5 deletions

View File

@ -234,7 +234,8 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
if (MO.isUse()) { if (MO.isUse()) {
if (MO.isVirtualRegister() && !MO.getVRegValueOrNull()) { if (MO.isVirtualRegister() && !MO.getVRegValueOrNull()) {
HandleVirtRegUse(getVarInfo(MO.getReg()), MBB, MI); HandleVirtRegUse(getVarInfo(MO.getReg()), MBB, MI);
} else if (MO.isPhysicalRegister() && } else if (MO.isRegister() &&
MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
AllocatablePhysicalRegisters[MO.getReg()]) { AllocatablePhysicalRegisters[MO.getReg()]) {
HandlePhysRegUse(MO.getReg(), MI); HandlePhysRegUse(MO.getReg(), MI);
} }
@ -257,7 +258,8 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
VRInfo.DefBlock = MBB; // Created here... VRInfo.DefBlock = MBB; // Created here...
VRInfo.DefInst = MI; VRInfo.DefInst = MI;
VRInfo.Kills.push_back(std::make_pair(MBB, MI)); // Defaults to dead VRInfo.Kills.push_back(std::make_pair(MBB, MI)); // Defaults to dead
} else if (MO.isPhysicalRegister() && } else if (MO.isRegister() &&
MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
AllocatablePhysicalRegisters[MO.getReg()]) { AllocatablePhysicalRegisters[MO.getReg()]) {
HandlePhysRegDef(MO.getReg(), MI); HandlePhysRegDef(MO.getReg(), MI);
} }

View File

@ -118,7 +118,8 @@ void PEI::saveCallerSavedRegisters(MachineFunction &Fn) {
MachineOperand &MO = (*I)->getOperand(i); MachineOperand &MO = (*I)->getOperand(i);
assert(!MO.isVirtualRegister() && assert(!MO.isVirtualRegister() &&
"Register allocation must be performed!"); "Register allocation must be performed!");
if (MO.isPhysicalRegister() && MO.isDef()) if (MO.isRegister() && MO.isDef() &&
MRegisterInfo::isPhysicalRegister(MO.getReg()))
ModifiedRegs[MO.getReg()] = true; // Register is modified ModifiedRegs[MO.getReg()] = true; // Register is modified
} }
++I; ++I;

View File

@ -556,8 +556,8 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
// Loop over all of the operands of the instruction, spilling registers that // Loop over all of the operands of the instruction, spilling registers that
// are defined, and marking explicit destinations in the PhysRegsUsed map. // are defined, and marking explicit destinations in the PhysRegsUsed map.
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i)
if (MI->getOperand(i).isDef() && if (MI->getOperand(i).isDef() && MI->getOperand(i).isRegister() &&
MI->getOperand(i).isPhysicalRegister()) { MRegisterInfo::isPhysicalRegister(MI->getOperand(i).getReg())) {
unsigned Reg = MI->getOperand(i).getAllocatedRegNum(); unsigned Reg = MI->getOperand(i).getAllocatedRegNum();
spillPhysReg(MBB, I, Reg, true); // Spill any existing value in the reg spillPhysReg(MBB, I, Reg, true); // Spill any existing value in the reg
PhysRegsUsed[Reg] = 0; // It is free and reserved now PhysRegsUsed[Reg] = 0; // It is free and reserved now