daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
| 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 | |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 7 | #include "compiler/translator/IntermNode.h" |
Olli Etuaho | d4f303e | 2015-05-20 17:09:06 +0300 | [diff] [blame] | 8 | #include "compiler/translator/InfoSink.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 9 | |
Olli Etuaho | 56eea88 | 2015-05-18 12:41:03 +0300 | [diff] [blame] | 10 | void TIntermTraverser::pushParentBlock(TIntermAggregate *node) |
| 11 | { |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 12 | mParentBlockStack.push_back(ParentBlock(node, 0)); |
Olli Etuaho | 56eea88 | 2015-05-18 12:41:03 +0300 | [diff] [blame] | 13 | } |
| 14 | |
| 15 | void TIntermTraverser::incrementParentBlockPos() |
| 16 | { |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 17 | ++mParentBlockStack.back().pos; |
Olli Etuaho | 56eea88 | 2015-05-18 12:41:03 +0300 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | void TIntermTraverser::popParentBlock() |
| 21 | { |
| 22 | ASSERT(!mParentBlockStack.empty()); |
| 23 | mParentBlockStack.pop_back(); |
| 24 | } |
| 25 | |
| 26 | void TIntermTraverser::insertStatementsInParentBlock(const TIntermSequence &insertions) |
| 27 | { |
| 28 | ASSERT(!mParentBlockStack.empty()); |
| 29 | NodeInsertMultipleEntry insert(mParentBlockStack.back().node, mParentBlockStack.back().pos, insertions); |
| 30 | mInsertions.push_back(insert); |
| 31 | } |
| 32 | |
Olli Etuaho | d4f303e | 2015-05-20 17:09:06 +0300 | [diff] [blame] | 33 | TIntermSymbol *TIntermTraverser::createTempSymbol(const TType &type) |
| 34 | { |
| 35 | // Each traversal uses at most one temporary variable, so the index stays the same within a single traversal. |
| 36 | TInfoSinkBase symbolNameOut; |
| 37 | ASSERT(mTemporaryIndex != nullptr); |
| 38 | symbolNameOut << "s" << (*mTemporaryIndex); |
| 39 | TString symbolName = symbolNameOut.c_str(); |
| 40 | |
| 41 | TIntermSymbol *node = new TIntermSymbol(0, symbolName, type); |
| 42 | node->setInternal(true); |
| 43 | node->getTypePointer()->setQualifier(EvqTemporary); |
| 44 | return node; |
| 45 | } |
| 46 | |
Olli Etuaho | 4f1af78 | 2015-05-25 11:55:07 +0300 | [diff] [blame] | 47 | TIntermAggregate *TIntermTraverser::createTempDeclaration(const TType &type) |
| 48 | { |
| 49 | TIntermAggregate *tempDeclaration = new TIntermAggregate(EOpDeclaration); |
| 50 | tempDeclaration->getSequence()->push_back(createTempSymbol(type)); |
| 51 | return tempDeclaration; |
| 52 | } |
Olli Etuaho | d4f303e | 2015-05-20 17:09:06 +0300 | [diff] [blame] | 53 | |
| 54 | TIntermAggregate *TIntermTraverser::createTempInitDeclaration(TIntermTyped *initializer) |
| 55 | { |
| 56 | ASSERT(initializer != nullptr); |
| 57 | TIntermSymbol *tempSymbol = createTempSymbol(initializer->getType()); |
| 58 | TIntermAggregate *tempDeclaration = new TIntermAggregate(EOpDeclaration); |
| 59 | TIntermBinary *tempInit = new TIntermBinary(EOpInitialize); |
| 60 | tempInit->setLeft(tempSymbol); |
| 61 | tempInit->setRight(initializer); |
| 62 | tempInit->setType(tempSymbol->getType()); |
| 63 | tempDeclaration->getSequence()->push_back(tempInit); |
| 64 | return tempDeclaration; |
| 65 | } |
| 66 | |
| 67 | TIntermBinary *TIntermTraverser::createTempAssignment(TIntermTyped *rightNode) |
| 68 | { |
| 69 | ASSERT(rightNode != nullptr); |
| 70 | TIntermSymbol *tempSymbol = createTempSymbol(rightNode->getType()); |
| 71 | TIntermBinary *assignment = new TIntermBinary(EOpAssign); |
| 72 | assignment->setLeft(tempSymbol); |
| 73 | assignment->setRight(rightNode); |
| 74 | assignment->setType(tempSymbol->getType()); |
| 75 | return assignment; |
| 76 | } |
| 77 | |
| 78 | void TIntermTraverser::useTemporaryIndex(unsigned int *temporaryIndex) |
| 79 | { |
| 80 | mTemporaryIndex = temporaryIndex; |
| 81 | } |
| 82 | |
| 83 | void TIntermTraverser::nextTemporaryIndex() |
| 84 | { |
| 85 | ASSERT(mTemporaryIndex != nullptr); |
| 86 | ++(*mTemporaryIndex); |
| 87 | } |
| 88 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 89 | // |
| 90 | // Traverse the intermediate representation tree, and |
| 91 | // call a node type specific function for each node. |
| 92 | // Done recursively through the member function Traverse(). |
| 93 | // Node types can be skipped if their function to call is 0, |
| 94 | // but their subtree will still be traversed. |
| 95 | // Nodes with children can have their whole subtree skipped |
| 96 | // if preVisit is turned on and the type specific function |
| 97 | // returns false. |
| 98 | // |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 99 | |
| 100 | // |
| 101 | // Traversal functions for terminals are straighforward.... |
| 102 | // |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 103 | void TIntermSymbol::traverse(TIntermTraverser *it) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 104 | { |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 105 | it->visitSymbol(this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 106 | } |
| 107 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 108 | void TIntermConstantUnion::traverse(TIntermTraverser *it) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 109 | { |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 110 | it->visitConstantUnion(this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | // |
| 114 | // Traverse a binary node. |
| 115 | // |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 116 | void TIntermBinary::traverse(TIntermTraverser *it) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 117 | { |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 118 | bool visit = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 119 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 120 | // |
| 121 | // visit the node before children if pre-visiting. |
| 122 | // |
| 123 | if (it->preVisit) |
| 124 | visit = it->visitBinary(PreVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 125 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 126 | // |
| 127 | // Visit the children, in the right order. |
| 128 | // |
| 129 | if (visit) |
| 130 | { |
Zhenyao Mo | 7cab38b | 2013-10-15 12:59:30 -0700 | [diff] [blame] | 131 | it->incrementDepth(this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 132 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 133 | if (mLeft) |
| 134 | mLeft->traverse(it); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 135 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 136 | if (it->inVisit) |
| 137 | visit = it->visitBinary(InVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 138 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 139 | if (visit && mRight) |
| 140 | mRight->traverse(it); |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 141 | |
| 142 | it->decrementDepth(); |
| 143 | } |
| 144 | |
| 145 | // |
| 146 | // Visit the node after the children, if requested and the traversal |
| 147 | // hasn't been cancelled yet. |
| 148 | // |
| 149 | if (visit && it->postVisit) |
| 150 | it->visitBinary(PostVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | // |
| 154 | // Traverse a unary node. Same comments in binary node apply here. |
| 155 | // |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 156 | void TIntermUnary::traverse(TIntermTraverser *it) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 157 | { |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 158 | bool visit = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 159 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 160 | if (it->preVisit) |
| 161 | visit = it->visitUnary(PreVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 162 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 163 | if (visit) { |
Zhenyao Mo | 7cab38b | 2013-10-15 12:59:30 -0700 | [diff] [blame] | 164 | it->incrementDepth(this); |
Zhenyao Mo | e40d1e9 | 2014-07-16 17:40:36 -0700 | [diff] [blame] | 165 | mOperand->traverse(it); |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 166 | it->decrementDepth(); |
| 167 | } |
| 168 | |
| 169 | if (visit && it->postVisit) |
| 170 | it->visitUnary(PostVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | // |
| 174 | // Traverse an aggregate node. Same comments in binary node apply here. |
| 175 | // |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 176 | void TIntermAggregate::traverse(TIntermTraverser *it) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 177 | { |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 178 | bool visit = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 179 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 180 | if (it->preVisit) |
| 181 | visit = it->visitAggregate(PreVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 182 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 183 | if (visit) |
| 184 | { |
Olli Etuaho | 56eea88 | 2015-05-18 12:41:03 +0300 | [diff] [blame] | 185 | if (mOp == EOpSequence) |
| 186 | it->pushParentBlock(this); |
| 187 | |
Zhenyao Mo | 7cab38b | 2013-10-15 12:59:30 -0700 | [diff] [blame] | 188 | it->incrementDepth(this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 189 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 190 | for (TIntermSequence::iterator sit = mSequence.begin(); |
| 191 | sit != mSequence.end(); sit++) |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 192 | { |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 193 | (*sit)->traverse(it); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 194 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 195 | if (visit && it->inVisit) |
| 196 | { |
| 197 | if (*sit != mSequence.back()) |
| 198 | visit = it->visitAggregate(InVisit, this); |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 199 | } |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 200 | if (mOp == EOpSequence) |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 201 | { |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 202 | it->incrementParentBlockPos(); |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 203 | } |
| 204 | } |
| 205 | |
| 206 | it->decrementDepth(); |
Olli Etuaho | 56eea88 | 2015-05-18 12:41:03 +0300 | [diff] [blame] | 207 | |
| 208 | if (mOp == EOpSequence) |
| 209 | it->popParentBlock(); |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | if (visit && it->postVisit) |
| 213 | it->visitAggregate(PostVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | // |
| 217 | // Traverse a selection node. Same comments in binary node apply here. |
| 218 | // |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 219 | void TIntermSelection::traverse(TIntermTraverser *it) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 220 | { |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 221 | bool visit = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 222 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 223 | if (it->preVisit) |
| 224 | visit = it->visitSelection(PreVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 225 | |
Zhenyao Mo | e40d1e9 | 2014-07-16 17:40:36 -0700 | [diff] [blame] | 226 | if (visit) |
| 227 | { |
Zhenyao Mo | 7cab38b | 2013-10-15 12:59:30 -0700 | [diff] [blame] | 228 | it->incrementDepth(this); |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 229 | mCondition->traverse(it); |
| 230 | if (mTrueBlock) |
| 231 | mTrueBlock->traverse(it); |
| 232 | if (mFalseBlock) |
| 233 | mFalseBlock->traverse(it); |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 234 | it->decrementDepth(); |
| 235 | } |
| 236 | |
| 237 | if (visit && it->postVisit) |
| 238 | it->visitSelection(PostVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | // |
Olli Etuaho | a3a3666 | 2015-02-17 13:46:51 +0200 | [diff] [blame] | 242 | // Traverse a switch node. Same comments in binary node apply here. |
| 243 | // |
| 244 | void TIntermSwitch::traverse(TIntermTraverser *it) |
| 245 | { |
| 246 | bool visit = true; |
| 247 | |
| 248 | if (it->preVisit) |
| 249 | visit = it->visitSwitch(PreVisit, this); |
| 250 | |
| 251 | if (visit) |
| 252 | { |
| 253 | it->incrementDepth(this); |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 254 | mInit->traverse(it); |
| 255 | if (it->inVisit) |
| 256 | visit = it->visitSwitch(InVisit, this); |
| 257 | if (visit && mStatementList) |
| 258 | mStatementList->traverse(it); |
Olli Etuaho | a3a3666 | 2015-02-17 13:46:51 +0200 | [diff] [blame] | 259 | it->decrementDepth(); |
| 260 | } |
| 261 | |
| 262 | if (visit && it->postVisit) |
| 263 | it->visitSwitch(PostVisit, this); |
| 264 | } |
| 265 | |
| 266 | // |
| 267 | // Traverse a switch node. Same comments in binary node apply here. |
| 268 | // |
| 269 | void TIntermCase::traverse(TIntermTraverser *it) |
| 270 | { |
| 271 | bool visit = true; |
| 272 | |
| 273 | if (it->preVisit) |
| 274 | visit = it->visitCase(PreVisit, this); |
| 275 | |
| 276 | if (visit && mCondition) |
| 277 | mCondition->traverse(it); |
| 278 | |
| 279 | if (visit && it->postVisit) |
| 280 | it->visitCase(PostVisit, this); |
| 281 | } |
| 282 | |
| 283 | // |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 284 | // Traverse a loop node. Same comments in binary node apply here. |
| 285 | // |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 286 | void TIntermLoop::traverse(TIntermTraverser *it) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 287 | { |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 288 | bool visit = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 289 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 290 | if (it->preVisit) |
| 291 | visit = it->visitLoop(PreVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 292 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 293 | if (visit) |
| 294 | { |
Zhenyao Mo | 7cab38b | 2013-10-15 12:59:30 -0700 | [diff] [blame] | 295 | it->incrementDepth(this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 296 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 297 | if (mInit) |
| 298 | mInit->traverse(it); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 299 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 300 | if (mCond) |
| 301 | mCond->traverse(it); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 302 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 303 | if (mBody) |
| 304 | mBody->traverse(it); |
Zhenyao Mo | 6cb95f3 | 2013-10-03 17:01:52 -0700 | [diff] [blame] | 305 | |
Olli Etuaho | 64f0be9 | 2015-06-03 17:38:34 +0300 | [diff] [blame] | 306 | if (mExpr) |
| 307 | mExpr->traverse(it); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 308 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 309 | it->decrementDepth(); |
| 310 | } |
| 311 | |
| 312 | if (visit && it->postVisit) |
| 313 | it->visitLoop(PostVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | // |
| 317 | // Traverse a branch node. Same comments in binary node apply here. |
| 318 | // |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 319 | void TIntermBranch::traverse(TIntermTraverser *it) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 320 | { |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 321 | bool visit = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 322 | |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 323 | if (it->preVisit) |
| 324 | visit = it->visitBranch(PreVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 325 | |
Zhenyao Mo | e40d1e9 | 2014-07-16 17:40:36 -0700 | [diff] [blame] | 326 | if (visit && mExpression) { |
Zhenyao Mo | 7cab38b | 2013-10-15 12:59:30 -0700 | [diff] [blame] | 327 | it->incrementDepth(this); |
Zhenyao Mo | e40d1e9 | 2014-07-16 17:40:36 -0700 | [diff] [blame] | 328 | mExpression->traverse(it); |
Zhenyao Mo | e88dcaf | 2013-10-03 16:55:19 -0700 | [diff] [blame] | 329 | it->decrementDepth(); |
| 330 | } |
| 331 | |
| 332 | if (visit && it->postVisit) |
| 333 | it->visitBranch(PostVisit, this); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 334 | } |
| 335 | |
Jamie Madill | 4cfb1e8 | 2014-07-07 12:49:23 -0400 | [diff] [blame] | 336 | void TIntermRaw::traverse(TIntermTraverser *it) |
| 337 | { |
| 338 | it->visitRaw(this); |
| 339 | } |