Rename findRegisterUseOperand to findRegisterUseOperandIdx to avoid confusion.

llvm-svn: 36483
This commit is contained in:
Evan Cheng 2007-04-26 19:00:32 +00:00
parent 6200dc3275
commit eff332e3e1
8 changed files with 15 additions and 14 deletions

@ -390,10 +390,10 @@ public:
delete removeFromParent(); delete removeFromParent();
} }
/// findRegisterUseOperand() - Returns the operand index that is a use of /// findRegisterUseOperandIdx() - Returns the operand index that is a use of
/// the specific register or -1 if it is not found. It further tightening /// the specific register or -1 if it is not found. It further tightening
/// the search criteria to a use that kills the register if isKill is true. /// the search criteria to a use that kills the register if isKill is true.
int findRegisterUseOperand(unsigned Reg, bool isKill = false); int findRegisterUseOperandIdx(unsigned Reg, bool isKill = false);
/// findRegisterDefOperand() - Returns the MachineOperand that is a def of /// findRegisterDefOperand() - Returns the MachineOperand that is a def of
/// the specific register or NULL if it is not found. /// the specific register or NULL if it is not found.

@ -887,7 +887,7 @@ bool LiveIntervals::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,
// If the source instruction was killing the source register before the // If the source instruction was killing the source register before the
// merge, unset the isKill marker given the live range has been extended. // merge, unset the isKill marker given the live range has been extended.
int UIdx = ValLREndInst->findRegisterUseOperand(IntB.reg, true); int UIdx = ValLREndInst->findRegisterUseOperandIdx(IntB.reg, true);
if (UIdx != -1) if (UIdx != -1)
ValLREndInst->getOperand(UIdx).unsetIsKill(); ValLREndInst->getOperand(UIdx).unsetIsKill();

@ -435,7 +435,8 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
"Cannot have a live-in virtual register!"); "Cannot have a live-in virtual register!");
HandlePhysRegUse(*I, Ret); HandlePhysRegUse(*I, Ret);
// Add live-out registers as implicit uses. // Add live-out registers as implicit uses.
Ret->addRegOperand(*I, false, true); if (Ret->findRegisterUseOperandIdx(*I) == -1)
Ret->addRegOperand(*I, false, true);
} }
} }

@ -169,10 +169,10 @@ bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const {
} }
} }
/// findRegisterUseOperand() - Returns the MachineOperand that is a use of /// findRegisterUseOperandIdx() - Returns the MachineOperand that is a use of
/// the specific register or -1 if it is not found. It further tightening /// the specific register or -1 if it is not found. It further tightening
/// the search criteria to a use that kills the register if isKill is true. /// the search criteria to a use that kills the register if isKill is true.
int MachineInstr::findRegisterUseOperand(unsigned Reg, bool isKill){ int MachineInstr::findRegisterUseOperandIdx(unsigned Reg, bool isKill) {
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
MachineOperand &MO = getOperand(i); MachineOperand &MO = getOperand(i);
if (MO.isReg() && MO.isUse() && MO.getReg() == Reg) if (MO.isReg() && MO.isUse() && MO.getReg() == Reg)

@ -235,7 +235,7 @@ static unsigned calcDistanceToUse(MachineBasicBlock *MBB,
I = next(I); I = next(I);
while (I != MBB->end()) { while (I != MBB->end()) {
Dist++; Dist++;
if (I->findRegisterUseOperand(Reg) != -1) if (I->findRegisterUseOperandIdx(Reg) != -1)
return Dist; return Dist;
I = next(I); I = next(I);
} }

@ -764,7 +764,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
// necessary. // necessary.
bool WasKill = false; bool WasKill = false;
if (SSMI) { if (SSMI) {
int UIdx = SSMI->findRegisterUseOperand(PhysReg, true); int UIdx = SSMI->findRegisterUseOperandIdx(PhysReg, true);
if (UIdx != -1) { if (UIdx != -1) {
MachineOperand &MOK = SSMI->getOperand(UIdx); MachineOperand &MOK = SSMI->getOperand(UIdx);
WasKill = MOK.isKill(); WasKill = MOK.isKill();
@ -849,7 +849,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
// necessary. // necessary.
bool WasKill = false; bool WasKill = false;
if (SSMI) { if (SSMI) {
int UIdx = SSMI->findRegisterUseOperand(PhysReg, true); int UIdx = SSMI->findRegisterUseOperandIdx(PhysReg, true);
if (UIdx != -1) { if (UIdx != -1) {
MachineOperand &MOK = SSMI->getOperand(UIdx); MachineOperand &MOK = SSMI->getOperand(UIdx);
WasKill = MOK.isKill(); WasKill = MOK.isKill();
@ -859,7 +859,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
MachineInstr *CopyMI = prior(MII); MachineInstr *CopyMI = prior(MII);
if (WasKill) { if (WasKill) {
// Transfer kill to the next use. // Transfer kill to the next use.
int UIdx = CopyMI->findRegisterUseOperand(PhysReg); int UIdx = CopyMI->findRegisterUseOperandIdx(PhysReg);
assert(UIdx != -1); assert(UIdx != -1);
MachineOperand &MOU = CopyMI->getOperand(UIdx); MachineOperand &MOU = CopyMI->getOperand(UIdx);
MOU.setIsKill(); MOU.setIsKill();
@ -957,7 +957,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
// extended. Remove its kill. // extended. Remove its kill.
bool WasKill = false; bool WasKill = false;
if (SSMI) { if (SSMI) {
int UIdx = SSMI->findRegisterUseOperand(InReg, true); int UIdx = SSMI->findRegisterUseOperandIdx(InReg, true);
if (UIdx != -1) { if (UIdx != -1) {
MachineOperand &MOK = SSMI->getOperand(UIdx); MachineOperand &MOK = SSMI->getOperand(UIdx);
WasKill = MOK.isKill(); WasKill = MOK.isKill();
@ -967,7 +967,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
if (NextMII != MBB.end()) { if (NextMII != MBB.end()) {
// If NextMII uses InReg and the use is not a two address // If NextMII uses InReg and the use is not a two address
// operand, mark it killed. // operand, mark it killed.
int UIdx = NextMII->findRegisterUseOperand(InReg); int UIdx = NextMII->findRegisterUseOperandIdx(InReg);
if (UIdx != -1) { if (UIdx != -1) {
MachineOperand &MOU = NextMII->getOperand(UIdx); MachineOperand &MOU = NextMII->getOperand(UIdx);
if (WasKill) { if (WasKill) {

@ -278,7 +278,7 @@ ARMInstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
for (unsigned j = 0; j < 2; ++j) { for (unsigned j = 0; j < 2; ++j) {
// Look at the two new MI's in reverse order. // Look at the two new MI's in reverse order.
MachineInstr *NewMI = NewMIs[j]; MachineInstr *NewMI = NewMIs[j];
int NIdx = NewMI->findRegisterUseOperand(Reg); int NIdx = NewMI->findRegisterUseOperandIdx(Reg);
if (NIdx == -1) if (NIdx == -1)
continue; continue;
LV.addVirtualRegisterKilled(Reg, NewMI); LV.addVirtualRegisterKilled(Reg, NewMI);

@ -221,7 +221,7 @@ ARMLoadStoreOpt::MergeLDR_STR(MachineBasicBlock &MBB, unsigned SIndex,
} }
} }
bool BaseKill = Loc->findRegisterUseOperand(Base, true) != -1; bool BaseKill = Loc->findRegisterUseOperandIdx(Base, true) != -1;
if (mergeOps(MBB, ++Loc, SOffset, Base, BaseKill, Opcode,Scratch,Regs, TII)) { if (mergeOps(MBB, ++Loc, SOffset, Base, BaseKill, Opcode,Scratch,Regs, TII)) {
Merges.push_back(prior(Loc)); Merges.push_back(prior(Loc));
for (unsigned i = SIndex, e = MemOps.size(); i != e; ++i) { for (unsigned i = SIndex, e = MemOps.size(); i != e; ++i) {