zenilib: zenilib/jni/external/angle/src/compiler/ForLoopUnroll.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ForLoopUnroll.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6
7 #include "compiler/intermediate.h"
8
9 struct TLoopIndexInfo {
10 int id;
11 int initValue;
12 int stopValue;
13 int incrementValue;
14 TOperator op;
15 int currentValue;
16 };
17
18 class ForLoopUnroll {
19 public:
20 ForLoopUnroll() { }
21
22 void FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info);
23
24 // Update the info.currentValue for the next loop iteration.
25 void Step();
26
27 // Return false if loop condition is no longer satisfied.
28 bool SatisfiesLoopCondition();
29
30 // Check if the symbol is the index of a loop that's unrolled.
31 bool NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol);
32
33 // Return the current value of a given loop index symbol.
34 int GetLoopIndexValue(TIntermSymbol* symbol);
35
36 void Push(TLoopIndexInfo& info);
37 void Pop();
38
39 static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode* root);
40
41 private:
42 int getLoopIncrement(TIntermLoop* node);
43
44 int evaluateIntConstant(TIntermConstantUnion* node);
45
46 TVector<TLoopIndexInfo> mLoopIndexStack;
47 };
48
TOperator
TOperator
Definition: intermediate.h:29
ForLoopUnroll::ForLoopUnroll
ForLoopUnroll()
Definition: ForLoopUnroll.h:20
ForLoopUnroll::Pop
void Pop()
Definition: ForLoopUnroll.cpp:140
intermediate.h
TLoopIndexInfo::stopValue
int stopValue
Definition: ForLoopUnroll.h:12
TLoopIndexInfo::currentValue
int currentValue
Definition: ForLoopUnroll.h:15
ForLoopUnroll::FillLoopIndexInfo
void FillLoopIndexInfo(TIntermLoop *node, TLoopIndexInfo &info)
Definition: ForLoopUnroll.cpp:42
TLoopIndexInfo::initValue
int initValue
Definition: ForLoopUnroll.h:11
ForLoopUnroll::GetLoopIndexValue
int GetLoopIndexValue(TIntermSymbol *symbol)
Definition: ForLoopUnroll.cpp:123
ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling
static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode *root)
Definition: ForLoopUnroll.cpp:146
TLoopIndexInfo::op
TOperator op
Definition: ForLoopUnroll.h:14
TLoopIndexInfo::id
int id
Definition: ForLoopUnroll.h:10
TLoopIndexInfo
Definition: ForLoopUnroll.h:9
TIntermSymbol
Definition: intermediate.h:340
TIntermLoop
Definition: intermediate.h:284
ForLoopUnroll::Push
void Push(TLoopIndexInfo &info)
Definition: ForLoopUnroll.cpp:135
TVector< TLoopIndexInfo >
TIntermNode
Definition: intermediate.h:206
ForLoopUnroll::Step
void Step()
Definition: ForLoopUnroll.cpp:81
ForLoopUnroll::SatisfiesLoopCondition
bool SatisfiesLoopCondition()
Definition: ForLoopUnroll.cpp:88
ForLoopUnroll
Definition: ForLoopUnroll.h:18
ForLoopUnroll::NeedsToReplaceSymbolWithValue
bool NeedsToReplaceSymbolWithValue(TIntermSymbol *symbol)
Definition: ForLoopUnroll.cpp:112
TIntermConstantUnion
Definition: intermediate.h:365
TLoopIndexInfo::incrementValue
int incrementValue
Definition: ForLoopUnroll.h:13