aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 9d7b1b2d99..869d963d53 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -27,6 +27,24 @@ namespace llvm {
//
extern const TargetInstrDescriptor *TargetInstrDescriptors;
+bool MachineOperand::isEverUsed(const MachineInstr& mi) const
+{
+ for (int i = 0, e = mi.getNumOperands(); i != e; ++i) {
+ if (*this == mi.getOperand(i) && mi.getOperand(i).isUse())
+ return true;
+ }
+ return false;
+}
+
+bool MachineOperand::isEverDefined(const MachineInstr& mi) const
+{
+ for (int i = 0, e = mi.getNumOperands(); i != e; ++i) {
+ if (*this == mi.getOperand(i) && mi.getOperand(i).isDef())
+ return true;
+ }
+ return false;
+}
+
// Constructor for instructions with variable #operands
MachineInstr::MachineInstr(MachineOpCode OpCode, unsigned numOperands)
: opCode(OpCode),