Optionally create a MachineInstr without default implicit operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42945 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-10-13 02:23:01 +00:00
parent 92226dd19f
commit fa9457276a
2 changed files with 6 additions and 5 deletions

View File

@ -340,7 +340,7 @@ public:
/// MachineInstr ctor - This constructor create a MachineInstr and add the /// MachineInstr ctor - This constructor create a MachineInstr and add the
/// implicit operands. It reserves space for number of operands specified by /// implicit operands. It reserves space for number of operands specified by
/// TargetInstrDescriptor. /// TargetInstrDescriptor.
explicit MachineInstr(const TargetInstrDescriptor &TID); explicit MachineInstr(const TargetInstrDescriptor &TID, bool NoImp = false);
/// MachineInstr ctor - Work exactly the same as the ctor above, except that /// MachineInstr ctor - Work exactly the same as the ctor above, except that
/// the MachineInstr is created and added to the end of the specified basic /// the MachineInstr is created and added to the end of the specified basic

View File

@ -58,16 +58,17 @@ void MachineInstr::addImplicitDefUseOperands() {
/// implicit operands. It reserves space for number of operands specified by /// implicit operands. It reserves space for number of operands specified by
/// TargetInstrDescriptor or the numOperands if it is not zero. (for /// TargetInstrDescriptor or the numOperands if it is not zero. (for
/// instructions with variable number of operands). /// instructions with variable number of operands).
MachineInstr::MachineInstr(const TargetInstrDescriptor &tid) MachineInstr::MachineInstr(const TargetInstrDescriptor &tid, bool NoImp)
: TID(&tid), NumImplicitOps(0), parent(0) { : TID(&tid), NumImplicitOps(0), parent(0) {
if (TID->ImplicitDefs) if (!NoImp && TID->ImplicitDefs)
for (const unsigned *ImpDefs = TID->ImplicitDefs; *ImpDefs; ++ImpDefs) for (const unsigned *ImpDefs = TID->ImplicitDefs; *ImpDefs; ++ImpDefs)
NumImplicitOps++; NumImplicitOps++;
if (TID->ImplicitUses) if (!NoImp && TID->ImplicitUses)
for (const unsigned *ImpUses = TID->ImplicitUses; *ImpUses; ++ImpUses) for (const unsigned *ImpUses = TID->ImplicitUses; *ImpUses; ++ImpUses)
NumImplicitOps++; NumImplicitOps++;
Operands.reserve(NumImplicitOps + TID->numOperands); Operands.reserve(NumImplicitOps + TID->numOperands);
addImplicitDefUseOperands(); if (!NoImp)
addImplicitDefUseOperands();
// Make sure that we get added to a machine basicblock // Make sure that we get added to a machine basicblock
LeakDetector::addGarbageObject(this); LeakDetector::addGarbageObject(this);
} }