mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
[InstrInfo] Refactor foldOperandImpl to thread through InsertPt. NFC
Summary: This was a longstanding FIXME and is a necessary precursor to cases where foldOperandImpl may have to create more than one instruction (e.g. to constrain a register class). This is the split out NFC changes from D6262. Reviewers: pete, ributzka, uweigand, mcrosier Reviewed By: mcrosier Subscribers: mcrosier, ted, llvm-commits Differential Revision: http://reviews.llvm.org/D10174 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239336 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -471,11 +471,13 @@ MachineInstr *TargetInstrInfo::foldMemoryOperand(MachineBasicBlock::iterator MI,
|
||||
MI->getOpcode() == TargetOpcode::PATCHPOINT) {
|
||||
// Fold stackmap/patchpoint.
|
||||
NewMI = foldPatchpoint(MF, MI, Ops, FI, *this);
|
||||
if (NewMI)
|
||||
MBB->insert(MI, NewMI);
|
||||
} else {
|
||||
// Ask the target to do the actual folding.
|
||||
NewMI =foldMemoryOperandImpl(MF, MI, Ops, FI);
|
||||
NewMI = foldMemoryOperandImpl(MF, MI, Ops, MI, FI);
|
||||
}
|
||||
|
||||
|
||||
if (NewMI) {
|
||||
NewMI->setMemRefs(MI->memoperands_begin(), MI->memoperands_end());
|
||||
// Add a memory operand, foldMemoryOperandImpl doesn't do that.
|
||||
@ -493,8 +495,7 @@ MachineInstr *TargetInstrInfo::foldMemoryOperand(MachineBasicBlock::iterator MI,
|
||||
MFI.getObjectAlignment(FI));
|
||||
NewMI->addMemOperand(MF, MMO);
|
||||
|
||||
// FIXME: change foldMemoryOperandImpl semantics to also insert NewMI.
|
||||
return MBB->insert(MI, NewMI);
|
||||
return NewMI;
|
||||
}
|
||||
|
||||
// Straight COPY may fold as load/store.
|
||||
@ -539,15 +540,15 @@ MachineInstr *TargetInstrInfo::foldMemoryOperand(MachineBasicBlock::iterator MI,
|
||||
isLoadFromStackSlot(LoadMI, FrameIndex)) {
|
||||
// Fold stackmap/patchpoint.
|
||||
NewMI = foldPatchpoint(MF, MI, Ops, FrameIndex, *this);
|
||||
if (NewMI)
|
||||
NewMI = MBB.insert(MI, NewMI);
|
||||
} else {
|
||||
// Ask the target to do the actual folding.
|
||||
NewMI = foldMemoryOperandImpl(MF, MI, Ops, LoadMI);
|
||||
NewMI = foldMemoryOperandImpl(MF, MI, Ops, MI, LoadMI);
|
||||
}
|
||||
|
||||
if (!NewMI) return nullptr;
|
||||
|
||||
NewMI = MBB.insert(MI, NewMI);
|
||||
|
||||
// Copy the memoperands from the load to the folded instruction.
|
||||
if (MI->memoperands_empty()) {
|
||||
NewMI->setMemRefs(LoadMI->memoperands_begin(),
|
||||
|
Reference in New Issue
Block a user