mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
use register iterators that include self to reduce code duplication in CriticalAntiDepBreaker
This patch addresses 2 FIXME comments that I added to CriticalAntiDepBreaker while fixing PR20020. Initialize an MCSubRegIterator and an MCRegAliasIterator to include the self reg. Assuming that works as advertised, there should be functional difference with this patch, just less code. Also, remove the associated asserts - we're setting those values just before, so the asserts don't do anything meaningful. Differential Revision: http://reviews.llvm.org/D4566 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214973 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ec4188bad7
commit
72a8b11fea
@ -262,19 +262,10 @@ void CriticalAntiDepBreaker::ScanInstruction(MachineInstr *MI,
|
||||
// Ignore two-addr defs.
|
||||
if (MI->isRegTiedToUseOperand(i)) continue;
|
||||
|
||||
// FIXME: we should use a SubRegIterator that includes self (as above), so
|
||||
// we don't have to repeat all this code for the reg itself.
|
||||
DefIndices[Reg] = Count;
|
||||
KillIndices[Reg] = ~0u;
|
||||
assert(((KillIndices[Reg] == ~0u) !=
|
||||
(DefIndices[Reg] == ~0u)) &&
|
||||
"Kill and Def maps aren't consistent for Reg!");
|
||||
KeepRegs.reset(Reg);
|
||||
Classes[Reg] = nullptr;
|
||||
RegRefs.erase(Reg);
|
||||
// Repeat, for all subregs.
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs) {
|
||||
unsigned SubregReg = *SubRegs;
|
||||
// For the reg itself and all subregs: update the def to current;
|
||||
// reset the kill state, any restrictions, and references.
|
||||
for (MCSubRegIterator SRI(Reg, TRI, true); SRI.isValid(); ++SRI) {
|
||||
unsigned SubregReg = *SRI;
|
||||
DefIndices[SubregReg] = Count;
|
||||
KillIndices[SubregReg] = ~0u;
|
||||
KeepRegs.reset(SubregReg);
|
||||
@ -306,19 +297,9 @@ void CriticalAntiDepBreaker::ScanInstruction(MachineInstr *MI,
|
||||
|
||||
RegRefs.insert(std::make_pair(Reg, &MO));
|
||||
|
||||
// FIXME: we should use an MCRegAliasIterator that includes self so we don't
|
||||
// have to repeat all this code for the reg itself.
|
||||
|
||||
// It wasn't previously live but now it is, this is a kill.
|
||||
if (KillIndices[Reg] == ~0u) {
|
||||
KillIndices[Reg] = Count;
|
||||
DefIndices[Reg] = ~0u;
|
||||
assert(((KillIndices[Reg] == ~0u) !=
|
||||
(DefIndices[Reg] == ~0u)) &&
|
||||
"Kill and Def maps aren't consistent for Reg!");
|
||||
}
|
||||
// Repeat, for all aliases.
|
||||
for (MCRegAliasIterator AI(Reg, TRI, false); AI.isValid(); ++AI) {
|
||||
// Repeat for all aliases.
|
||||
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
|
||||
unsigned AliasReg = *AI;
|
||||
if (KillIndices[AliasReg] == ~0u) {
|
||||
KillIndices[AliasReg] = Count;
|
||||
|
Loading…
Reference in New Issue
Block a user