mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
ARM load/store optimizer: Compute BaseKill correctly.
This adds some code back that was deleted in r92053. The location of the last merged memory operation needs to be kept up-to-date since MemOps may be in a different order to the original instruction stream to allow merging (since registers need to be in ascending order). Also simplify the logic to determine BaseKill using findRegisterUseOperandIdx to use an equivalent function call instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215728 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7b0f4a82d4
commit
713d9cbc3e
@ -721,7 +721,7 @@ ARMLoadStoreOpt::MergeLDR_STR(MachineBasicBlock &MBB, unsigned SIndex,
|
|||||||
unsigned PRegNum = PMO.isUndef() ? UINT_MAX : TRI->getEncodingValue(PReg);
|
unsigned PRegNum = PMO.isUndef() ? UINT_MAX : TRI->getEncodingValue(PReg);
|
||||||
unsigned Count = 1;
|
unsigned Count = 1;
|
||||||
unsigned Limit = ~0U;
|
unsigned Limit = ~0U;
|
||||||
|
bool BaseKill = false;
|
||||||
// vldm / vstm limit are 32 for S variants, 16 for D variants.
|
// vldm / vstm limit are 32 for S variants, 16 for D variants.
|
||||||
|
|
||||||
switch (Opcode) {
|
switch (Opcode) {
|
||||||
@ -760,18 +760,24 @@ ARMLoadStoreOpt::MergeLDR_STR(MachineBasicBlock &MBB, unsigned SIndex,
|
|||||||
++Count;
|
++Count;
|
||||||
} else {
|
} else {
|
||||||
// Can't merge this in. Try merge the earlier ones first.
|
// Can't merge this in. Try merge the earlier ones first.
|
||||||
MergeOpsUpdate(MBB, MemOps, SIndex, i, insertAfter, SOffset,
|
// We need to compute BaseKill here because the MemOps may have been
|
||||||
Base, false, Opcode, Pred, PredReg, Scratch, dl, Merges);
|
// reordered.
|
||||||
|
BaseKill = Loc->killsRegister(Base);
|
||||||
|
|
||||||
|
MergeOpsUpdate(MBB, MemOps, SIndex, i, insertAfter, SOffset, Base,
|
||||||
|
BaseKill, Opcode, Pred, PredReg, Scratch, dl, Merges);
|
||||||
MergeLDR_STR(MBB, i, Base, Opcode, Size, Pred, PredReg, Scratch,
|
MergeLDR_STR(MBB, i, Base, Opcode, Size, Pred, PredReg, Scratch,
|
||||||
MemOps, Merges);
|
MemOps, Merges);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MemOps[i].Position > MemOps[insertAfter].Position)
|
if (MemOps[i].Position > MemOps[insertAfter].Position) {
|
||||||
insertAfter = i;
|
insertAfter = i;
|
||||||
|
Loc = MemOps[i].MBBI;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseKill = Loc->findRegisterUseOperandIdx(Base, true) != -1;
|
BaseKill = Loc->killsRegister(Base);
|
||||||
MergeOpsUpdate(MBB, MemOps, SIndex, MemOps.size(), insertAfter, SOffset,
|
MergeOpsUpdate(MBB, MemOps, SIndex, MemOps.size(), insertAfter, SOffset,
|
||||||
Base, BaseKill, Opcode, Pred, PredReg, Scratch, dl, Merges);
|
Base, BaseKill, Opcode, Pred, PredReg, Scratch, dl, Merges);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user