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