mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Correctly update def/use information for modified machine operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11087 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
782ce955b2
commit
eea81bafd6
@ -146,11 +146,17 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
|
||||
LV.addVirtualRegisterDead(regB, &*mbbi, prevMi);
|
||||
|
||||
// replace all occurences of regB with regA
|
||||
// and mark all uses and defs of regA as def&use
|
||||
for (unsigned i = 1; i < mi->getNumOperands(); ++i) {
|
||||
if (mi->getOperand(i).isRegister() &&
|
||||
mi->getOperand(i).getReg() == regB)
|
||||
mi->SetMachineOperandReg(i, regA);
|
||||
MachineOperand& op = mi->getOperand(i);
|
||||
if (op.isRegister()) {
|
||||
if (op.getReg() == regB)
|
||||
mi->SetMachineOperandReg(i, regA);
|
||||
if (op.getReg() == regA)
|
||||
op.setDef().setUse();
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(std::cerr << "\t\tmodified original to: ";
|
||||
mi->print(std::cerr, TM));
|
||||
assert(mi->getOperand(0).getAllocatedRegNum() ==
|
||||
|
Loading…
Reference in New Issue
Block a user