OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SKSL_IRGENERATOR | 8 #ifndef SKSL_IRGENERATOR |
9 #define SKSL_IRGENERATOR | 9 #define SKSL_IRGENERATOR |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "ir/SkSLExpression.h" | 38 #include "ir/SkSLExpression.h" |
39 #include "ir/SkSLExtension.h" | 39 #include "ir/SkSLExtension.h" |
40 #include "ir/SkSLFunctionDefinition.h" | 40 #include "ir/SkSLFunctionDefinition.h" |
41 #include "ir/SkSLInterfaceBlock.h" | 41 #include "ir/SkSLInterfaceBlock.h" |
42 #include "ir/SkSLModifiers.h" | 42 #include "ir/SkSLModifiers.h" |
43 #include "ir/SkSLModifiersDeclaration.h" | 43 #include "ir/SkSLModifiersDeclaration.h" |
44 #include "ir/SkSLSymbolTable.h" | 44 #include "ir/SkSLSymbolTable.h" |
45 #include "ir/SkSLStatement.h" | 45 #include "ir/SkSLStatement.h" |
46 #include "ir/SkSLType.h" | 46 #include "ir/SkSLType.h" |
47 #include "ir/SkSLTypeReference.h" | 47 #include "ir/SkSLTypeReference.h" |
48 #include "ir/SkSLVarDeclaration.h" | 48 #include "ir/SkSLVarDeclarations.h" |
49 | 49 |
50 namespace SkSL { | 50 namespace SkSL { |
51 | 51 |
52 /** | 52 /** |
53 * Performs semantic analysis on an abstract syntax tree (AST) and produces the
corresponding | 53 * Performs semantic analysis on an abstract syntax tree (AST) and produces the
corresponding |
54 * (unoptimized) intermediate representation (IR). | 54 * (unoptimized) intermediate representation (IR). |
55 */ | 55 */ |
56 class IRGenerator { | 56 class IRGenerator { |
57 public: | 57 public: |
58 IRGenerator(const Context* context, std::shared_ptr<SymbolTable> root, | 58 IRGenerator(const Context* context, std::shared_ptr<SymbolTable> root, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 std::unique_ptr<Statement> convertVarDeclarationStatement(const ASTVarDeclar
ationStatement& s); | 109 std::unique_ptr<Statement> convertVarDeclarationStatement(const ASTVarDeclar
ationStatement& s); |
110 std::unique_ptr<Statement> convertWhile(const ASTWhileStatement& w); | 110 std::unique_ptr<Statement> convertWhile(const ASTWhileStatement& w); |
111 | 111 |
112 void checkValid(const Expression& expr); | 112 void checkValid(const Expression& expr); |
113 void markReadFrom(const Variable& var); | 113 void markReadFrom(const Variable& var); |
114 void markWrittenTo(const Expression& expr); | 114 void markWrittenTo(const Expression& expr); |
115 | 115 |
116 const Context& fContext; | 116 const Context& fContext; |
117 const FunctionDeclaration* fCurrentFunction; | 117 const FunctionDeclaration* fCurrentFunction; |
118 std::shared_ptr<SymbolTable> fSymbolTable; | 118 std::shared_ptr<SymbolTable> fSymbolTable; |
| 119 int fLoopLevel; |
119 ErrorReporter& fErrors; | 120 ErrorReporter& fErrors; |
120 | 121 |
121 friend class AutoSymbolTable; | 122 friend class AutoSymbolTable; |
| 123 friend class AutoLoopLevel; |
122 friend class Compiler; | 124 friend class Compiler; |
123 }; | 125 }; |
124 | 126 |
125 } | 127 } |
126 | 128 |
127 #endif | 129 #endif |
OLD | NEW |