aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-05-29 18:35:22 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-05-29 18:35:22 +0000
commitf277ee4be7edabb759a7f78138b693d72d0c263f (patch)
tree782c712ce4f0135703c6f7d42612ab6323902194 /lib/CodeGen/MachineInstr.cpp
parent2fb813d70b8928f355b35f782889c55c1aa891ef (diff)
Add missing const qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37341 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index d27cf6a77b..723296eda4 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -191,9 +191,9 @@ bool MachineInstr::isPredicable() const {
/// 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::findRegisterUseOperandIdx(unsigned Reg, bool isKill) {
+int MachineInstr::findRegisterUseOperandIdx(unsigned Reg, bool isKill) const {
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
- MachineOperand &MO = getOperand(i);
+ const MachineOperand &MO = getOperand(i);
if (MO.isReg() && MO.isUse() && MO.getReg() == Reg)
if (!isKill || MO.isKill())
return i;
@@ -212,17 +212,18 @@ MachineOperand *MachineInstr::findRegisterDefOperand(unsigned Reg) {
return NULL;
}
-/// findFirstPredOperand() - Find the first operand in the operand list that
-// is used to represent the predicate.
-MachineOperand *MachineInstr::findFirstPredOperand() {
+/// findFirstPredOperandIdx() - Find the index of the first operand in the
+/// operand list that is used to represent the predicate. It returns -1 if
+/// none is found.
+int MachineInstr::findFirstPredOperandIdx() const {
const TargetInstrDescriptor *TID = getInstrDescriptor();
if (TID->Flags & M_PREDICABLE) {
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
if ((TID->OpInfo[i].Flags & M_PREDICATE_OPERAND))
- return &getOperand(i);
+ return i;
}
- return NULL;
+ return -1;
}
/// copyKillDeadInfo - Copies kill / dead operand properties from MI.