blob: 47cfc10555540e535ade9f906e4eb88c17207725 [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
19#include "Common.h"
20#include "Types.h"
21#include "ConstantUnion.h"
22
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(); }
246 const char* getBasicString() const { return type.getBasicString(); }
247 const char* getQualifierString() const { return type.getQualifierString(); }
248 TString getCompleteString() const { return type.getCompleteString(); }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000249
250protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000251 TType type;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000252};
253
254//
255// Handle for, do-while, and while loops.
256//
257class TIntermLoop : public TIntermNode {
258public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000259 TIntermLoop(TIntermNode *init, TIntermNode* aBody, TIntermTyped* aTest, TIntermTyped* aTerminal, bool testFirst) :
260 init(init),
261 body(aBody),
262 test(aTest),
263 terminal(aTerminal),
264 first(testFirst) { }
265 virtual void traverse(TIntermTraverser*);
266 TIntermNode *getInit() { return init; }
267 TIntermNode *getBody() { return body; }
268 TIntermTyped *getTest() { return test; }
269 TIntermTyped *getTerminal() { return terminal; }
270 bool testFirst() { return first; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000271protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000272 TIntermNode *init;
273 TIntermNode *body; // code to loop over
274 TIntermTyped *test; // exit condition associated with loop, could be 0 for 'for' loops
275 TIntermTyped *terminal; // exists for for-loops
276 bool first; // true for while and for, not for do-while
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000277};
278
279//
280// Handle break, continue, return, and kill.
281//
282class TIntermBranch : public TIntermNode {
283public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000284 TIntermBranch(TOperator op, TIntermTyped* e) :
285 flowOp(op),
286 expression(e) { }
287 virtual void traverse(TIntermTraverser*);
288 TOperator getFlowOp() { return flowOp; }
289 TIntermTyped* getExpression() { return expression; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000290protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000291 TOperator flowOp;
292 TIntermTyped* expression; // non-zero except for "return exp;" statements
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000293};
294
295//
296// Nodes that correspond to symbols or constants in the source code.
297//
298class TIntermSymbol : public TIntermTyped {
299public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000300 // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym. If sym comes from
301 // per process globalpoolallocator, then it causes increased memory usage per compile
302 // it is essential to use "symbol = sym" to assign to symbol
303 TIntermSymbol(int i, const TString& sym, const TType& t) :
304 TIntermTyped(t), id(i) { symbol = sym;}
305 virtual int getId() const { return id; }
306 virtual const TString& getSymbol() const { return symbol; }
307 virtual void traverse(TIntermTraverser*);
308 virtual TIntermSymbol* getAsSymbolNode() { return this; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000309protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000310 int id;
311 TString symbol;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000312};
313
314class TIntermConstantUnion : public TIntermTyped {
315public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000316 TIntermConstantUnion(constUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
317 constUnion* getUnionArrayPointer() const { return unionArrayPointer; }
318 void setUnionArrayPointer(constUnion *c) { unionArrayPointer = c; }
319 virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
320 virtual void traverse(TIntermTraverser* );
321 virtual TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000322protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000323 constUnion *unionArrayPointer;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000324};
325
326//
327// Intermediate class for node types that hold operators.
328//
329class TIntermOperator : public TIntermTyped {
330public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000331 TOperator getOp() const { return op; }
332 bool modifiesState() const;
333 bool isConstructor() const;
334 virtual bool promote(TInfoSink&) { return true; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000335protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000336 TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat)), op(o) {}
337 TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
338 TOperator op;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000339};
340
341//
342// Nodes for all the basic binary math operators.
343//
344class TIntermBinary : public TIntermOperator {
345public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000346 TIntermBinary(TOperator o) : TIntermOperator(o) {}
347 virtual void traverse(TIntermTraverser*);
348 virtual void setLeft(TIntermTyped* n) { left = n; }
349 virtual void setRight(TIntermTyped* n) { right = n; }
350 virtual TIntermTyped* getLeft() const { return left; }
351 virtual TIntermTyped* getRight() const { return right; }
352 virtual TIntermBinary* getAsBinaryNode() { return this; }
353 virtual bool promote(TInfoSink&);
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000354protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000355 TIntermTyped* left;
356 TIntermTyped* right;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000357};
358
359//
360// Nodes for unary math operators.
361//
362class TIntermUnary : public TIntermOperator {
363public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000364 TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}
365 TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}
366 virtual void traverse(TIntermTraverser*);
367 virtual void setOperand(TIntermTyped* o) { operand = o; }
368 virtual TIntermTyped* getOperand() { return operand; }
daniel@transgaming.com4a35ef22010-04-08 03:51:06 +0000369 virtual TIntermUnary* getAsUnaryNode() { return this; }
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000370 virtual bool promote(TInfoSink&);
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000371protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000372 TIntermTyped* operand;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000373};
374
375typedef TVector<TIntermNode*> TIntermSequence;
376typedef TVector<int> TQualifierList;
377//
378// Nodes that operate on an arbitrary sized set of children.
379//
380class TIntermAggregate : public TIntermOperator {
381public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000382 TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0) { }
383 TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { }
384 ~TIntermAggregate() { delete pragmaTable; }
385 virtual TIntermAggregate* getAsAggregate() { return this; }
386 virtual void setOperator(TOperator o) { op = o; }
387 virtual TIntermSequence& getSequence() { return sequence; }
388 virtual void setName(const TString& n) { name = n; }
389 virtual const TString& getName() const { return name; }
390 virtual void traverse(TIntermTraverser*);
391 virtual void setUserDefined() { userDefined = true; }
392 virtual bool isUserDefined() { return userDefined; }
393 virtual TQualifierList& getQualifier() { return qualifier; }
394 void setOptimize(bool o) { optimize = o; }
395 void setDebug(bool d) { debug = d; }
396 bool getOptimize() { return optimize; }
397 bool getDebug() { return debug; }
398 void addToPragmaTable(const TPragmaTable& pTable);
399 const TPragmaTable& getPragmaTable() const { return *pragmaTable; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000400protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000401 TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
402 TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
403 TIntermSequence sequence;
404 TQualifierList qualifier;
405 TString name;
406 bool userDefined; // used for user defined function names
407 bool optimize;
408 bool debug;
409 TPragmaTable *pragmaTable;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000410};
411
412//
413// For if tests. Simplified since there is no switch statement.
414//
415class TIntermSelection : public TIntermTyped {
416public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000417 TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) :
418 TIntermTyped(TType(EbtVoid)), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
419 TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) :
420 TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
421 virtual void traverse(TIntermTraverser*);
422 bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
423 virtual TIntermNode* getCondition() const { return condition; }
424 virtual TIntermNode* getTrueBlock() const { return trueBlock; }
425 virtual TIntermNode* getFalseBlock() const { return falseBlock; }
426 virtual TIntermSelection* getAsSelectionNode() { return this; }
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000427protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000428 TIntermTyped* condition;
429 TIntermNode* trueBlock;
430 TIntermNode* falseBlock;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000431};
432
433enum Visit
434{
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000435 PreVisit,
436 InVisit,
437 PostVisit
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000438};
439
440//
441// For traversing the tree. User should derive from this,
442// put their traversal specific data in it, and then pass
443// it to a Traverse method.
444//
445// When using this, just fill in the methods for nodes you want visited.
446// Return false from a pre-visit to skip visiting that node's subtree.
447//
448class TIntermTraverser
449{
450public:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000451 POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000452
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000453 TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false) :
454 preVisit(preVisit),
455 inVisit(inVisit),
456 postVisit(postVisit),
457 rightToLeft(rightToLeft),
458 depth(0) {}
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000459
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000460 virtual void visitSymbol(TIntermSymbol*) {}
461 virtual void visitConstantUnion(TIntermConstantUnion*) {}
462 virtual bool visitBinary(Visit visit, TIntermBinary*) {return true;}
463 virtual bool visitUnary(Visit visit, TIntermUnary*) {return true;}
464 virtual bool visitSelection(Visit visit, TIntermSelection*) {return true;}
465 virtual bool visitAggregate(Visit visit, TIntermAggregate*) {return true;}
466 virtual bool visitLoop(Visit visit, TIntermLoop*) {return true;}
467 virtual bool visitBranch(Visit visit, TIntermBranch*) {return true;}
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000468
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000469 void incrementDepth() {depth++;}
470 void decrementDepth() {depth--;}
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000471
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000472 const bool preVisit;
473 const bool inVisit;
474 const bool postVisit;
475 const bool rightToLeft;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000476
477protected:
alokp@chromium.org2cf17712010-03-30 20:33:18 +0000478 int depth;
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +0000479};
480
481#endif // __INTERMEDIATE_H