mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
Move SCEVNAryExpr's virtual member functions out of line, and convert
them to iterators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111140 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bb85409b51
commit
2f199f9952
@ -208,33 +208,14 @@ namespace llvm {
|
||||
op_iterator op_begin() const { return Operands; }
|
||||
op_iterator op_end() const { return Operands + NumOperands; }
|
||||
|
||||
virtual bool isLoopInvariant(const Loop *L) const {
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
|
||||
if (!getOperand(i)->isLoopInvariant(L)) return false;
|
||||
return true;
|
||||
}
|
||||
virtual bool isLoopInvariant(const Loop *L) const;
|
||||
|
||||
// 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.
|
||||
virtual bool hasComputableLoopEvolution(const Loop *L) const {
|
||||
bool HasVarying = false;
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
|
||||
if (!getOperand(i)->isLoopInvariant(L)) {
|
||||
if (getOperand(i)->hasComputableLoopEvolution(L))
|
||||
HasVarying = true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return HasVarying;
|
||||
}
|
||||
virtual bool hasComputableLoopEvolution(const Loop *L) const;
|
||||
|
||||
virtual bool hasOperand(const SCEV *O) const {
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
|
||||
if (O == getOperand(i) || getOperand(i)->hasOperand(O))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
virtual bool hasOperand(const SCEV *O) const;
|
||||
|
||||
bool dominates(BasicBlock *BB, DominatorTree *DT) const;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user