daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
shannonwoods@chromium.org | 96e7ba1 | 2013-05-30 00:02:41 +0000 | [diff] [blame] | 2 | // Copyright (c) 2002-2013 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 | |
| 7 | // |
| 8 | // Symbol table for parsing. Most functionaliy and main ideas |
| 9 | // are documented in the header file. |
| 10 | // |
| 11 | |
apatrick@chromium.org | e057c5d | 2012-01-26 19:18:24 +0000 | [diff] [blame] | 12 | #if defined(_MSC_VER) |
| 13 | #pragma warning(disable: 4718) |
| 14 | #endif |
| 15 | |
Geoff Lang | 1773282 | 2013-08-29 13:46:49 -0400 | [diff] [blame] | 16 | #include "compiler/translator/SymbolTable.h" |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 17 | #include "compiler/translator/Cache.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 18 | |
apatrick@chromium.org | 8187fa8 | 2010-06-15 22:09:28 +0000 | [diff] [blame] | 19 | #include <stdio.h> |
kbr@chromium.org | 476541f | 2011-10-27 21:14:51 +0000 | [diff] [blame] | 20 | #include <algorithm> |
| 21 | |
Jamie Madill | bfa91f4 | 2014-06-05 15:45:18 -0400 | [diff] [blame] | 22 | int TSymbolTable::uniqueIdCounter = 0; |
Nicolas Capens | bd10cf5 | 2013-06-20 09:51:51 -0400 | [diff] [blame] | 23 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 24 | // |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 25 | // Functions have buried pointers to delete. |
| 26 | // |
| 27 | TFunction::~TFunction() |
| 28 | { |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 29 | for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i) |
| 30 | delete (*i).type; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 31 | } |
| 32 | |
Dmitry Skiba | 5883220 | 2015-07-06 16:11:13 -0700 | [diff] [blame] | 33 | const TString *TFunction::buildMangledName() const |
| 34 | { |
Cooper Partin | 149e6e6 | 2015-08-07 16:18:18 -0700 | [diff] [blame] | 35 | std::string newName = mangleName(getName()).c_str(); |
Dmitry Skiba | 5883220 | 2015-07-06 16:11:13 -0700 | [diff] [blame] | 36 | |
| 37 | for (const auto &p : parameters) |
| 38 | { |
Cooper Partin | 149e6e6 | 2015-08-07 16:18:18 -0700 | [diff] [blame] | 39 | newName += p.type->getMangledName().c_str(); |
Dmitry Skiba | 5883220 | 2015-07-06 16:11:13 -0700 | [diff] [blame] | 40 | } |
| 41 | |
Cooper Partin | 149e6e6 | 2015-08-07 16:18:18 -0700 | [diff] [blame] | 42 | return NewPoolTString(newName.c_str()); |
Dmitry Skiba | 5883220 | 2015-07-06 16:11:13 -0700 | [diff] [blame] | 43 | } |
| 44 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 45 | // |
| 46 | // Symbol table levels are a map of pointers to symbols that have to be deleted. |
| 47 | // |
| 48 | TSymbolTableLevel::~TSymbolTableLevel() |
| 49 | { |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 50 | for (tLevel::iterator it = level.begin(); it != level.end(); ++it) |
| 51 | delete (*it).second; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Nicolas Capens | adfffe4 | 2014-06-17 02:13:36 -0400 | [diff] [blame] | 54 | bool TSymbolTableLevel::insert(TSymbol *symbol) |
Jamie Madill | bfa91f4 | 2014-06-05 15:45:18 -0400 | [diff] [blame] | 55 | { |
Nicolas Capens | adfffe4 | 2014-06-17 02:13:36 -0400 | [diff] [blame] | 56 | symbol->setUniqueId(TSymbolTable::nextUniqueId()); |
Jamie Madill | bfa91f4 | 2014-06-05 15:45:18 -0400 | [diff] [blame] | 57 | |
| 58 | // returning true means symbol was added to the table |
Nicolas Capens | adfffe4 | 2014-06-17 02:13:36 -0400 | [diff] [blame] | 59 | tInsertResult result = level.insert(tLevelPair(symbol->getMangledName(), symbol)); |
Jamie Madill | bfa91f4 | 2014-06-05 15:45:18 -0400 | [diff] [blame] | 60 | |
| 61 | return result.second; |
| 62 | } |
| 63 | |
Olli Etuaho | b2983c9 | 2015-03-18 14:02:46 +0200 | [diff] [blame] | 64 | bool TSymbolTableLevel::insertUnmangled(TFunction *function) |
| 65 | { |
| 66 | function->setUniqueId(TSymbolTable::nextUniqueId()); |
| 67 | |
| 68 | // returning true means symbol was added to the table |
| 69 | tInsertResult result = level.insert(tLevelPair(function->getName(), function)); |
| 70 | |
| 71 | return result.second; |
| 72 | } |
| 73 | |
Jamie Madill | bfa91f4 | 2014-06-05 15:45:18 -0400 | [diff] [blame] | 74 | TSymbol *TSymbolTableLevel::find(const TString &name) const |
| 75 | { |
| 76 | tLevel::const_iterator it = level.find(name); |
| 77 | if (it == level.end()) |
| 78 | return 0; |
| 79 | else |
| 80 | return (*it).second; |
| 81 | } |
| 82 | |
Zhenyao Mo | e740add | 2014-07-18 17:01:01 -0700 | [diff] [blame] | 83 | TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, |
| 84 | bool *builtIn, bool *sameScope) const |
shannonwoods@chromium.org | 96e7ba1 | 2013-05-30 00:02:41 +0000 | [diff] [blame] | 85 | { |
| 86 | int level = currentLevel(); |
| 87 | TSymbol *symbol; |
| 88 | |
| 89 | do |
| 90 | { |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 91 | if (level == ESSL3_BUILTINS && shaderVersion != 300) |
| 92 | level--; |
| 93 | if (level == ESSL1_BUILTINS && shaderVersion != 100) |
| 94 | level--; |
shannonwoods@chromium.org | 96e7ba1 | 2013-05-30 00:02:41 +0000 | [diff] [blame] | 95 | |
| 96 | symbol = table[level]->find(name); |
| 97 | } |
| 98 | while (symbol == 0 && --level >= 0); |
| 99 | |
| 100 | if (builtIn) |
| 101 | *builtIn = (level <= LAST_BUILTIN_LEVEL); |
| 102 | if (sameScope) |
| 103 | *sameScope = (level == currentLevel()); |
| 104 | |
| 105 | return symbol; |
| 106 | } |
| 107 | |
Zhenyao Mo | e740add | 2014-07-18 17:01:01 -0700 | [diff] [blame] | 108 | TSymbol *TSymbolTable::findBuiltIn( |
| 109 | const TString &name, int shaderVersion) const |
shannonwoods@chromium.org | 96e7ba1 | 2013-05-30 00:02:41 +0000 | [diff] [blame] | 110 | { |
| 111 | for (int level = LAST_BUILTIN_LEVEL; level >= 0; level--) |
| 112 | { |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 113 | if (level == ESSL3_BUILTINS && shaderVersion != 300) |
| 114 | level--; |
| 115 | if (level == ESSL1_BUILTINS && shaderVersion != 100) |
| 116 | level--; |
shannonwoods@chromium.org | 96e7ba1 | 2013-05-30 00:02:41 +0000 | [diff] [blame] | 117 | |
| 118 | TSymbol *symbol = table[level]->find(name); |
| 119 | |
| 120 | if (symbol) |
| 121 | return symbol; |
| 122 | } |
| 123 | |
| 124 | return 0; |
| 125 | } |
Alok Priyadarshi | bc3f1ac | 2013-09-23 14:57:02 -0400 | [diff] [blame] | 126 | |
| 127 | TSymbolTable::~TSymbolTable() |
| 128 | { |
| 129 | while (table.size() > 0) |
| 130 | pop(); |
| 131 | } |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 132 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 133 | bool IsGenType(const TType *type) |
| 134 | { |
| 135 | if (type) |
| 136 | { |
| 137 | TBasicType basicType = type->getBasicType(); |
| 138 | return basicType == EbtGenType || basicType == EbtGenIType || basicType == EbtGenUType || basicType == EbtGenBType; |
| 139 | } |
| 140 | |
| 141 | return false; |
| 142 | } |
| 143 | |
| 144 | bool IsVecType(const TType *type) |
| 145 | { |
| 146 | if (type) |
| 147 | { |
| 148 | TBasicType basicType = type->getBasicType(); |
| 149 | return basicType == EbtVec || basicType == EbtIVec || basicType == EbtUVec || basicType == EbtBVec; |
| 150 | } |
| 151 | |
| 152 | return false; |
| 153 | } |
| 154 | |
Dmitry Skiba | efa3d8e | 2015-06-22 14:52:10 -0700 | [diff] [blame] | 155 | const TType *SpecificType(const TType *type, int size) |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 156 | { |
| 157 | ASSERT(size >= 1 && size <= 4); |
| 158 | |
| 159 | if (!type) |
| 160 | { |
| 161 | return nullptr; |
| 162 | } |
| 163 | |
| 164 | ASSERT(!IsVecType(type)); |
| 165 | |
| 166 | switch(type->getBasicType()) |
| 167 | { |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 168 | case EbtGenType: return TCache::getType(EbtFloat, static_cast<unsigned char>(size)); |
| 169 | case EbtGenIType: return TCache::getType(EbtInt, static_cast<unsigned char>(size)); |
| 170 | case EbtGenUType: return TCache::getType(EbtUInt, static_cast<unsigned char>(size)); |
| 171 | case EbtGenBType: return TCache::getType(EbtBool, static_cast<unsigned char>(size)); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 172 | default: return type; |
| 173 | } |
| 174 | } |
| 175 | |
Dmitry Skiba | efa3d8e | 2015-06-22 14:52:10 -0700 | [diff] [blame] | 176 | const TType *VectorType(const TType *type, int size) |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 177 | { |
| 178 | ASSERT(size >= 2 && size <= 4); |
| 179 | |
| 180 | if (!type) |
| 181 | { |
| 182 | return nullptr; |
| 183 | } |
| 184 | |
| 185 | ASSERT(!IsGenType(type)); |
| 186 | |
| 187 | switch(type->getBasicType()) |
| 188 | { |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 189 | case EbtVec: return TCache::getType(EbtFloat, static_cast<unsigned char>(size)); |
| 190 | case EbtIVec: return TCache::getType(EbtInt, static_cast<unsigned char>(size)); |
| 191 | case EbtUVec: return TCache::getType(EbtUInt, static_cast<unsigned char>(size)); |
| 192 | case EbtBVec: return TCache::getType(EbtBool, static_cast<unsigned char>(size)); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 193 | default: return type; |
| 194 | } |
| 195 | } |
| 196 | |
Dmitry Skiba | efa3d8e | 2015-06-22 14:52:10 -0700 | [diff] [blame] | 197 | void TSymbolTable::insertBuiltIn(ESymbolLevel level, TOperator op, const char *ext, const TType *rvalue, const char *name, |
| 198 | const TType *ptype1, const TType *ptype2, const TType *ptype3, const TType *ptype4, const TType *ptype5) |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 199 | { |
| 200 | if (ptype1->getBasicType() == EbtGSampler2D) |
| 201 | { |
| 202 | bool gvec4 = (rvalue->getBasicType() == EbtGVec4); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 203 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name, TCache::getType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5); |
| 204 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5); |
| 205 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5); |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 206 | } |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 207 | else if (ptype1->getBasicType() == EbtGSampler3D) |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 208 | { |
| 209 | bool gvec4 = (rvalue->getBasicType() == EbtGVec4); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 210 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name, TCache::getType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5); |
| 211 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5); |
| 212 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5); |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 213 | } |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 214 | else if (ptype1->getBasicType() == EbtGSamplerCube) |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 215 | { |
| 216 | bool gvec4 = (rvalue->getBasicType() == EbtGVec4); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 217 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name, TCache::getType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5); |
| 218 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5); |
| 219 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5); |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 220 | } |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 221 | else if (ptype1->getBasicType() == EbtGSampler2DArray) |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 222 | { |
| 223 | bool gvec4 = (rvalue->getBasicType() == EbtGVec4); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 224 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name, TCache::getType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5); |
| 225 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5); |
| 226 | insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5); |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 227 | } |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 228 | else if (IsGenType(rvalue) || IsGenType(ptype1) || IsGenType(ptype2) || IsGenType(ptype3)) |
| 229 | { |
| 230 | ASSERT(!ptype4 && !ptype5); |
Nicolas Capens | c9d9b30 | 2015-02-20 23:02:15 -0500 | [diff] [blame] | 231 | insertBuiltIn(level, op, ext, SpecificType(rvalue, 1), name, SpecificType(ptype1, 1), SpecificType(ptype2, 1), SpecificType(ptype3, 1)); |
| 232 | insertBuiltIn(level, op, ext, SpecificType(rvalue, 2), name, SpecificType(ptype1, 2), SpecificType(ptype2, 2), SpecificType(ptype3, 2)); |
| 233 | insertBuiltIn(level, op, ext, SpecificType(rvalue, 3), name, SpecificType(ptype1, 3), SpecificType(ptype2, 3), SpecificType(ptype3, 3)); |
| 234 | insertBuiltIn(level, op, ext, SpecificType(rvalue, 4), name, SpecificType(ptype1, 4), SpecificType(ptype2, 4), SpecificType(ptype3, 4)); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 235 | } |
| 236 | else if (IsVecType(rvalue) || IsVecType(ptype1) || IsVecType(ptype2) || IsVecType(ptype3)) |
| 237 | { |
| 238 | ASSERT(!ptype4 && !ptype5); |
Nicolas Capens | c9d9b30 | 2015-02-20 23:02:15 -0500 | [diff] [blame] | 239 | insertBuiltIn(level, op, ext, VectorType(rvalue, 2), name, VectorType(ptype1, 2), VectorType(ptype2, 2), VectorType(ptype3, 2)); |
| 240 | insertBuiltIn(level, op, ext, VectorType(rvalue, 3), name, VectorType(ptype1, 3), VectorType(ptype2, 3), VectorType(ptype3, 3)); |
| 241 | insertBuiltIn(level, op, ext, VectorType(rvalue, 4), name, VectorType(ptype1, 4), VectorType(ptype2, 4), VectorType(ptype3, 4)); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 242 | } |
| 243 | else |
| 244 | { |
Dmitry Skiba | 7f17a50 | 2015-06-22 15:08:39 -0700 | [diff] [blame] | 245 | TFunction *function = new TFunction(NewPoolTString(name), rvalue, op, ext); |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 246 | |
Dmitry Skiba | efa3d8e | 2015-06-22 14:52:10 -0700 | [diff] [blame] | 247 | function->addParameter(TConstParameter(ptype1)); |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 248 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 249 | if (ptype2) |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 250 | { |
Dmitry Skiba | efa3d8e | 2015-06-22 14:52:10 -0700 | [diff] [blame] | 251 | function->addParameter(TConstParameter(ptype2)); |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 252 | } |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 253 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 254 | if (ptype3) |
| 255 | { |
Dmitry Skiba | efa3d8e | 2015-06-22 14:52:10 -0700 | [diff] [blame] | 256 | function->addParameter(TConstParameter(ptype3)); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | if (ptype4) |
| 260 | { |
Dmitry Skiba | efa3d8e | 2015-06-22 14:52:10 -0700 | [diff] [blame] | 261 | function->addParameter(TConstParameter(ptype4)); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | if (ptype5) |
| 265 | { |
Dmitry Skiba | efa3d8e | 2015-06-22 14:52:10 -0700 | [diff] [blame] | 266 | function->addParameter(TConstParameter(ptype5)); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | insert(level, function); |
| 270 | } |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 271 | } |
| 272 | |
Zhenyao Mo | e740add | 2014-07-18 17:01:01 -0700 | [diff] [blame] | 273 | TPrecision TSymbolTable::getDefaultPrecision(TBasicType type) const |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 274 | { |
| 275 | if (!SupportsPrecision(type)) |
| 276 | return EbpUndefined; |
| 277 | |
| 278 | // unsigned integers use the same precision as signed |
| 279 | TBasicType baseType = (type == EbtUInt) ? EbtInt : type; |
| 280 | |
| 281 | int level = static_cast<int>(precisionStack.size()) - 1; |
| 282 | assert(level >= 0); // Just to be safe. Should not happen. |
Olli Etuaho | 183d7e2 | 2015-11-20 15:59:09 +0200 | [diff] [blame] | 283 | // If we dont find anything we return this. Some types don't have predefined default precision. |
Zhenyao Mo | 9eedea0 | 2014-05-12 16:02:35 -0700 | [diff] [blame] | 284 | TPrecision prec = EbpUndefined; |
| 285 | while (level >= 0) |
| 286 | { |
| 287 | PrecisionStackLevel::iterator it = precisionStack[level]->find(baseType); |
| 288 | if (it != precisionStack[level]->end()) |
| 289 | { |
| 290 | prec = (*it).second; |
| 291 | break; |
| 292 | } |
| 293 | level--; |
| 294 | } |
| 295 | return prec; |
| 296 | } |