-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathInductionVariable.h
52 lines (42 loc) · 1.5 KB
/
InductionVariable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
class InductionVariable;
typedef JsUtil::BaseHashSet<InductionVariable, JitArenaAllocator, PowerOf2SizePolicy, SymID> InductionVariableSet;
class InductionVariable
{
public:
static const int ChangeMagnitudeLimitForLoopCountBasedHoisting;
private:
StackSym *sym;
ValueNumber symValueNumber;
IntConstantBounds changeBounds;
bool isChangeDeterminate;
public:
InductionVariable();
InductionVariable(StackSym *const sym, const ValueNumber symValueNumber, const int change);
#if DBG
private:
bool IsValid() const;
#endif
public:
StackSym *Sym() const;
ValueNumber SymValueNumber() const;
void SetSymValueNumber(const ValueNumber symValueNumber);
bool IsChangeDeterminate() const;
void SetChangeIsIndeterminate();
const IntConstantBounds &ChangeBounds() const;
bool IsChangeUnidirectional() const;
public:
bool Add(const int n);
void ExpandInnerLoopChange();
public:
void Merge(const InductionVariable &other);
};
template<>
inline SymID JsUtil::ValueToKey<SymID, InductionVariable>::ToKey(const InductionVariable &inductionVariable)
{
return inductionVariable.Sym()->m_id;
}