mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Add an MF argument to MI::copyImplicitOps().
This function is often used to decorate dangling instructions, so a context reference is required to allocate memory for the operands. Also add a corresponding MachineInstrBuilder method. llvm-svn: 170797
This commit is contained in:
parent
ae8ba671bc
commit
c81d04b28d
@ -929,7 +929,7 @@ public:
|
||||
|
||||
/// copyImplicitOps - Copy implicit register operands from specified
|
||||
/// instruction to this instruction.
|
||||
void copyImplicitOps(const MachineInstr *MI);
|
||||
void copyImplicitOps(MachineFunction &MF, const MachineInstr *MI);
|
||||
|
||||
//
|
||||
// Debugging support
|
||||
|
@ -208,6 +208,12 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy all the implicit operands from OtherMI onto this one.
|
||||
const MachineInstrBuilder ©ImplicitOps(const MachineInstr *OtherMI) {
|
||||
MI->copyImplicitOps(*MF, OtherMI);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
/// BuildMI - Builder interface. Specify how to create the initial instruction
|
||||
|
@ -1403,12 +1403,13 @@ bool MachineInstr::allDefsAreDead() const {
|
||||
|
||||
/// copyImplicitOps - Copy implicit register operands from specified
|
||||
/// instruction to this instruction.
|
||||
void MachineInstr::copyImplicitOps(const MachineInstr *MI) {
|
||||
void MachineInstr::copyImplicitOps(MachineFunction &MF,
|
||||
const MachineInstr *MI) {
|
||||
for (unsigned i = MI->getDesc().getNumOperands(), e = MI->getNumOperands();
|
||||
i != e; ++i) {
|
||||
const MachineOperand &MO = MI->getOperand(i);
|
||||
if (MO.isReg() && MO.isImplicit())
|
||||
addOperand(MO);
|
||||
addOperand(MF, MO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,7 +696,7 @@ void ARMFrameLowering::emitPopInst(MachineBasicBlock &MBB,
|
||||
for (unsigned i = 0, e = Regs.size(); i < e; ++i)
|
||||
MIB.addReg(Regs[i], getDefRegState(true));
|
||||
if (DeleteRet) {
|
||||
MIB->copyImplicitOps(&*MI);
|
||||
MIB.copyImplicitOps(&*MI);
|
||||
MI->eraseFromParent();
|
||||
}
|
||||
MI = MIB;
|
||||
|
@ -1408,7 +1408,7 @@ bool ARMLoadStoreOpt::MergeReturnIntoLDM(MachineBasicBlock &MBB) {
|
||||
Opcode == ARM::LDMIA_UPD) && "Unsupported multiple load-return!");
|
||||
PrevMI->setDesc(TII->get(NewOpc));
|
||||
MO.setReg(ARM::PC);
|
||||
PrevMI->copyImplicitOps(&*MBBI);
|
||||
PrevMI->copyImplicitOps(*MBB.getParent(), &*MBBI);
|
||||
MBB.erase(MBBI);
|
||||
return true;
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ void Thumb1FrameLowering::emitEpilogue(MachineFunction &MF,
|
||||
BuildMI(MBB, MBBI, dl, TII.get(ARM::tBX_RET_vararg))
|
||||
.addReg(ARM::R3, RegState::Kill);
|
||||
AddDefaultPred(MIB);
|
||||
MIB->copyImplicitOps(&*MBBI);
|
||||
MIB.copyImplicitOps(&*MBBI);
|
||||
// erase the old tBX_RET instruction
|
||||
MBB.erase(MBBI);
|
||||
}
|
||||
@ -352,7 +352,7 @@ restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
continue;
|
||||
Reg = ARM::PC;
|
||||
(*MIB).setDesc(TII.get(ARM::tPOP_RET));
|
||||
MIB->copyImplicitOps(&*MI);
|
||||
MIB.copyImplicitOps(&*MI);
|
||||
MI = MBB.erase(MI);
|
||||
}
|
||||
MIB.addReg(Reg, getDefRegState(true));
|
||||
|
@ -1138,7 +1138,7 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
|
||||
}
|
||||
|
||||
MachineInstr *NewMI = prior(MBBI);
|
||||
NewMI->copyImplicitOps(MBBI);
|
||||
NewMI->copyImplicitOps(MF, MBBI);
|
||||
|
||||
// Delete the pseudo instruction TCRETURN.
|
||||
MBB.erase(MBBI);
|
||||
|
Loading…
Reference in New Issue
Block a user