mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
Add some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3902f9fca8
commit
6a83271532
@ -1932,20 +1932,25 @@ void LSRInstance::DeleteUse(LSRUse &LU) {
|
||||
LSRUse *
|
||||
LSRInstance::FindUseWithSimilarFormula(const Formula &OrigF,
|
||||
const LSRUse &OrigLU) {
|
||||
// Search all uses for the formula. This could be more clever. Ignore
|
||||
// ICmpZero uses because they may contain formulae generated by
|
||||
// GenerateICmpZeroScales, in which case adding fixup offsets may
|
||||
// be invalid.
|
||||
// Search all uses for the formula. This could be more clever.
|
||||
for (size_t LUIdx = 0, NumUses = Uses.size(); LUIdx != NumUses; ++LUIdx) {
|
||||
LSRUse &LU = Uses[LUIdx];
|
||||
// Check whether this use is close enough to OrigLU, to see whether it's
|
||||
// worthwhile looking through its formulae.
|
||||
// Ignore ICmpZero uses because they may contain formulae generated by
|
||||
// GenerateICmpZeroScales, in which case adding fixup offsets may
|
||||
// be invalid.
|
||||
if (&LU != &OrigLU &&
|
||||
LU.Kind != LSRUse::ICmpZero &&
|
||||
LU.Kind == OrigLU.Kind && OrigLU.AccessTy == LU.AccessTy &&
|
||||
LU.WidestFixupType == OrigLU.WidestFixupType &&
|
||||
LU.HasFormulaWithSameRegs(OrigF)) {
|
||||
// Scan through this use's formulae.
|
||||
for (SmallVectorImpl<Formula>::const_iterator I = LU.Formulae.begin(),
|
||||
E = LU.Formulae.end(); I != E; ++I) {
|
||||
const Formula &F = *I;
|
||||
// Check to see if this formula has the same registers and symbols
|
||||
// as OrigF.
|
||||
if (F.BaseRegs == OrigF.BaseRegs &&
|
||||
F.ScaledReg == OrigF.ScaledReg &&
|
||||
F.AM.BaseGV == OrigF.AM.BaseGV &&
|
||||
@ -1953,12 +1958,16 @@ LSRInstance::FindUseWithSimilarFormula(const Formula &OrigF,
|
||||
LU.Kind) {
|
||||
if (F.AM.BaseOffs == 0)
|
||||
return &LU;
|
||||
// This is the formula where all the registers and symbols matched;
|
||||
// there aren't going to be any others. Since we declined it, we
|
||||
// can skip the rest of the formulae and procede to the next LSRUse.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing looked good.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user