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
This commit is contained in:
Evan Cheng 2006-11-11 10:20:02 +00:00
parent 490ce1ea6f
commit 3ba433a7e8
4 changed files with 22 additions and 10 deletions

View File

@ -413,6 +413,10 @@ public:
Op.offset = 0; Op.offset = 0;
} }
/// addImplicitDefUseOperands - Add all implicit def and use operands to
/// this instruction.
void addImplicitDefUseOperands();
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
// Accessors used to modify instructions in place. // Accessors used to modify instructions in place.
// //

View File

@ -77,6 +77,11 @@ public:
MI->addExternalSymbolOperand(FnName); MI->addExternalSymbolOperand(FnName);
return *this; return *this;
} }
const MachineInstrBuilder &addImplicitDefsUses() const {
MI->addImplicitDefUseOperands();
return *this;
}
}; };
/// BuildMI - Builder interface. Specify how to create the initial instruction /// BuildMI - Builder interface. Specify how to create the initial instruction

View File

@ -125,6 +125,18 @@ bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const {
} }
} }
/// 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 { void MachineInstr::dump() const {
std::cerr << " " << *this; std::cerr << " " << *this;

View File

@ -442,16 +442,7 @@ void ScheduleDAG::EmitNode(SDNode *Node,
} }
// Emit implicit def / use operands. // Emit implicit def / use operands.
if (II.ImplicitDefs) { MI->addImplicitDefUseOperands();
for (const unsigned *ImplicitDefs = II.ImplicitDefs;
*ImplicitDefs; ++ImplicitDefs)
MI->addRegOperand(*ImplicitDefs, true, true);
}
if (II.ImplicitUses) {
for (const unsigned *ImplicitUses = II.ImplicitUses;
*ImplicitUses; ++ImplicitUses)
MI->addRegOperand(*ImplicitUses, false, true);
}
// Now that we have emitted all operands, emit this instruction itself. // Now that we have emitted all operands, emit this instruction itself.
if ((II.Flags & M_USES_CUSTOM_DAG_SCHED_INSERTION) == 0) { if ((II.Flags & M_USES_CUSTOM_DAG_SCHED_INSERTION) == 0) {