Add methods to add implicit def use operands to a MI.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31675 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index ba75e73..65c164a 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -125,6 +125,18 @@
   }
 }
 
+/// addImplicitDefUseOperands - Add all implicit def and use operands to
+/// this instruction.
+void MachineInstr::addImplicitDefUseOperands() {
+  const TargetInstrDescriptor &TID = TargetInstrDescriptors[Opcode];
+  if (TID.ImplicitDefs)
+    for (const unsigned *ImpDefs = TID.ImplicitDefs; *ImpDefs; ++ImpDefs)
+      addRegOperand(*ImpDefs, true, true);
+  if (TID.ImplicitUses)
+    for (const unsigned *ImpUses = TID.ImplicitUses; *ImpUses; ++ImpUses)
+      addRegOperand(*ImpUses, false, true);
+}
+
 
 void MachineInstr::dump() const {
   std::cerr << "  " << *this;