michael@0: // michael@0: // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: // UnfoldShortCircuit is an AST traverser to output short-circuiting operators as if-else statements michael@0: // michael@0: michael@0: #ifndef COMPILER_UNFOLDSHORTCIRCUIT_H_ michael@0: #define COMPILER_UNFOLDSHORTCIRCUIT_H_ michael@0: michael@0: #include "compiler/intermediate.h" michael@0: #include "compiler/ParseHelper.h" michael@0: michael@0: namespace sh michael@0: { michael@0: class OutputHLSL; michael@0: michael@0: class UnfoldShortCircuit : public TIntermTraverser michael@0: { michael@0: public: michael@0: UnfoldShortCircuit(TParseContext &context, OutputHLSL *outputHLSL); michael@0: michael@0: void traverse(TIntermNode *node); michael@0: bool visitBinary(Visit visit, TIntermBinary*); michael@0: bool visitSelection(Visit visit, TIntermSelection *node); michael@0: bool visitLoop(Visit visit, TIntermLoop *node); michael@0: michael@0: int getNextTemporaryIndex(); michael@0: michael@0: protected: michael@0: TParseContext &mContext; michael@0: OutputHLSL *const mOutputHLSL; michael@0: michael@0: int mTemporaryIndex; michael@0: }; michael@0: } michael@0: michael@0: #endif // COMPILER_UNFOLDSHORTCIRCUIT_H_