Simplify loop conditions so that they won't generate statements

Introduce an AST traverser that can move the evaluation of certain
types of loop conditions and loop expressions inside the loop. This
way subsequent AST transformations don't have to worry about cases
where they have to insert new statements to implement a loop condition
or expression.

This includes the revert of "Unfold short-circuiting operators in loop
conditions correctly". The new traverser covers the loop cases that
used to be handled in UnfoldShortCircuitToIf.

BUG=angleproject:1465
TEST=WebGL conformance tests,
     dEQP-GLES2.functional.shaders.*select_iteration_count*

Change-Id: I88e50e007e924d5884a217117690ac7fa2f96d38
Reviewed-on: https://chromium-review.googlesource.com/362570
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/SimplifyLoopConditions.h b/src/compiler/translator/SimplifyLoopConditions.h
new file mode 100644
index 0000000..b8802aa
--- /dev/null
+++ b/src/compiler/translator/SimplifyLoopConditions.h
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SimplifyLoopConditions is an AST traverser that converts loop conditions and loop expressions
+// to regular statements inside the loop. This way further transformations that generate statements
+// from loop conditions and loop expressions work correctly.
+//
+
+#ifndef COMPILER_TRANSLATOR_SIMPLIFYLOOPCONDITIONS_H_
+#define COMPILER_TRANSLATOR_SIMPLIFYLOOPCONDITIONS_H_
+
+class TIntermNode;
+class TSymbolTable;
+
+void SimplifyLoopConditions(TIntermNode *root,
+                            unsigned int conditionsToSimplify,
+                            unsigned int *temporaryIndex,
+                            const TSymbolTable &symbolTable,
+                            int shaderVersion);
+
+#endif  // COMPILER_TRANSLATOR_SIMPLIFYLOOPCONDITIONS_H_