• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "src/sksl/SkSLLexer.h"
14 #include "src/sksl/SkSLModifiersPool.h"
15 #include "src/sksl/SkSLPool.h"
16 
17 #include <algorithm>
18 #include <atomic>
19 #include <unordered_set>
20 #include <vector>
21 
22 namespace SkSL {
23 
24 class Expression;
25 class FunctionDeclaration;
26 class FunctionDefinition;
27 class Statement;
28 class Symbol;
29 class SymbolTable;
30 class Type;
31 class Variable;
32 class VariableReference;
33 enum class VariableRefKind : int8_t;
34 enum class VariableStorage : int8_t;
35 
36 /**
37  * Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved
38  * version of the program (all types determined, everything validated), ready for code generation.
39  */
40 class IRNode : public Poolable {
41 public:
~IRNode()42     virtual ~IRNode() {}
43 
44     virtual String description() const = 0;
45 
46     // No copy construction or assignment
47     IRNode(const IRNode&) = delete;
48     IRNode& operator=(const IRNode&) = delete;
49 
50     // line of this element within the program being compiled, for error reporting purposes
51     int fLine;
52 
53 protected:
IRNode(int line,int kind)54     IRNode(int line, int kind)
55         : fLine(line)
56         , fKind(kind) {}
57 
58     int fKind;
59 };
60 
61 }  // namespace SkSL
62 
63 #endif
64