5#ifndef RUNTIME_VM_COMPILER_BACKEND_LOOPS_H_
6#define RUNTIME_VM_COMPILER_BACKEND_LOOPS_H_
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
78 if (kind_ == other->kind_) {
141 return x !=
nullptr &&
x->kind_ ==
kInvariant &&
x->mult_ == 0;
155 return x !=
nullptr &&
x->kind_ ==
kLinear;
198 bool CanComputeBoundsImpl(LoopInfo* loop,
204 GrowableArray<Bound> bounds_;
251 intptr_t
id()
const {
return id_; }
277 std::pair<InductionVar*, InductionVar*>>
279 MemoVal() : memo_() {}
282 typedef RawPointerKeyValueTrait<InductionVar, MemoVal*> MemoKV;
289 BlockEntryInstr* header_;
296 GrowableArray<BlockEntryInstr*> back_edges_;
299 DirectChainedHashMap<InductionKV> induction_;
303 DirectChainedHashMap<MemoKV> memo_cache_;
308 ConstraintInstr* limit_;
335 intptr_t
num_loops()
const {
return headers_->length(); }
347 const bool print_traces_;
bool CanComputeBounds(LoopInfo *loop, Instruction *pos, InductionVar **min, InductionVar **max)
bool CanComputeDifferenceWith(const InductionVar *other, int64_t *diff) const
const GrowableArray< Bound > & bounds()
static bool IsLinear(const InductionVar *x, int64_t *s)
static bool IsWrapAround(const InductionVar *x)
static bool IsPeriodic(const InductionVar *x)
bool IsEqual(const InductionVar *other) const
InductionVar(int64_t offset)
static bool IsInvariant(const InductionVar *x)
static bool IsInduction(const InductionVar *x)
InductionVar * next() const
static bool IsConstant(const InductionVar *x, int64_t *c)
static bool IsConstant(const InductionVar *x)
InductionVar * initial() const
const char * ToCString() const
void PrintTo(BaseTextBuffer *f) const
InductionVar(Kind kind, InductionVar *initial, InductionVar *next)
static bool IsLinear(const InductionVar *x)
InductionVar(int64_t offset, int64_t mult, Definition *def)
intptr_t num_loops() const
const ZoneGrowableArray< BlockEntryInstr * > & headers() const
void ComputeInduction() const
LoopHierarchy(ZoneGrowableArray< BlockEntryInstr * > *headers, const GrowableArray< BlockEntryInstr * > &preorder, bool print_traces)
bool IsHeaderPhi(Definition *def) const
ConstraintInstr * limit() const
InductionVar * LookupInduction(Definition *def) const
void PrintTo(BaseTextBuffer *f) const
bool IsAlwaysTaken(BlockEntryInstr *block) const
void AddInduction(Definition *def, InductionVar *induc)
bool IsIn(LoopInfo *loop) const
bool IsInRange(Instruction *pos, Value *index, Value *length)
BitVector * blocks() const
void AddBlocks(BitVector *blocks)
const GrowableArray< BlockEntryInstr * > & back_edges()
bool Contains(BlockEntryInstr *block) const
friend class InductionVar
BlockEntryInstr * header() const
intptr_t NestingDepth() const
InductionVar * control() const
const char * ToCString() const
bool IsBackEdge(BlockEntryInstr *block) const
LoopInfo(intptr_t id, BlockEntryInstr *header, BitVector *blocks)
void AddBackEdge(BlockEntryInstr *block)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
Bound(BranchInstr *b, InductionVar *l)