simplify some code by factoring operand construction better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45428 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index dd89e36..1655cba 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -31,29 +31,11 @@
void MachineInstr::addImplicitDefUseOperands() {
if (TID->ImplicitDefs)
- for (const unsigned *ImpDefs = TID->ImplicitDefs; *ImpDefs; ++ImpDefs) {
- MachineOperand Op;
- Op.opType = MachineOperand::MO_Register;
- Op.IsDef = true;
- Op.IsImp = true;
- Op.IsKill = false;
- Op.IsDead = false;
- Op.contents.RegNo = *ImpDefs;
- Op.auxInfo.subReg = 0;
- Operands.push_back(Op);
- }
+ for (const unsigned *ImpDefs = TID->ImplicitDefs; *ImpDefs; ++ImpDefs)
+ addRegOperand(*ImpDefs, true, true);
if (TID->ImplicitUses)
- for (const unsigned *ImpUses = TID->ImplicitUses; *ImpUses; ++ImpUses) {
- MachineOperand Op;
- Op.opType = MachineOperand::MO_Register;
- Op.IsDef = false;
- Op.IsImp = true;
- Op.IsKill = false;
- Op.IsDead = false;
- Op.contents.RegNo = *ImpUses;
- Op.auxInfo.subReg = 0;
- Operands.push_back(Op);
- }
+ for (const unsigned *ImpUses = TID->ImplicitUses; *ImpUses; ++ImpUses)
+ addRegOperand(*ImpUses, false, true);
}
/// MachineInstr ctor - This constructor create a MachineInstr and add the