1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SKSL_IRNODE 9 #define SKSL_IRNODE 10 11 #include "include/private/SkSLString.h" 12 #include "include/private/SkTArray.h" 13 #ifdef SKSL_EXT 14 #include "src/sksl/SkSLLexerExt.h" 15 #else 16 #include "src/sksl/SkSLLexer.h" 17 #endif 18 #include "src/sksl/SkSLModifiersPool.h" 19 #include "src/sksl/SkSLPool.h" 20 21 #include <algorithm> 22 #include <atomic> 23 #include <unordered_set> 24 #include <vector> 25 26 namespace SkSL { 27 28 class Expression; 29 class FunctionDeclaration; 30 class FunctionDefinition; 31 class Statement; 32 class Symbol; 33 class SymbolTable; 34 class Type; 35 class Variable; 36 class VariableReference; 37 enum class VariableRefKind : int8_t; 38 enum class VariableStorage : int8_t; 39 40 /** 41 * Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved 42 * version of the program (all types determined, everything validated), ready for code generation. 43 */ 44 class IRNode : public Poolable { 45 public: ~IRNode()46 virtual ~IRNode() {} 47 48 virtual String description() const = 0; 49 50 // No copy construction or assignment 51 IRNode(const IRNode&) = delete; 52 IRNode& operator=(const IRNode&) = delete; 53 54 // line of this element within the program being compiled, for error reporting purposes 55 int fLine; 56 57 protected: IRNode(int line,int kind)58 IRNode(int line, int kind) 59 : fLine(line) 60 , fKind(kind) {} 61 62 int fKind; 63 }; 64 65 } // namespace SkSL 66 67 #endif 68