1
0
mirror of https://github.com/c64scene-ar/llvm-6502.git synced 2025-02-19 06:31:18 +00:00

Use two-arg addOperand(MF, MO) internally in MachineInstr when possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170796 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2012-12-20 22:53:58 +00:00
parent b9efafe54d
commit 9500e5d07a
3 changed files with 11 additions and 10 deletions

@ -97,7 +97,8 @@ private:
/// 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
/// MCInstrDesc. An explicit DebugLoc is supplied. /// MCInstrDesc. An explicit DebugLoc is supplied.
MachineInstr(const MCInstrDesc &MCID, const DebugLoc dl, bool NoImp = false); MachineInstr(MachineFunction&, const MCInstrDesc &MCID,
const DebugLoc dl, bool NoImp = false);
~MachineInstr(); ~MachineInstr();
@ -997,7 +998,7 @@ private:
/// addImplicitDefUseOperands - Add all implicit def and use operands to /// addImplicitDefUseOperands - Add all implicit def and use operands to
/// this instruction. /// this instruction.
void addImplicitDefUseOperands(); void addImplicitDefUseOperands(MachineFunction &MF);
/// RemoveRegOperandsFromUseLists - Unlink all of the register operands in /// RemoveRegOperandsFromUseLists - Unlink all of the register operands in
/// this instruction from their respective use lists. This requires that the /// this instruction from their respective use lists. This requires that the

@ -158,7 +158,7 @@ MachineInstr *
MachineFunction::CreateMachineInstr(const MCInstrDesc &MCID, MachineFunction::CreateMachineInstr(const MCInstrDesc &MCID,
DebugLoc DL, bool NoImp) { DebugLoc DL, bool NoImp) {
return new (InstructionRecycler.Allocate<MachineInstr>(Allocator)) return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
MachineInstr(MCID, DL, NoImp); MachineInstr(*this, MCID, DL, NoImp);
} }
/// CloneMachineInstr - Create a new MachineInstr which is a copy of the /// CloneMachineInstr - Create a new MachineInstr which is a copy of the

@ -518,20 +518,20 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineMemOperand &MMO) {
// MachineInstr Implementation // MachineInstr Implementation
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
void MachineInstr::addImplicitDefUseOperands() { void MachineInstr::addImplicitDefUseOperands(MachineFunction &MF) {
if (MCID->ImplicitDefs) if (MCID->ImplicitDefs)
for (const uint16_t *ImpDefs = MCID->getImplicitDefs(); *ImpDefs; ++ImpDefs) for (const uint16_t *ImpDefs = MCID->getImplicitDefs(); *ImpDefs; ++ImpDefs)
addOperand(MachineOperand::CreateReg(*ImpDefs, true, true)); addOperand(MF, MachineOperand::CreateReg(*ImpDefs, true, true));
if (MCID->ImplicitUses) if (MCID->ImplicitUses)
for (const uint16_t *ImpUses = MCID->getImplicitUses(); *ImpUses; ++ImpUses) for (const uint16_t *ImpUses = MCID->getImplicitUses(); *ImpUses; ++ImpUses)
addOperand(MachineOperand::CreateReg(*ImpUses, false, true)); addOperand(MF, MachineOperand::CreateReg(*ImpUses, false, true));
} }
/// MachineInstr ctor - This constructor creates a MachineInstr and adds the /// MachineInstr ctor - This constructor creates a MachineInstr and adds the
/// implicit operands. It reserves space for the number of operands specified by /// implicit operands. It reserves space for the number of operands specified by
/// the MCInstrDesc. /// the MCInstrDesc.
MachineInstr::MachineInstr(const MCInstrDesc &tid, const DebugLoc dl, MachineInstr::MachineInstr(MachineFunction &MF, const MCInstrDesc &tid,
bool NoImp) const DebugLoc dl, bool NoImp)
: MCID(&tid), Flags(0), AsmPrinterFlags(0), : MCID(&tid), Flags(0), AsmPrinterFlags(0),
NumMemRefs(0), MemRefs(0), Parent(0), debugLoc(dl) { NumMemRefs(0), MemRefs(0), Parent(0), debugLoc(dl) {
unsigned NumImplicitOps = 0; unsigned NumImplicitOps = 0;
@ -539,7 +539,7 @@ MachineInstr::MachineInstr(const MCInstrDesc &tid, const DebugLoc dl,
NumImplicitOps = MCID->getNumImplicitDefs() + MCID->getNumImplicitUses(); NumImplicitOps = MCID->getNumImplicitDefs() + MCID->getNumImplicitUses();
Operands.reserve(NumImplicitOps + MCID->getNumOperands()); Operands.reserve(NumImplicitOps + MCID->getNumOperands());
if (!NoImp) if (!NoImp)
addImplicitDefUseOperands(); addImplicitDefUseOperands(MF);
// 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);
} }
@ -554,7 +554,7 @@ MachineInstr::MachineInstr(MachineFunction &MF, const MachineInstr &MI)
// Add operands // Add operands
for (unsigned i = 0; i != MI.getNumOperands(); ++i) for (unsigned i = 0; i != MI.getNumOperands(); ++i)
addOperand(MI.getOperand(i)); addOperand(MF, MI.getOperand(i));
// Copy all the sensible flags. // Copy all the sensible flags.
setFlags(MI.Flags); setFlags(MI.Flags);