mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 06:32:24 +00:00
Properly handle reloading and spilling around partial redefines in
LocalRewriter. This is a bit of a hack that adds an implicit use operand to model the read-modify-write nature of a partial redef. Uses and defs are rewritten in separate passes, and a single operand would never be processed twice. <rdar://problem/8518892> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116210 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ffa0e71c33
commit
40ef4fe82a
@ -1894,6 +1894,20 @@ void LocalRewriter::ProcessUses(MachineInstr &MI, AvailableSpills &Spills,
|
||||
VirtUseOps.insert(VirtUseOps.begin(), i);
|
||||
else
|
||||
VirtUseOps.push_back(i);
|
||||
|
||||
// A partial def causes problems because the same operand both reads and
|
||||
// writes the register. This rewriter is designed to rewrite uses and defs
|
||||
// separately, so a partial def would already have been rewritten to a
|
||||
// physreg by the time we get to processing defs.
|
||||
// Add an implicit use operand to model the partial def.
|
||||
if (MO.isDef() && MO.getSubReg() && MI.readsVirtualRegister(VirtReg) &&
|
||||
MI.findRegisterUseOperandIdx(VirtReg) == -1) {
|
||||
VirtUseOps.insert(VirtUseOps.begin(), MI.getNumOperands());
|
||||
MI.addOperand(MachineOperand::CreateReg(VirtReg,
|
||||
false, // isDef
|
||||
true)); // isImplicit
|
||||
DEBUG(dbgs() << "Partial redef: " << MI);
|
||||
}
|
||||
}
|
||||
|
||||
// Process all of the spilled uses and all non spilled reg references.
|
||||
|
Loading…
x
Reference in New Issue
Block a user