mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-24 13:18:17 +00:00
Restrict LDA to affine subscripts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77932 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "llvm/Analysis/LoopDependenceAnalysis.h"
|
||||
#include "llvm/Analysis/LoopPass.h"
|
||||
#include "llvm/Analysis/ScalarEvolution.h"
|
||||
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Operator.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
@@ -123,6 +124,18 @@ bool LoopDependenceAnalysis::findOrInsertDependencePair(Value *A,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LoopDependenceAnalysis::isLoopInvariant(const SCEV *S) const {
|
||||
for (const Loop *L = this->L; L != 0; L = L->getParentLoop())
|
||||
if (!S->isLoopInvariant(L))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoopDependenceAnalysis::isAffine(const SCEV *S) const {
|
||||
const SCEVAddRecExpr *rec = dyn_cast<SCEVAddRecExpr>(S);
|
||||
return isLoopInvariant(S) || (rec && rec->isAffine());
|
||||
}
|
||||
|
||||
LoopDependenceAnalysis::DependenceResult
|
||||
LoopDependenceAnalysis::analyseSubscript(const SCEV *A,
|
||||
const SCEV *B,
|
||||
@@ -134,6 +147,11 @@ LoopDependenceAnalysis::analyseSubscript(const SCEV *A,
|
||||
return Dependent;
|
||||
}
|
||||
|
||||
if (!isAffine(A) || !isAffine(B)) {
|
||||
DEBUG(errs() << " -> [?] not affine\n");
|
||||
return Unknown;
|
||||
}
|
||||
|
||||
// TODO: Implement ZIV/SIV/MIV testers.
|
||||
|
||||
DEBUG(errs() << " -> [?] cannot analyse subscript\n");
|
||||
|
||||
Reference in New Issue
Block a user