aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-02-17 11:10:18 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-02-17 11:10:18 +0000
commit094e3e553f57b877153828e420cd2dacfb2b364c (patch)
treeadc16b4a4363d3acd4d5a5f8c249ca288d5c7016 /lib/CodeGen/MachineInstr.cpp
parente15764f28f10f86ad88c4391bb5619191609f6b4 (diff)
downloadexternal_llvm-094e3e553f57b877153828e420cd2dacfb2b364c.zip
external_llvm-094e3e553f57b877153828e420cd2dacfb2b364c.tar.gz
external_llvm-094e3e553f57b877153828e420cd2dacfb2b364c.tar.bz2
Added findRegisterDefOperand().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index a393133..01a3e3e 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -180,6 +180,17 @@ MachineOperand *MachineInstr::findRegisterUseOperand(unsigned Reg) {
return NULL;
}
+/// findRegisterDefOperand() - Returns the MachineOperand that is a def of
+/// the specific register or NULL if it is not found.
+MachineOperand *MachineInstr::findRegisterDefOperand(unsigned Reg) {
+ for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
+ MachineOperand &MO = getOperand(i);
+ if (MO.isReg() && MO.isDef() && MO.getReg() == Reg)
+ return &MO;
+ }
+ return NULL;
+}
+
/// copyKillDeadInfo - Copies kill / dead operand properties from MI.
///
void MachineInstr::copyKillDeadInfo(const MachineInstr *MI) {