daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
Nicolas Capens | 1fbc287 | 2014-01-03 14:12:09 -0500 | [diff] [blame] | 2 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 7 | #ifndef COMPILER_TRANSLATOR_SYMBOLTABLE_H_ |
| 8 | #define COMPILER_TRANSLATOR_SYMBOLTABLE_H_ |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 9 | |
| 10 | // |
| 11 | // Symbol table for parsing. Has these design characteristics: |
| 12 | // |
| 13 | // * Same symbol table can be used to compile many shaders, to preserve |
| 14 | // effort of creating and loading with the large numbers of built-in |
| 15 | // symbols. |
| 16 | // |
| 17 | // * Name mangling will be used to give each function a unique name |
| 18 | // so that symbol table lookups are never ambiguous. This allows |
| 19 | // a simpler symbol table structure. |
| 20 | // |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 21 | // * Pushing and popping of scope, so symbol table will really be a stack |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 22 | // of symbol tables. Searched from the top, with new inserts going into |
| 23 | // the top. |
| 24 | // |
| 25 | // * Constants: Compile time constant symbols will keep their values |
| 26 | // in the symbol table. The parser can substitute constants at parse |
| 27 | // time, including doing constant folding and constant propagation. |
| 28 | // |
| 29 | // * No temporaries: Temporaries made from operations (+, --, .xy, etc.) |
| 30 | // are tracked in the intermediate representation, not the symbol table. |
| 31 | // |
| 32 | |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 33 | #include <array> |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 34 | #include <memory> |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 35 | |
Jamie Madill | 703cdd6 | 2013-07-08 15:07:30 -0400 | [diff] [blame] | 36 | #include "common/angleutils.h" |
Olli Etuaho | 2a1e8f9 | 2017-07-14 11:49:36 +0300 | [diff] [blame] | 37 | #include "compiler/translator/ExtensionBehavior.h" |
Olli Etuaho | fbb1c79 | 2018-01-19 16:26:59 +0200 | [diff] [blame] | 38 | #include "compiler/translator/ImmutableString.h" |
Geoff Lang | 1773282 | 2013-08-29 13:46:49 -0400 | [diff] [blame] | 39 | #include "compiler/translator/InfoSink.h" |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 40 | #include "compiler/translator/IntermNode.h" |
Olli Etuaho | d4529f3 | 2017-12-12 13:06:40 +0200 | [diff] [blame] | 41 | #include "compiler/translator/Symbol.h" |
alokp@chromium.org | 4388487 | 2010-03-30 00:08:52 +0000 | [diff] [blame] | 42 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 43 | namespace sh |
| 44 | { |
| 45 | |
Gus Fernandez | 964df49 | 2014-10-13 11:54:39 -0700 | [diff] [blame] | 46 | // Define ESymbolLevel as int rather than an enum since level can go |
| 47 | // above GLOBAL_LEVEL and cause atBuiltInLevel() to fail if the |
| 48 | // compiler optimizes the >= of the last element to ==. |
| 49 | typedef int ESymbolLevel; |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 50 | const int COMMON_BUILTINS = 0; |
| 51 | const int ESSL1_BUILTINS = 1; |
| 52 | const int ESSL3_BUILTINS = 2; |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 53 | const int ESSL3_1_BUILTINS = 3; |
Olli Etuaho | 977ee7e | 2017-07-21 11:38:27 +0300 | [diff] [blame] | 54 | // GLSL_BUILTINS are desktop GLSL builtins that don't exist in ESSL but are used to implement |
| 55 | // features in ANGLE's GLSL backend. They're not visible to the parser. |
| 56 | const int GLSL_BUILTINS = 4; |
| 57 | const int LAST_BUILTIN_LEVEL = GLSL_BUILTINS; |
| 58 | const int GLOBAL_LEVEL = 5; |
shannonwoods@chromium.org | 6e10a0e | 2013-05-30 00:02:13 +0000 | [diff] [blame] | 59 | |
Jamie Madill | f0d10f8 | 2015-03-31 12:56:52 -0400 | [diff] [blame] | 60 | class TSymbolTable : angle::NonCopyable |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 61 | { |
| 62 | public: |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 63 | TSymbolTable(); |
| 64 | // To start using the symbol table after construction: |
| 65 | // * initializeBuiltIns() needs to be called. |
| 66 | // * push() needs to be called to push the global level. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 67 | |
Alok Priyadarshi | bc3f1ac | 2013-09-23 14:57:02 -0400 | [diff] [blame] | 68 | ~TSymbolTable(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 69 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 70 | // When the symbol table is initialized with the built-ins, there should |
| 71 | // 'push' calls, so that built-ins are at level 0 and the shader |
| 72 | // globals are at level 1. |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 73 | bool isEmpty() const { return mTable.empty(); } |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 74 | bool atBuiltInLevel() const { return currentLevel() <= LAST_BUILTIN_LEVEL; } |
| 75 | bool atGlobalLevel() const { return currentLevel() == GLOBAL_LEVEL; } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 76 | |
Olli Etuaho | dd21ecf | 2018-01-10 12:42:09 +0200 | [diff] [blame] | 77 | void push(); |
| 78 | void pop(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 79 | |
Olli Etuaho | 0f68463 | 2017-07-13 12:42:15 +0300 | [diff] [blame] | 80 | // The declare* entry points are used when parsing and declare symbols at the current scope. |
Olli Etuaho | dd21ecf | 2018-01-10 12:42:09 +0200 | [diff] [blame] | 81 | // They return the created true in case the declaration was successful, and false if the |
| 82 | // declaration failed due to redefinition. |
Olli Etuaho | 195be94 | 2017-12-04 23:40:14 +0200 | [diff] [blame] | 83 | bool declareVariable(TVariable *variable); |
Olli Etuaho | 035419f | 2017-11-28 14:27:15 +0200 | [diff] [blame] | 84 | bool declareStructType(TStructure *str); |
Olli Etuaho | 378c3a5 | 2017-12-04 11:32:13 +0200 | [diff] [blame] | 85 | bool declareInterfaceBlock(TInterfaceBlock *interfaceBlock); |
Olli Etuaho | dd21ecf | 2018-01-10 12:42:09 +0200 | [diff] [blame] | 86 | // Functions are always declared at global scope. |
| 87 | void declareUserDefinedFunction(TFunction *function, bool insertUnmangledName); |
shannonwoods@chromium.org | 1c84809 | 2013-05-30 00:02:34 +0000 | [diff] [blame] | 88 | |
Olli Etuaho | 29bda81 | 2018-01-26 17:37:36 +0200 | [diff] [blame] | 89 | // These return the TFunction pointer to keep using to refer to this function. |
| 90 | const TFunction *markUserDefinedFunctionHasPrototypeDeclaration( |
| 91 | const ImmutableString &mangledName, |
| 92 | bool *hadPrototypeDeclarationOut); |
| 93 | const TFunction *setUserDefinedFunctionParameterNamesFromDefinition(const TFunction *function, |
| 94 | bool *wasDefinedOut); |
| 95 | |
| 96 | // find() is guaranteed not to retain a reference to the ImmutableString, so an ImmutableString |
| 97 | // with a reference to a short-lived char * is fine to pass here. |
| 98 | const TSymbol *find(const ImmutableString &name, int shaderVersion) const; |
| 99 | |
| 100 | const TSymbol *findGlobal(const ImmutableString &name) const; |
| 101 | |
| 102 | const TSymbol *findBuiltIn(const ImmutableString &name, int shaderVersion) const; |
| 103 | |
| 104 | const TSymbol *findBuiltIn(const ImmutableString &name, |
| 105 | int shaderVersion, |
| 106 | bool includeGLSLBuiltins) const; |
| 107 | |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 108 | void setDefaultPrecision(TBasicType type, TPrecision prec); |
Olli Etuaho | 29bda81 | 2018-01-26 17:37:36 +0200 | [diff] [blame] | 109 | |
| 110 | // Searches down the precisionStack for a precision qualifier |
| 111 | // for the specified TBasicType |
| 112 | TPrecision getDefaultPrecision(TBasicType type) const; |
| 113 | |
| 114 | // This records invariant varyings declared through |
| 115 | // "invariant varying_name;". |
Olli Etuaho | defe393 | 2018-02-13 11:56:09 +0200 | [diff] [blame^] | 116 | void addInvariantVarying(const ImmutableString &originalName); |
Olli Etuaho | 29bda81 | 2018-01-26 17:37:36 +0200 | [diff] [blame] | 117 | |
| 118 | // If this returns false, the varying could still be invariant |
| 119 | // if it is set as invariant during the varying variable |
| 120 | // declaration - this piece of information is stored in the |
| 121 | // variable's type, not here. |
Olli Etuaho | defe393 | 2018-02-13 11:56:09 +0200 | [diff] [blame^] | 122 | bool isVaryingInvariant(const ImmutableString &originalName) const; |
Olli Etuaho | 29bda81 | 2018-01-26 17:37:36 +0200 | [diff] [blame] | 123 | |
| 124 | void setGlobalInvariant(bool invariant); |
| 125 | |
| 126 | const TSymbolUniqueId nextUniqueId() { return TSymbolUniqueId(this); } |
| 127 | |
| 128 | // Checks whether there is a built-in accessible by a shader with the specified version. |
| 129 | bool hasUnmangledBuiltInForShaderVersion(const char *name, int shaderVersion); |
| 130 | |
| 131 | void initializeBuiltIns(sh::GLenum type, |
| 132 | ShShaderSpec spec, |
| 133 | const ShBuiltInResources &resources); |
| 134 | void clearCompilationResults(); |
| 135 | |
| 136 | private: |
| 137 | friend class TSymbolUniqueId; |
| 138 | int nextUniqueIdValue(); |
| 139 | |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 140 | class TSymbolTableBuiltInLevel; |
Olli Etuaho | 29bda81 | 2018-01-26 17:37:36 +0200 | [diff] [blame] | 141 | class TSymbolTableLevel; |
| 142 | |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 143 | void pushBuiltInLevel(); |
| 144 | |
| 145 | ESymbolLevel currentLevel() const |
| 146 | { |
| 147 | return static_cast<ESymbolLevel>(mTable.size() + LAST_BUILTIN_LEVEL); |
| 148 | } |
Olli Etuaho | 29bda81 | 2018-01-26 17:37:36 +0200 | [diff] [blame] | 149 | |
Olli Etuaho | 0f68463 | 2017-07-13 12:42:15 +0300 | [diff] [blame] | 150 | // The insert* entry points are used when initializing the symbol table with built-ins. |
Olli Etuaho | 035419f | 2017-11-28 14:27:15 +0200 | [diff] [blame] | 151 | // They return the created symbol / true in case the declaration was successful, and nullptr / |
| 152 | // false if the declaration failed due to redefinition. |
Olli Etuaho | fbb1c79 | 2018-01-19 16:26:59 +0200 | [diff] [blame] | 153 | TVariable *insertVariable(ESymbolLevel level, const ImmutableString &name, const TType *type); |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 154 | void insertVariableExt(ESymbolLevel level, |
| 155 | TExtension ext, |
| 156 | const ImmutableString &name, |
| 157 | const TType *type); |
Olli Etuaho | 195be94 | 2017-12-04 23:40:14 +0200 | [diff] [blame] | 158 | bool insertVariable(ESymbolLevel level, TVariable *variable); |
Olli Etuaho | 035419f | 2017-11-28 14:27:15 +0200 | [diff] [blame] | 159 | bool insertStructType(ESymbolLevel level, TStructure *str); |
Olli Etuaho | 378c3a5 | 2017-12-04 11:32:13 +0200 | [diff] [blame] | 160 | bool insertInterfaceBlock(ESymbolLevel level, TInterfaceBlock *interfaceBlock); |
Nicolas Capens | c9d9b30 | 2015-02-20 23:02:15 -0500 | [diff] [blame] | 161 | |
Olli Etuaho | b60d30f | 2018-01-16 12:31:06 +0200 | [diff] [blame] | 162 | template <TPrecision precision> |
Olli Etuaho | fbb1c79 | 2018-01-19 16:26:59 +0200 | [diff] [blame] | 163 | bool insertConstInt(ESymbolLevel level, const ImmutableString &name, int value); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 164 | |
Olli Etuaho | b60d30f | 2018-01-16 12:31:06 +0200 | [diff] [blame] | 165 | template <TPrecision precision> |
Olli Etuaho | fbb1c79 | 2018-01-19 16:26:59 +0200 | [diff] [blame] | 166 | bool insertConstIntExt(ESymbolLevel level, |
| 167 | TExtension ext, |
| 168 | const ImmutableString &name, |
| 169 | int value); |
Kimmo Kinnunen | b18609b | 2015-07-16 14:13:11 +0300 | [diff] [blame] | 170 | |
Olli Etuaho | b60d30f | 2018-01-16 12:31:06 +0200 | [diff] [blame] | 171 | template <TPrecision precision> |
Olli Etuaho | fbb1c79 | 2018-01-19 16:26:59 +0200 | [diff] [blame] | 172 | bool insertConstIvec3(ESymbolLevel level, |
| 173 | const ImmutableString &name, |
| 174 | const std::array<int, 3> &values); |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 175 | |
Olli Etuaho | 342b83d | 2018-01-10 13:24:01 +0200 | [diff] [blame] | 176 | // Note that for inserted built-in functions the const char *name needs to remain valid for the |
| 177 | // lifetime of the SymbolTable. SymbolTable does not allocate a copy of it. |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 178 | void insertBuiltIn(ESymbolLevel level, |
| 179 | TOperator op, |
Olli Etuaho | 2a1e8f9 | 2017-07-14 11:49:36 +0300 | [diff] [blame] | 180 | TExtension ext, |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 181 | const TType *rvalue, |
| 182 | const char *name, |
| 183 | const TType *ptype1, |
| 184 | const TType *ptype2 = 0, |
| 185 | const TType *ptype3 = 0, |
| 186 | const TType *ptype4 = 0, |
| 187 | const TType *ptype5 = 0); |
Nicolas Capens | 759b994 | 2014-02-14 17:57:14 -0500 | [diff] [blame] | 188 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 189 | void insertBuiltIn(ESymbolLevel level, |
| 190 | const TType *rvalue, |
| 191 | const char *name, |
| 192 | const TType *ptype1, |
| 193 | const TType *ptype2 = 0, |
| 194 | const TType *ptype3 = 0, |
| 195 | const TType *ptype4 = 0, |
| 196 | const TType *ptype5 = 0) |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 197 | { |
Martin Radev | da6254b | 2016-12-14 17:00:36 +0200 | [diff] [blame] | 198 | insertUnmangledBuiltInName(name, level); |
Olli Etuaho | 2a1e8f9 | 2017-07-14 11:49:36 +0300 | [diff] [blame] | 199 | insertBuiltIn(level, EOpNull, TExtension::UNDEFINED, rvalue, name, ptype1, ptype2, ptype3, |
| 200 | ptype4, ptype5); |
Nicolas Capens | c9d9b30 | 2015-02-20 23:02:15 -0500 | [diff] [blame] | 201 | } |
| 202 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 203 | void insertBuiltIn(ESymbolLevel level, |
Olli Etuaho | 2a1e8f9 | 2017-07-14 11:49:36 +0300 | [diff] [blame] | 204 | TExtension ext, |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 205 | const TType *rvalue, |
| 206 | const char *name, |
| 207 | const TType *ptype1, |
| 208 | const TType *ptype2 = 0, |
| 209 | const TType *ptype3 = 0, |
| 210 | const TType *ptype4 = 0, |
| 211 | const TType *ptype5 = 0) |
Nicolas Capens | c9d9b30 | 2015-02-20 23:02:15 -0500 | [diff] [blame] | 212 | { |
Martin Radev | da6254b | 2016-12-14 17:00:36 +0200 | [diff] [blame] | 213 | insertUnmangledBuiltInName(name, level); |
Nicolas Capens | c9d9b30 | 2015-02-20 23:02:15 -0500 | [diff] [blame] | 214 | insertBuiltIn(level, EOpNull, ext, rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5); |
| 215 | } |
| 216 | |
Olli Etuaho | 492cfab | 2017-01-20 21:18:29 +0000 | [diff] [blame] | 217 | void insertBuiltInOp(ESymbolLevel level, |
| 218 | TOperator op, |
| 219 | const TType *rvalue, |
| 220 | const TType *ptype1, |
| 221 | const TType *ptype2 = 0, |
| 222 | const TType *ptype3 = 0, |
| 223 | const TType *ptype4 = 0, |
| 224 | const TType *ptype5 = 0); |
| 225 | |
| 226 | void insertBuiltInOp(ESymbolLevel level, |
| 227 | TOperator op, |
Olli Etuaho | 2a1e8f9 | 2017-07-14 11:49:36 +0300 | [diff] [blame] | 228 | TExtension ext, |
Olli Etuaho | 492cfab | 2017-01-20 21:18:29 +0000 | [diff] [blame] | 229 | const TType *rvalue, |
| 230 | const TType *ptype1, |
| 231 | const TType *ptype2 = 0, |
| 232 | const TType *ptype3 = 0, |
| 233 | const TType *ptype4 = 0, |
| 234 | const TType *ptype5 = 0); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 235 | |
Martin Radev | d7c5b0a | 2016-07-27 14:04:43 +0300 | [diff] [blame] | 236 | void insertBuiltInFunctionNoParameters(ESymbolLevel level, |
| 237 | TOperator op, |
| 238 | const TType *rvalue, |
| 239 | const char *name); |
| 240 | |
Jiawei Shao | d27f5c8 | 2017-08-23 09:38:08 +0800 | [diff] [blame] | 241 | void insertBuiltInFunctionNoParametersExt(ESymbolLevel level, |
Olli Etuaho | 2a1e8f9 | 2017-07-14 11:49:36 +0300 | [diff] [blame] | 242 | TExtension ext, |
Jiawei Shao | d27f5c8 | 2017-08-23 09:38:08 +0800 | [diff] [blame] | 243 | TOperator op, |
| 244 | const TType *rvalue, |
| 245 | const char *name); |
| 246 | |
Olli Etuaho | 9d4d7f0 | 2017-12-07 17:11:41 +0100 | [diff] [blame] | 247 | TVariable *insertVariable(ESymbolLevel level, |
Olli Etuaho | fbb1c79 | 2018-01-19 16:26:59 +0200 | [diff] [blame] | 248 | const ImmutableString &name, |
Olli Etuaho | b60d30f | 2018-01-16 12:31:06 +0200 | [diff] [blame] | 249 | const TType *type, |
Olli Etuaho | 9d4d7f0 | 2017-12-07 17:11:41 +0100 | [diff] [blame] | 250 | SymbolType symbolType); |
Olli Etuaho | 0f68463 | 2017-07-13 12:42:15 +0300 | [diff] [blame] | 251 | |
Olli Etuaho | dd21ecf | 2018-01-10 12:42:09 +0200 | [diff] [blame] | 252 | bool insert(ESymbolLevel level, TSymbol *symbol); |
| 253 | |
Olli Etuaho | fbb1c79 | 2018-01-19 16:26:59 +0200 | [diff] [blame] | 254 | TFunction *findUserDefinedFunction(const ImmutableString &name) const; |
Olli Etuaho | 0f68463 | 2017-07-13 12:42:15 +0300 | [diff] [blame] | 255 | |
Martin Radev | da6254b | 2016-12-14 17:00:36 +0200 | [diff] [blame] | 256 | // Used to insert unmangled functions to check redeclaration of built-ins in ESSL 3.00 and |
| 257 | // above. |
| 258 | void insertUnmangledBuiltInName(const char *name, ESymbolLevel level); |
| 259 | |
| 260 | bool hasUnmangledBuiltInAtLevel(const char *name, ESymbolLevel level); |
Olli Etuaho | c4a96d6 | 2015-07-23 17:37:39 +0530 | [diff] [blame] | 261 | |
Olli Etuaho | 29bda81 | 2018-01-26 17:37:36 +0200 | [diff] [blame] | 262 | void initSamplerDefaultPrecision(TBasicType samplerType); |
| 263 | |
| 264 | void initializeBuiltInFunctions(sh::GLenum type, |
| 265 | ShShaderSpec spec, |
| 266 | const ShBuiltInResources &resources); |
| 267 | void initializeBuiltInVariables(sh::GLenum type, |
| 268 | ShShaderSpec spec, |
| 269 | const ShBuiltInResources &resources); |
| 270 | void markBuiltInInitializationFinished(); |
| 271 | |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 272 | std::vector<std::unique_ptr<TSymbolTableBuiltInLevel>> mBuiltInTable; |
| 273 | std::vector<std::unique_ptr<TSymbolTableLevel>> mTable; |
| 274 | |
| 275 | // There's one precision stack level for predefined precisions and then one level for each scope |
| 276 | // in table. |
Alok Priyadarshi | bc3f1ac | 2013-09-23 14:57:02 -0400 | [diff] [blame] | 277 | typedef TMap<TBasicType, TPrecision> PrecisionStackLevel; |
Olli Etuaho | e5fe7aa | 2018-01-29 12:06:11 +0200 | [diff] [blame] | 278 | std::vector<std::unique_ptr<PrecisionStackLevel>> mPrecisionStack; |
Jamie Madill | bfa91f4 | 2014-06-05 15:45:18 -0400 | [diff] [blame] | 279 | |
Olli Etuaho | a5e693a | 2017-07-13 16:07:26 +0300 | [diff] [blame] | 280 | int mUniqueIdCounter; |
Olli Etuaho | 2d88e9b | 2017-07-21 16:52:03 +0300 | [diff] [blame] | 281 | |
Olli Etuaho | 5d69db1 | 2017-11-24 16:51:15 +0200 | [diff] [blame] | 282 | // -1 before built-in init has finished, one past the last built-in id afterwards. |
| 283 | // TODO(oetuaho): Make this a compile-time constant once the symbol table is initialized at |
| 284 | // compile time. http://anglebug.com/1432 |
| 285 | int mUserDefinedUniqueIdsStart; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 286 | }; |
| 287 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 288 | } // namespace sh |
| 289 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 290 | #endif // COMPILER_TRANSLATOR_SYMBOLTABLE_H_ |