mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
[C++11] Add NArySCEV->Operands iterator range
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208158 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
111454f4e9
commit
a1f8bd6753
@ -14,6 +14,7 @@
|
||||
#ifndef LLVM_ANALYSIS_SCALAREVOLUTIONEXPRESSIONS_H
|
||||
#define LLVM_ANALYSIS_SCALAREVOLUTIONEXPRESSIONS_H
|
||||
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/Analysis/ScalarEvolution.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
@ -151,8 +152,12 @@ namespace llvm {
|
||||
}
|
||||
|
||||
typedef const SCEV *const *op_iterator;
|
||||
typedef iterator_range<op_iterator> op_range;
|
||||
op_iterator op_begin() const { return Operands; }
|
||||
op_iterator op_end() const { return Operands + NumOperands; }
|
||||
op_range operands() const {
|
||||
return make_range(op_begin(), op_end());
|
||||
}
|
||||
|
||||
Type *getType() const { return getOperand(0)->getType(); }
|
||||
|
||||
|
@ -1098,11 +1098,10 @@ static const SCEV *getPreStartForSignExtend(const SCEVAddRecExpr *AR,
|
||||
// subtraction is expensive. For this purpose, perform a quick and dirty
|
||||
// difference, by checking for Step in the operand list.
|
||||
SmallVector<const SCEV *, 4> DiffOps;
|
||||
for (SCEVAddExpr::op_iterator I = SA->op_begin(), E = SA->op_end();
|
||||
I != E; ++I) {
|
||||
if (*I != Step)
|
||||
DiffOps.push_back(*I);
|
||||
}
|
||||
for (const SCEV *Op : SA->operands())
|
||||
if (Op != Step)
|
||||
DiffOps.push_back(Op);
|
||||
|
||||
if (DiffOps.size() == SA->getNumOperands())
|
||||
return nullptr;
|
||||
|
||||
@ -1341,9 +1340,8 @@ const SCEV *ScalarEvolution::getAnyExtendExpr(const SCEV *Op,
|
||||
// Force the cast to be folded into the operands of an addrec.
|
||||
if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(Op)) {
|
||||
SmallVector<const SCEV *, 4> Ops;
|
||||
for (SCEVAddRecExpr::op_iterator I = AR->op_begin(), E = AR->op_end();
|
||||
I != E; ++I)
|
||||
Ops.push_back(getAnyExtendExpr(*I, Ty));
|
||||
for (const SCEV *Op : AR->operands())
|
||||
Ops.push_back(getAnyExtendExpr(Op, Ty));
|
||||
return getAddRecExpr(Ops, AR->getLoop(), SCEV::FlagNW);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user