Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 //
7 #ifndef ForLoopUnroll_h
8 #define ForLoopUnroll_h
10 #include "compiler/intermediate.h"
12 struct TLoopIndexInfo {
13 int id;
14 int initValue;
15 int stopValue;
16 int incrementValue;
17 TOperator op;
18 int currentValue;
19 };
21 class ForLoopUnroll {
22 public:
23 ForLoopUnroll() { }
25 void FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info);
27 // Update the info.currentValue for the next loop iteration.
28 void Step();
30 // Return false if loop condition is no longer satisfied.
31 bool SatisfiesLoopCondition();
33 // Check if the symbol is the index of a loop that's unrolled.
34 bool NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol);
36 // Return the current value of a given loop index symbol.
37 int GetLoopIndexValue(TIntermSymbol* symbol);
39 void Push(TLoopIndexInfo& info);
40 void Pop();
42 static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode* root);
44 private:
45 int getLoopIncrement(TIntermLoop* node);
47 int evaluateIntConstant(TIntermConstantUnion* node);
49 TVector<TLoopIndexInfo> mLoopIndexStack;
50 };
52 #endif