chromium/third_party/angle/src/compiler/translator/SymbolTable.h

//
// Copyright 2002 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

#ifndef COMPILER_TRANSLATOR_SYMBOLTABLE_H_
#define COMPILER_TRANSLATOR_SYMBOLTABLE_H_

//
// Symbol table for parsing.  Has these design characteristics:
//
// * Same symbol table can be used to compile many shaders, to preserve
//   effort of creating and loading with the large numbers of built-in
//   symbols.
//
// * Name mangling will be used to give each function a unique name
//   so that symbol table lookups are never ambiguous.  This allows
//   a simpler symbol table structure.
//
// * Pushing and popping of scope, so symbol table will really be a stack
//   of symbol tables.  Searched from the top, with new inserts going into
//   the top.
//
// * Constants:  Compile time constant symbols will keep their values
//   in the symbol table.  The parser can substitute constants at parse
//   time, including doing constant folding and constant propagation.
//
// * No temporaries:  Temporaries made from operations (+, --, .xy, etc.)
//   are tracked in the intermediate representation, not the symbol table.
//

#include <limits>
#include <memory>
#include <set>

#include "common/angleutils.h"
#include "compiler/translator/ExtensionBehavior.h"
#include "compiler/translator/ImmutableString.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/IntermNode.h"
#include "compiler/translator/Symbol.h"
#include "compiler/translator/SymbolTable_autogen.h"

enum class Shader : uint8_t
{};

namespace sh
{

struct UnmangledBuiltIn
{};

VarPointer;
ValidateExtension;

enum class Spec : uint8_t
{};

constexpr uint16_t kESSL1Only =;
// Some built-ins from backend shader languages are made available internally to ESSL for use in
// tree transformations.  This (invalid) shader version is used to select those built-ins.  This
// value needs to be larger than all other shader versions.
constexpr uint16_t kESSLInternalBackendBuiltIns =;

// The version assigned to |kESSLInternalBackendBuiltIns| should be good until OpenGL 20.0!
static_assert;

static_assert;

#define EXT_INDEX(Ext)

class SymbolRule
{};

constexpr SymbolRule::SymbolRule(Spec spec,
                                 int version,
                                 Shader shaders,
                                 size_t extensionIndex,
                                 const TSymbol *symbol)
    :{}

constexpr SymbolRule::SymbolRule(Spec spec,
                                 int version,
                                 Shader shaders,
                                 size_t extensionIndex,
                                 VarPointer resourceVar)
    :{}

template <Spec spec, int version, Shader shaders, size_t extensionIndex, typename T>
// static
constexpr SymbolRule SymbolRule::Get(T value)
{}

const TSymbol *FindMangledBuiltIn(ShShaderSpec shaderSpec,
                                  int shaderVersion,
                                  sh::GLenum shaderType,
                                  const ShBuiltInResources &resources,
                                  const TSymbolTableBase &symbolTable,
                                  const SymbolRule *rules,
                                  uint16_t startIndex,
                                  uint16_t endIndex);

class UnmangledEntry
{};

template <size_t ESSLExtCount>
constexpr UnmangledEntry::UnmangledEntry(const char *name,
                                         const std::array<TExtension, ESSLExtCount> &esslExtensions,
                                         TExtension glslExtension,
                                         int esslVersion,
                                         int glslVersion,
                                         Shader shaderType)
    : mName(name),
      mESSLExtensions{}

class TSymbolTable : angle::NonCopyable, TSymbolTableBase
{};

}  // namespace sh

#endif  // COMPILER_TRANSLATOR_SYMBOLTABLE_H_