diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-16 16:21:27 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-16 16:21:27 +0000 |
commit | 3688ea5c7d352bc1f757fdf5bc8391953a032b5f (patch) | |
tree | 1ec0e06aee4b7781e3f19868a206c68ffe6fab12 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 6e24033bd2bc957e174dac20817fd777d1bfb1c8 (diff) | |
download | bcm5719-llvm-3688ea5c7d352bc1f757fdf5bc8391953a032b5f.tar.gz bcm5719-llvm-3688ea5c7d352bc1f757fdf5bc8391953a032b5f.zip |
Move SCEVNAryExpr's virtual member functions out of line, and convert
them to iterators.
llvm-svn: 111140
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index f56151e62f8..73bc8b17276 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -271,6 +271,39 @@ bool SCEVNAryExpr::properlyDominates(BasicBlock *BB, DominatorTree *DT) const { return true; } +bool SCEVNAryExpr::isLoopInvariant(const Loop *L) const { + for (op_iterator I = op_begin(), E = op_end(); I != E; ++I) + if (!(*I)->isLoopInvariant(L)) + return false; + return true; +} + +// hasComputableLoopEvolution - N-ary expressions have computable loop +// evolutions iff they have at least one operand that varies with the loop, +// but that all varying operands are computable. +bool SCEVNAryExpr::hasComputableLoopEvolution(const Loop *L) const { + bool HasVarying = false; + for (op_iterator I = op_begin(), E = op_end(); I != E; ++I) { + const SCEV *S = *I; + if (!S->isLoopInvariant(L)) { + if (S->hasComputableLoopEvolution(L)) + HasVarying = true; + else + return false; + } + } + return HasVarying; +} + +bool SCEVNAryExpr::hasOperand(const SCEV *O) const { + for (op_iterator I = op_begin(), E = op_end(); I != E; ++I) { + const SCEV *S = *I; + if (O == S || S->hasOperand(O)) + return true; + } + return false; +} + bool SCEVUDivExpr::dominates(BasicBlock *BB, DominatorTree *DT) const { return LHS->dominates(BB, DT) && RHS->dominates(BB, DT); } |