blob: 1208b07957dbf1cfb76a528ecdc1793b6a6718ac [file] [log] [blame]
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +00001//
2// Copyright (c) 2002-2010 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//
8// Definition of the in-memory high-level intermediate representation
9// of shaders. This is a tree that parser creates.
10//
11// Nodes in the tree are defined as a hierarchy of classes derived from
12// TIntermNode. Each is a node in a tree. There is no preset branching factor;
13// each node can have it's own type of list of children.
14//
15
16#ifndef __INTERMEDIATE_H
17#define __INTERMEDIATE_H
18
daniel@transgaming.combbf56f72010-04-20 18:52:13 +000019#include "compiler/Common.h"
20#include "compiler/Types.h"
21#include "compiler/ConstantUnion.h"
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000022
23//
24// Operators used by the high-level (parse tree) representation.
25//
26enum TOperator {
alokp@chromium.org2cf17712010-03-30 20:33:18 +000027 EOpNull, // if in a node, should only mean a node is still being built
28 EOpSequence, // denotes a list of statements, or parameters, etc.
29 EOpFunctionCall,
30 EOpFunction, // For function definition
31 EOpParameters, // an aggregate listing the parameters to a function
daniel@transgaming.comd1acd1e2010-04-13 03:25:57 +000032
alokp@chromium.org2cf17712010-03-30 20:33:18 +000033 EOpDeclaration,
daniel@transgaming.comd1acd1e2010-04-13 03:25:57 +000034 EOpPrototype,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000035
alokp@chromium.org2cf17712010-03-30 20:33:18 +000036 //
37 // Unary operators
38 //
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000039
alokp@chromium.org2cf17712010-03-30 20:33:18 +000040 EOpNegative,
41 EOpLogicalNot,
42 EOpVectorLogicalNot,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000043
alokp@chromium.org2cf17712010-03-30 20:33:18 +000044 EOpPostIncrement,
45 EOpPostDecrement,
46 EOpPreIncrement,
47 EOpPreDecrement,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000048
alokp@chromium.org2cf17712010-03-30 20:33:18 +000049 EOpConvIntToBool,
50 EOpConvFloatToBool,
51 EOpConvBoolToFloat,
52 EOpConvIntToFloat,
53 EOpConvFloatToInt,
54 EOpConvBoolToInt,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000055
alokp@chromium.org2cf17712010-03-30 20:33:18 +000056 //
57 // binary operations
58 //
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000059
alokp@chromium.org2cf17712010-03-30 20:33:18 +000060 EOpAdd,
61 EOpSub,
62 EOpMul,
63 EOpDiv,
64 EOpEqual,
65 EOpNotEqual,
66 EOpVectorEqual,
67 EOpVectorNotEqual,
68 EOpLessThan,
69 EOpGreaterThan,
70 EOpLessThanEqual,
71 EOpGreaterThanEqual,
72 EOpComma,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000073
alokp@chromium.org2cf17712010-03-30 20:33:18 +000074 EOpVectorTimesScalar,
75 EOpVectorTimesMatrix,
76 EOpMatrixTimesVector,
77 EOpMatrixTimesScalar,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000078
alokp@chromium.org2cf17712010-03-30 20:33:18 +000079 EOpLogicalOr,
80 EOpLogicalXor,
81 EOpLogicalAnd,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000082
alokp@chromium.org2cf17712010-03-30 20:33:18 +000083 EOpIndexDirect,
84 EOpIndexIndirect,
85 EOpIndexDirectStruct,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000086
alokp@chromium.org2cf17712010-03-30 20:33:18 +000087 EOpVectorSwizzle,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000088
alokp@chromium.org2cf17712010-03-30 20:33:18 +000089 //
90 // Built-in functions potentially mapped to operators
91 //
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000092
alokp@chromium.org2cf17712010-03-30 20:33:18 +000093 EOpRadians,
94 EOpDegrees,
95 EOpSin,
96 EOpCos,
97 EOpTan,
98 EOpAsin,
99 EOpAcos,
100 EOpAtan,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000101
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000102 EOpPow,
103 EOpExp,
104 EOpLog,
105 EOpExp2,
106 EOpLog2,
107 EOpSqrt,
108 EOpInverseSqrt,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000109
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000110 EOpAbs,
111 EOpSign,
112 EOpFloor,
113 EOpCeil,
114 EOpFract,
115 EOpMod,
116 EOpMin,
117 EOpMax,
118 EOpClamp,
119 EOpMix,
120 EOpStep,
121 EOpSmoothStep,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000122
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000123 EOpLength,
124 EOpDistance,
125 EOpDot,
126 EOpCross,
127 EOpNormalize,
128 EOpFaceForward,
129 EOpReflect,
130 EOpRefract,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000131
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000132 //EOpDPdx, // Fragment only, OES_standard_derivatives extension
133 //EOpDPdy, // Fragment only, OES_standard_derivatives extension
134 //EOpFwidth, // Fragment only, OES_standard_derivatives extension
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000135
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000136 EOpMatrixTimesMatrix,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000137
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000138 EOpAny,
139 EOpAll,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000140
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000141 //
142 // Branch
143 //
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000144
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000145 EOpKill, // Fragment only
146 EOpReturn,
147 EOpBreak,
148 EOpContinue,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000149
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000150 //
151 // Constructors
152 //
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000153
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000154 EOpConstructInt,
155 EOpConstructBool,
156 EOpConstructFloat,
157 EOpConstructVec2,
158 EOpConstructVec3,
159 EOpConstructVec4,
160 EOpConstructBVec2,
161 EOpConstructBVec3,
162 EOpConstructBVec4,
163 EOpConstructIVec2,
164 EOpConstructIVec3,
165 EOpConstructIVec4,
166 EOpConstructMat2,
167 EOpConstructMat3,
168 EOpConstructMat4,
169 EOpConstructStruct,
170
171 //
172 // moves
173 //
174
175 EOpAssign,
176 EOpInitialize,
177 EOpAddAssign,
178 EOpSubAssign,
179 EOpMulAssign,
180 EOpVectorTimesMatrixAssign,
181 EOpVectorTimesScalarAssign,
182 EOpMatrixTimesScalarAssign,
183 EOpMatrixTimesMatrixAssign,
184 EOpDivAssign,
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000185};
186
187class TIntermTraverser;
188class TIntermAggregate;
189class TIntermBinary;
daniel@transgaming.com4a35ef22010-04-08 03:51:06 +0000190class TIntermUnary;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000191class TIntermConstantUnion;
192class TIntermSelection;
193class TIntermTyped;
194class TIntermSymbol;
195class TInfoSink;
196
197//
198// Base class for the tree nodes
199//
200class TIntermNode {
201public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000202 POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000203
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000204 TIntermNode() : line(0) {}
205 virtual TSourceLoc getLine() const { return line; }
206 virtual void setLine(TSourceLoc l) { line = l; }
207 virtual void traverse(TIntermTraverser*) = 0;
208 virtual TIntermTyped* getAsTyped() { return 0; }
209 virtual TIntermConstantUnion* getAsConstantUnion() { return 0; }
210 virtual TIntermAggregate* getAsAggregate() { return 0; }
211 virtual TIntermBinary* getAsBinaryNode() { return 0; }
daniel@transgaming.com4a35ef22010-04-08 03:51:06 +0000212 virtual TIntermUnary* getAsUnaryNode() { return 0; }
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000213 virtual TIntermSelection* getAsSelectionNode() { return 0; }
214 virtual TIntermSymbol* getAsSymbolNode() { return 0; }
215 virtual ~TIntermNode() { }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000216protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000217 TSourceLoc line;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000218};
219
220//
221// This is just to help yacc.
222//
223struct TIntermNodePair {
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000224 TIntermNode* node1;
225 TIntermNode* node2;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000226};
227
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000228//
229// Intermediate class for nodes that have a type.
230//
231class TIntermTyped : public TIntermNode {
232public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000233 TIntermTyped(const TType& t) : type(t) { }
234 virtual TIntermTyped* getAsTyped() { return this; }
235 virtual void setType(const TType& t) { type = t; }
236 virtual const TType& getType() const { return type; }
237 virtual TType* getTypePointer() { return &type; }
alokp@chromium.orgdd037b22010-03-30 18:47:20 +0000238
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000239 virtual TBasicType getBasicType() const { return type.getBasicType(); }
240 virtual TQualifier getQualifier() const { return type.getQualifier(); }
241 virtual int getNominalSize() const { return type.getNominalSize(); }
242 virtual int getSize() const { return type.getInstanceSize(); }
243 virtual bool isMatrix() const { return type.isMatrix(); }
244 virtual bool isArray() const { return type.isArray(); }
245 virtual bool isVector() const { return type.isVector(); }
daniel@transgaming.comd91cfe72010-04-13 03:26:17 +0000246 virtual bool isScalar() const { return type.isScalar(); }
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000247 const char* getBasicString() const { return type.getBasicString(); }
248 const char* getQualifierString() const { return type.getQualifierString(); }
249 TString getCompleteString() const { return type.getCompleteString(); }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000250
251protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000252 TType type;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000253};
254
255//
256// Handle for, do-while, and while loops.
257//
258class TIntermLoop : public TIntermNode {
259public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000260 TIntermLoop(TIntermNode *init, TIntermNode* aBody, TIntermTyped* aTest, TIntermTyped* aTerminal, bool testFirst) :
261 init(init),
262 body(aBody),
263 test(aTest),
264 terminal(aTerminal),
265 first(testFirst) { }
266 virtual void traverse(TIntermTraverser*);
267 TIntermNode *getInit() { return init; }
268 TIntermNode *getBody() { return body; }
269 TIntermTyped *getTest() { return test; }
270 TIntermTyped *getTerminal() { return terminal; }
271 bool testFirst() { return first; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000272protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000273 TIntermNode *init;
274 TIntermNode *body; // code to loop over
275 TIntermTyped *test; // exit condition associated with loop, could be 0 for 'for' loops
276 TIntermTyped *terminal; // exists for for-loops
277 bool first; // true for while and for, not for do-while
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000278};
279
280//
281// Handle break, continue, return, and kill.
282//
283class TIntermBranch : public TIntermNode {
284public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000285 TIntermBranch(TOperator op, TIntermTyped* e) :
286 flowOp(op),
287 expression(e) { }
288 virtual void traverse(TIntermTraverser*);
289 TOperator getFlowOp() { return flowOp; }
290 TIntermTyped* getExpression() { return expression; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000291protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000292 TOperator flowOp;
293 TIntermTyped* expression; // non-zero except for "return exp;" statements
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000294};
295
296//
297// Nodes that correspond to symbols or constants in the source code.
298//
299class TIntermSymbol : public TIntermTyped {
300public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000301 // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym. If sym comes from
302 // per process globalpoolallocator, then it causes increased memory usage per compile
303 // it is essential to use "symbol = sym" to assign to symbol
304 TIntermSymbol(int i, const TString& sym, const TType& t) :
305 TIntermTyped(t), id(i) { symbol = sym;}
306 virtual int getId() const { return id; }
307 virtual const TString& getSymbol() const { return symbol; }
308 virtual void traverse(TIntermTraverser*);
309 virtual TIntermSymbol* getAsSymbolNode() { return this; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000310protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000311 int id;
312 TString symbol;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000313};
314
315class TIntermConstantUnion : public TIntermTyped {
316public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000317 TIntermConstantUnion(constUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
318 constUnion* getUnionArrayPointer() const { return unionArrayPointer; }
319 void setUnionArrayPointer(constUnion *c) { unionArrayPointer = c; }
320 virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
321 virtual void traverse(TIntermTraverser* );
322 virtual TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000323protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000324 constUnion *unionArrayPointer;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000325};
326
327//
328// Intermediate class for node types that hold operators.
329//
330class TIntermOperator : public TIntermTyped {
331public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000332 TOperator getOp() const { return op; }
333 bool modifiesState() const;
334 bool isConstructor() const;
335 virtual bool promote(TInfoSink&) { return true; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000336protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000337 TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat)), op(o) {}
338 TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
339 TOperator op;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000340};
341
342//
343// Nodes for all the basic binary math operators.
344//
345class TIntermBinary : public TIntermOperator {
346public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000347 TIntermBinary(TOperator o) : TIntermOperator(o) {}
348 virtual void traverse(TIntermTraverser*);
349 virtual void setLeft(TIntermTyped* n) { left = n; }
350 virtual void setRight(TIntermTyped* n) { right = n; }
351 virtual TIntermTyped* getLeft() const { return left; }
352 virtual TIntermTyped* getRight() const { return right; }
353 virtual TIntermBinary* getAsBinaryNode() { return this; }
354 virtual bool promote(TInfoSink&);
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000355protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000356 TIntermTyped* left;
357 TIntermTyped* right;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000358};
359
360//
361// Nodes for unary math operators.
362//
363class TIntermUnary : public TIntermOperator {
364public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000365 TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}
366 TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}
367 virtual void traverse(TIntermTraverser*);
368 virtual void setOperand(TIntermTyped* o) { operand = o; }
369 virtual TIntermTyped* getOperand() { return operand; }
daniel@transgaming.com4a35ef22010-04-08 03:51:06 +0000370 virtual TIntermUnary* getAsUnaryNode() { return this; }
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000371 virtual bool promote(TInfoSink&);
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000372protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000373 TIntermTyped* operand;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000374};
375
376typedef TVector<TIntermNode*> TIntermSequence;
377typedef TVector<int> TQualifierList;
378//
379// Nodes that operate on an arbitrary sized set of children.
380//
381class TIntermAggregate : public TIntermOperator {
382public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000383 TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0) { }
384 TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { }
385 ~TIntermAggregate() { delete pragmaTable; }
386 virtual TIntermAggregate* getAsAggregate() { return this; }
387 virtual void setOperator(TOperator o) { op = o; }
388 virtual TIntermSequence& getSequence() { return sequence; }
389 virtual void setName(const TString& n) { name = n; }
390 virtual const TString& getName() const { return name; }
391 virtual void traverse(TIntermTraverser*);
392 virtual void setUserDefined() { userDefined = true; }
393 virtual bool isUserDefined() { return userDefined; }
394 virtual TQualifierList& getQualifier() { return qualifier; }
395 void setOptimize(bool o) { optimize = o; }
396 void setDebug(bool d) { debug = d; }
397 bool getOptimize() { return optimize; }
398 bool getDebug() { return debug; }
399 void addToPragmaTable(const TPragmaTable& pTable);
400 const TPragmaTable& getPragmaTable() const { return *pragmaTable; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000401protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000402 TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
403 TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
404 TIntermSequence sequence;
405 TQualifierList qualifier;
406 TString name;
407 bool userDefined; // used for user defined function names
408 bool optimize;
409 bool debug;
410 TPragmaTable *pragmaTable;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000411};
412
413//
414// For if tests. Simplified since there is no switch statement.
415//
416class TIntermSelection : public TIntermTyped {
417public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000418 TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) :
419 TIntermTyped(TType(EbtVoid)), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
420 TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) :
421 TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
422 virtual void traverse(TIntermTraverser*);
423 bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
424 virtual TIntermNode* getCondition() const { return condition; }
425 virtual TIntermNode* getTrueBlock() const { return trueBlock; }
426 virtual TIntermNode* getFalseBlock() const { return falseBlock; }
427 virtual TIntermSelection* getAsSelectionNode() { return this; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000428protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000429 TIntermTyped* condition;
430 TIntermNode* trueBlock;
431 TIntermNode* falseBlock;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000432};
433
434enum Visit
435{
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000436 PreVisit,
437 InVisit,
438 PostVisit
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000439};
440
441//
442// For traversing the tree. User should derive from this,
443// put their traversal specific data in it, and then pass
444// it to a Traverse method.
445//
446// When using this, just fill in the methods for nodes you want visited.
447// Return false from a pre-visit to skip visiting that node's subtree.
448//
449class TIntermTraverser
450{
451public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000452 POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000453
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000454 TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false) :
455 preVisit(preVisit),
456 inVisit(inVisit),
457 postVisit(postVisit),
458 rightToLeft(rightToLeft),
459 depth(0) {}
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000460
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000461 virtual void visitSymbol(TIntermSymbol*) {}
462 virtual void visitConstantUnion(TIntermConstantUnion*) {}
463 virtual bool visitBinary(Visit visit, TIntermBinary*) {return true;}
464 virtual bool visitUnary(Visit visit, TIntermUnary*) {return true;}
465 virtual bool visitSelection(Visit visit, TIntermSelection*) {return true;}
466 virtual bool visitAggregate(Visit visit, TIntermAggregate*) {return true;}
467 virtual bool visitLoop(Visit visit, TIntermLoop*) {return true;}
468 virtual bool visitBranch(Visit visit, TIntermBranch*) {return true;}
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000469
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000470 void incrementDepth() {depth++;}
471 void decrementDepth() {depth--;}
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000472
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000473 const bool preVisit;
474 const bool inVisit;
475 const bool postVisit;
476 const bool rightToLeft;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000477
478protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000479 int depth;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000480};
481
482#endif // __INTERMEDIATE_H