Rename findRegisterUseOperand to findRegisterUseOperandIdx to avoid confusion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36483 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 4f25267..a81c70e 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -390,10 +390,10 @@
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 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
/// the specific register or NULL if it is not found.
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index e936158..c542033 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -887,7 +887,7 @@
// If the source instruction was killing the source register before the
// 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)
ValLREndInst->getOperand(UIdx).unsetIsKill();
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp
index 9c7f13d..4816cc1 100644
--- a/lib/CodeGen/LiveVariables.cpp
+++ b/lib/CodeGen/LiveVariables.cpp
@@ -435,7 +435,8 @@
"Cannot have a live-in virtual register!");
HandlePhysRegUse(*I, Ret);
// Add live-out registers as implicit uses.
- Ret->addRegOperand(*I, false, true);
+ if (Ret->findRegisterUseOperandIdx(*I) == -1)
+ Ret->addRegOperand(*I, false, true);
}
}
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index a1e7691..1c0d9cc 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -169,10 +169,10 @@
}
}
-/// 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 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) {
MachineOperand &MO = getOperand(i);
if (MO.isReg() && MO.isUse() && MO.getReg() == Reg)
diff --git a/lib/CodeGen/RegisterScavenging.cpp b/lib/CodeGen/RegisterScavenging.cpp
index 13a3619..93c63bf 100644
--- a/lib/CodeGen/RegisterScavenging.cpp
+++ b/lib/CodeGen/RegisterScavenging.cpp
@@ -235,7 +235,7 @@
I = next(I);
while (I != MBB->end()) {
Dist++;
- if (I->findRegisterUseOperand(Reg) != -1)
+ if (I->findRegisterUseOperandIdx(Reg) != -1)
return Dist;
I = next(I);
}
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp
index 482e336..9ae38ac 100644
--- a/lib/CodeGen/VirtRegMap.cpp
+++ b/lib/CodeGen/VirtRegMap.cpp
@@ -764,7 +764,7 @@
// necessary.
bool WasKill = false;
if (SSMI) {
- int UIdx = SSMI->findRegisterUseOperand(PhysReg, true);
+ int UIdx = SSMI->findRegisterUseOperandIdx(PhysReg, true);
if (UIdx != -1) {
MachineOperand &MOK = SSMI->getOperand(UIdx);
WasKill = MOK.isKill();
@@ -849,7 +849,7 @@
// necessary.
bool WasKill = false;
if (SSMI) {
- int UIdx = SSMI->findRegisterUseOperand(PhysReg, true);
+ int UIdx = SSMI->findRegisterUseOperandIdx(PhysReg, true);
if (UIdx != -1) {
MachineOperand &MOK = SSMI->getOperand(UIdx);
WasKill = MOK.isKill();
@@ -859,7 +859,7 @@
MachineInstr *CopyMI = prior(MII);
if (WasKill) {
// Transfer kill to the next use.
- int UIdx = CopyMI->findRegisterUseOperand(PhysReg);
+ int UIdx = CopyMI->findRegisterUseOperandIdx(PhysReg);
assert(UIdx != -1);
MachineOperand &MOU = CopyMI->getOperand(UIdx);
MOU.setIsKill();
@@ -957,7 +957,7 @@
// extended. Remove its kill.
bool WasKill = false;
if (SSMI) {
- int UIdx = SSMI->findRegisterUseOperand(InReg, true);
+ int UIdx = SSMI->findRegisterUseOperandIdx(InReg, true);
if (UIdx != -1) {
MachineOperand &MOK = SSMI->getOperand(UIdx);
WasKill = MOK.isKill();
@@ -967,7 +967,7 @@
if (NextMII != MBB.end()) {
// If NextMII uses InReg and the use is not a two address
// operand, mark it killed.
- int UIdx = NextMII->findRegisterUseOperand(InReg);
+ int UIdx = NextMII->findRegisterUseOperandIdx(InReg);
if (UIdx != -1) {
MachineOperand &MOU = NextMII->getOperand(UIdx);
if (WasKill) {
diff --git a/lib/Target/ARM/ARMInstrInfo.cpp b/lib/Target/ARM/ARMInstrInfo.cpp
index 37156c4..a5ab09c 100644
--- a/lib/Target/ARM/ARMInstrInfo.cpp
+++ b/lib/Target/ARM/ARMInstrInfo.cpp
@@ -278,7 +278,7 @@
for (unsigned j = 0; j < 2; ++j) {
// Look at the two new MI's in reverse order.
MachineInstr *NewMI = NewMIs[j];
- int NIdx = NewMI->findRegisterUseOperand(Reg);
+ int NIdx = NewMI->findRegisterUseOperandIdx(Reg);
if (NIdx == -1)
continue;
LV.addVirtualRegisterKilled(Reg, NewMI);
diff --git a/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
index 6dee9c6..3f8f350 100644
--- a/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
+++ b/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
@@ -221,7 +221,7 @@
}
}
- 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)) {
Merges.push_back(prior(Loc));
for (unsigned i = SIndex, e = MemOps.size(); i != e; ++i) {