|
Blender V5.3
|
#include <symbol_table.hh>
Classes | |
| struct | Allocator |
Public Member Functions | |
| template<typename SymbolT> | |
| SymbolT * | alloc (SymbolT &&sym) |
| SymbolTable (ParserBase &builtin_parser) | |
| void | parse (ast::LocalScope node, ErrorHandler &err_handler) |
| Result< StringPair > | mangle_identifier (ast::TemplateArgList args, ast::TemplateParamList list, const SymbolScope &scope) const |
| Result< StringPair > | mangle_identifier (const SymbolFunctionTemplate &tmp, ast::FuncParamList list, const SymbolScope &scope) const |
| Result< ExpressionResult > | expr_type_analysis (const SymbolScope &scope, ast::Node start_node, bool is_reference=false) const |
| Result< SymbolClass * > | resolve_auto_type (SymbolScope &scope, ast::Declarator decl) const |
| Result< string > | expr_to_string (const SymbolScope &scope, ast::Node start, int &node_count, bool allow_compilation_constant=false) const |
| SymbolClass * | get_literal_type (string_view lit) const |
| MatchRank | get_conversion_rank (const SymbolClass *from, const SymbolClass *to, const bool ctor_conversion=false) const |
| SymbolClass * | to_class (builtin::ClassId id) const |
| SymbolClass * | make_type (SymbolClass *base, int size) const |
Static Public Attributes | |
| static constexpr const char * | err_symbol = "ERROR_SYMBOL" |
| static constexpr const char * | subscript_operator_id = "arr_op_" |
Definition at line 33 of file symbol_table.hh.
| bsl::SymbolTable::SymbolTable | ( | ParserBase & | builtin_parser | ) |
Definition at line 22 of file symbol_table.cc.
| SymbolT * bsl::SymbolTable::alloc | ( | SymbolT && | sym | ) |
| Result< string > bsl::SymbolTable::expr_to_string | ( | const SymbolScope & | scope, |
| ast::Node | start, | ||
| int & | node_count, | ||
| bool | allow_compilation_constant = false ) const |
Definition at line 126 of file symbol_table.cc.
References bsl::AstNodeException::AstNodeException(), expr_to_string(), bsl::ExprCannotContainFunctionCalls, blender::gpu::shader::parser::ast::ExprSub, blender::gpu::shader::parser::ast::FuncCall, bsl::Symbol::identifier, bsl::SymbolVariable::is_compilation_const, bsl::SymbolVariable::is_constexpr, bsl::SymbolVariable::is_error, blender::gpu::shader::parser::ast::Node::is_valid(), blender::gpu::shader::parser::ast::LocalVar, bsl::SymbolScope::lookup_variable(), blender::gpu::shader::parser::ast::Node::next(), bsl::NonConstVariableInExpr, blender::gpu::shader::parser::ast::NumConst, blender::gpu::shader::parser::ast::Op, str, blender::gpu::shader::parser::ast::Node::type(), bsl::SymbolVariable::type, bsl::UnknownVariable, bsl::UnsupportedSymbolInExpr, and bsl::SymbolVariable::value_str().
Referenced by expr_to_string().
| Result< ExpressionResult > bsl::SymbolTable::expr_type_analysis | ( | const SymbolScope & | scope, |
| ast::Node | start_node, | ||
| bool | is_reference = false ) const |
Definition at line 824 of file type_checker.cc.
References blender::gpu::shader::metadata::assert, bsl::ExpressionTypeParser::ExpressionTypeParser(), blender::gpu::shader::parser::ast::Node::is_valid(), and blender::gpu::shader::parser::ast::Node::type().
Referenced by bsl::SymbolParser::eval_scalar_initializer_list(), bsl::SymbolParser::initialize_assign(), mangle_identifier(), mangle_identifier(), bsl::SymbolParser::parse_structured_binding(), bsl::SymbolParser::parse_template_arguments(), bsl::SymbolParser::parse_var_decl(), resolve_auto_type(), and bsl::SymbolFunction::to_arg_types().
| MatchRank bsl::SymbolTable::get_conversion_rank | ( | const SymbolClass * | from, |
| const SymbolClass * | to, | ||
| const bool | ctor_conversion = false ) const |
Definition at line 663 of file symbol_table.cc.
References bsl::SymbolClass::builtin_class, bsl::Conversion, bsl::Exact, bsl::SymbolClass::is_builtin(), bsl::SymbolClass::is_enum, bsl::None, and bsl::Promotion.
| SymbolClass * bsl::SymbolTable::get_literal_type | ( | string_view | lit | ) | const |
Definition at line 635 of file symbol_table.cc.
References bool_cls, float_cls, int_cls, str, and uint_cls.
Referenced by bsl::SymbolParser::parse_preprocessor().
| SymbolClass * bsl::SymbolTable::make_type | ( | SymbolClass * | base, |
| int | size ) const |
Definition at line 336 of file operator.cc.
References bool2_cls, bool3_cls, bool4_cls, bool_cls, char2_cls, char3_cls, char4_cls, char_cls, float2_cls, float2x2_cls, float2x3_cls, float2x4_cls, float3_cls, float3x2_cls, float3x3_cls, float3x4_cls, float4_cls, float4x2_cls, float4x3_cls, float4x4_cls, float_cls, half2_cls, half3_cls, half4_cls, half_cls, int2_cls, int3_cls, int4_cls, int_cls, short2_cls, short3_cls, short4_cls, short_cls, uchar2_cls, uchar3_cls, uchar4_cls, uchar_cls, uint2_cls, uint3_cls, uint4_cls, uint_cls, ushort2_cls, ushort3_cls, ushort4_cls, and ushort_cls.
| Result< StringPair > bsl::SymbolTable::mangle_identifier | ( | ast::TemplateArgList | args, |
| ast::TemplateParamList | list, | ||
| const SymbolScope & | scope ) const |
Definition at line 61 of file symbol_table.cc.
References abs, blender::gpu::shader::metadata::assert, bsl::AstNodeException::AstNodeException(), blender::gpu::shader::parser::ast::Node::child_count(), blender::gpu::shader::parser::ast::Node::child_first(), blender::gpu::shader::parser::ast::Node::children_range(), expr_type_analysis(), blender::gpu::shader::parser::ast::LocalVar::identifier(), blender::gpu::shader::parser::ast::Node::is_valid(), blender::gpu::shader::parser::ast::LocalVar, bsl::SymbolScope::lookup_class_base(), blender::gpu::shader::parser::ast::Node::next(), blender::result, blender::gpu::shader::parser::ast::Node::str(), blender::gpu::shader::parser::ast::IdQualified::template_params(), bsl::TemplateInvalidArg, bsl::TemplateMissingArgument, bsl::TemplateMissingParametersForType, bsl::TemplateParameterNotConstexpr, to_string(), blender::gpu::shader::parser::ast::Node::type(), lexit::Typename, and bsl::UnknownIdentifier.
Referenced by bsl::SymbolTemplate< T >::lookup_adl(), bsl::SymbolTemplate< T >::lookup_inst(), bsl::SymbolParser::parse_template_inst(), and bsl::SymbolParser::parse_template_spec().
| Result< StringPair > bsl::SymbolTable::mangle_identifier | ( | const SymbolFunctionTemplate & | tmp, |
| ast::FuncParamList | list, | ||
| const SymbolScope & | scope ) const |
Definition at line 75 of file symbol_template.cc.
References err_symbol, expr_type_analysis(), blender::result, and bsl::SymbolTemplate< T >::temp_arg_index_in_fn_arg.
| void bsl::SymbolTable::parse | ( | ast::LocalScope | node, |
| ErrorHandler & | err_handler ) |
Definition at line 1328 of file symbol.cc.
References blender::gpu::shader::parser::ErrorHandler::err, node, bsl::SymbolParser::parse_scope(), and root.
| Result< SymbolClass * > bsl::SymbolTable::resolve_auto_type | ( | SymbolScope & | scope, |
| ast::Declarator | decl ) const |
Definition at line 29 of file symbol_table.cc.
References bsl::AutoTypeMultipleExpressions, bsl::AutoTypeNestedInitializer, blender::gpu::shader::parser::ast::Node::child_first(), err_symbol, blender::gpu::shader::parser::ast::AssignStmt::expr(), expr_type_analysis(), init(), blender::gpu::shader::parser::ast::AssignStmt::initializer_list(), blender::gpu::shader::parser::ast::InitializerList, blender::gpu::shader::parser::ast::Node::is_valid(), bsl::SymbolScope::lookup_class(), node, and root.
Referenced by bsl::SymbolParser::parse_var_decl().
| SymbolClass * bsl::SymbolTable::to_class | ( | builtin::ClassId | id | ) | const |
Definition at line 238 of file operator.cc.
References bool2_cls, bsl::builtin::bool2_t, bool3_cls, bsl::builtin::bool3_t, bool4_cls, bsl::builtin::bool4_t, bool_cls, bsl::builtin::bool_t, char2_cls, bsl::builtin::char2_t, char3_cls, bsl::builtin::char3_t, char4_cls, bsl::builtin::char4_t, char_cls, bsl::builtin::char_t, err_cls, float2_cls, bsl::builtin::float2_t, float2x2_cls, bsl::builtin::float2x2_t, float2x3_cls, bsl::builtin::float2x3_t, float2x4_cls, bsl::builtin::float2x4_t, float3_cls, bsl::builtin::float3_t, float3x2_cls, bsl::builtin::float3x2_t, float3x3_cls, bsl::builtin::float3x3_t, float3x4_cls, bsl::builtin::float3x4_t, float4_cls, bsl::builtin::float4_t, float4x2_cls, bsl::builtin::float4x2_t, float4x3_cls, bsl::builtin::float4x3_t, float4x4_cls, bsl::builtin::float4x4_t, float_cls, bsl::builtin::float_t, half2_cls, bsl::builtin::half2_t, half3_cls, bsl::builtin::half3_t, half4_cls, bsl::builtin::half4_t, half_cls, bsl::builtin::half_t, int2_cls, bsl::builtin::int2_t, int3_cls, bsl::builtin::int3_t, int4_cls, bsl::builtin::int4_t, int_cls, bsl::builtin::int_t, short2_cls, bsl::builtin::short2_t, short3_cls, bsl::builtin::short3_t, short4_cls, bsl::builtin::short4_t, short_cls, bsl::builtin::short_t, uchar2_cls, bsl::builtin::uchar2_t, uchar3_cls, bsl::builtin::uchar3_t, uchar4_cls, bsl::builtin::uchar4_t, uchar_cls, bsl::builtin::uchar_t, uint2_cls, bsl::builtin::uint2_t, uint3_cls, bsl::builtin::uint3_t, uint4_cls, bsl::builtin::uint4_t, uint_cls, bsl::builtin::uint_t, ushort2_cls, bsl::builtin::ushort2_t, ushort3_cls, bsl::builtin::ushort3_t, ushort4_cls, bsl::builtin::ushort4_t, ushort_cls, and bsl::builtin::ushort_t.
| SymbolClass* bsl::SymbolTable::bool2_cls = nullptr |
Definition at line 98 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::bool32_t_cls = nullptr |
Definition at line 110 of file symbol_table.hh.
| SymbolClass* bsl::SymbolTable::bool3_cls = nullptr |
Definition at line 99 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::bool4_cls = nullptr |
Definition at line 100 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::bool_cls = nullptr |
Definition at line 97 of file symbol_table.hh.
Referenced by get_literal_type(), bsl::SymbolParser::initialize_constexpr(), make_type(), bsl::SymbolParser::parse_preprocessor(), and to_class().
| SymbolClass* bsl::SymbolTable::char2_cls = nullptr |
Definition at line 70 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::char3_cls = nullptr |
Definition at line 77 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::char4_cls = nullptr |
Definition at line 84 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::char_cls = nullptr |
Definition at line 60 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| Allocator<SymbolClass> bsl::SymbolTable::cls_arena |
Definition at line 51 of file symbol_table.hh.
Referenced by bsl::SymbolParser::parse_template_decl().
| SymbolClass* bsl::SymbolTable::err_cls = nullptr |
Definition at line 59 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), bsl::SymbolParser::parse_func_forward_decl(), bsl::SymbolParser::parse_template_decl(), and to_class().
| SymbolFunction* bsl::SymbolTable::err_func = nullptr |
Definition at line 57 of file symbol_table.hh.
|
staticconstexpr |
Definition at line 35 of file symbol_table.hh.
Referenced by bsl::SymbolTemplate< T >::lookup_adl(), bsl::SymbolTemplate< T >::lookup_inst(), bsl::SymbolFunction::lookup_overload(), mangle_identifier(), and resolve_auto_type().
| SymbolVariable* bsl::SymbolTable::err_var = nullptr |
Definition at line 56 of file symbol_table.hh.
| SymbolClass* bsl::SymbolTable::float2_cls = nullptr |
Definition at line 91 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float2x2_cls = nullptr |
Definition at line 101 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float2x3_cls = nullptr |
Definition at line 104 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float2x4_cls = nullptr |
Definition at line 105 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float3_cls = nullptr |
Definition at line 92 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float3x2_cls = nullptr |
Definition at line 106 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float3x3_cls = nullptr |
Definition at line 102 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float3x4_cls = nullptr |
Definition at line 107 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float4_cls = nullptr |
Definition at line 93 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float4x2_cls = nullptr |
Definition at line 108 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float4x3_cls = nullptr |
Definition at line 109 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float4x4_cls = nullptr |
Definition at line 103 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::float_cls = nullptr |
Definition at line 67 of file symbol_table.hh.
Referenced by get_literal_type(), bsl::SymbolParser::initialize_constexpr(), make_type(), bsl::SymbolParser::parse_preprocessor(), and to_class().
| Allocator<SymbolFunction> bsl::SymbolTable::fun_arena |
Definition at line 50 of file symbol_table.hh.
Referenced by bsl::SymbolParser::parse_func_forward_decl(), bsl::SymbolParser::parse_preprocessor(), and bsl::SymbolParser::parse_template_decl().
| SymbolClass* bsl::SymbolTable::half2_cls = nullptr |
Definition at line 76 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::half3_cls = nullptr |
Definition at line 83 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::half4_cls = nullptr |
Definition at line 90 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::half_cls = nullptr |
Definition at line 66 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| unordered_map<int, string> bsl::SymbolTable::image_formats |
Definition at line 112 of file symbol_table.hh.
| SymbolClass* bsl::SymbolTable::int2_cls = nullptr |
Definition at line 72 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::int3_cls = nullptr |
Definition at line 79 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::int4_cls = nullptr |
Definition at line 86 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::int_cls = nullptr |
Definition at line 62 of file symbol_table.hh.
Referenced by get_literal_type(), bsl::SymbolParser::initialize_constexpr(), make_type(), bsl::SymbolParser::parse_preprocessor(), bsl::SymbolParser::parse_var_decl(), and to_class().
| SymbolClass* bsl::SymbolTable::packed_float2_cls = nullptr |
Definition at line 94 of file symbol_table.hh.
| SymbolClass* bsl::SymbolTable::packed_float3_cls = nullptr |
Definition at line 95 of file symbol_table.hh.
| SymbolClass* bsl::SymbolTable::packed_float4_cls = nullptr |
Definition at line 96 of file symbol_table.hh.
| SymbolScope* bsl::SymbolTable::root = nullptr |
Definition at line 118 of file symbol_table.hh.
Referenced by bsl::SymbolTemplate< T >::lookup_adl(), bsl::SymbolScope::lookup_function(), bsl::SymbolTemplate< T >::lookup_inst(), bsl::SymbolFunction::lookup_overload(), parse(), bsl::SymbolParser::parse_preprocessor(), resolve_auto_type(), and SymbolTable().
| Allocator<SymbolScope> bsl::SymbolTable::scp_arena |
Definition at line 52 of file symbol_table.hh.
Referenced by bsl::SymbolParser::parse_local_scope(), bsl::SymbolParser::parse_namespace(), and SymbolTable().
| SymbolClass* bsl::SymbolTable::short2_cls = nullptr |
Definition at line 71 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::short3_cls = nullptr |
Definition at line 78 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::short4_cls = nullptr |
Definition at line 85 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::short_cls = nullptr |
Definition at line 61 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::str_cls = nullptr |
Definition at line 69 of file symbol_table.hh.
|
staticconstexpr |
Definition at line 114 of file symbol_table.hh.
Referenced by bsl::CodegenContext::CodegenExpressionParser::subscript().
| Allocator<SymbolClassTemplate> bsl::SymbolTable::tmp_cls_arena |
Definition at line 53 of file symbol_table.hh.
Referenced by bsl::SymbolParser::parse_template_decl().
| Allocator<SymbolFunctionTemplate> bsl::SymbolTable::tmp_fun_arena |
Definition at line 54 of file symbol_table.hh.
Referenced by bsl::SymbolParser::parse_template_decl().
| SymbolClass* bsl::SymbolTable::uchar2_cls = nullptr |
Definition at line 73 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::uchar3_cls = nullptr |
Definition at line 80 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::uchar4_cls = nullptr |
Definition at line 87 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::uchar_cls = nullptr |
Definition at line 63 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::uint2_cls = nullptr |
Definition at line 75 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::uint3_cls = nullptr |
Definition at line 82 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::uint4_cls = nullptr |
Definition at line 89 of file symbol_table.hh.
Referenced by bsl::SymbolParser::initialize_constexpr(), make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::uint_cls = nullptr |
Definition at line 65 of file symbol_table.hh.
Referenced by get_literal_type(), bsl::SymbolParser::initialize_constexpr(), make_type(), bsl::SymbolParser::parse_preprocessor(), bsl::SymbolParser::parse_var_decl(), and to_class().
| SymbolClass* bsl::SymbolTable::ushort2_cls = nullptr |
Definition at line 74 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::ushort3_cls = nullptr |
Definition at line 81 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::ushort4_cls = nullptr |
Definition at line 88 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| SymbolClass* bsl::SymbolTable::ushort_cls = nullptr |
Definition at line 64 of file symbol_table.hh.
Referenced by make_type(), and to_class().
| Allocator<SymbolVariable> bsl::SymbolTable::var_arena |
Definition at line 49 of file symbol_table.hh.
Referenced by bsl::SymbolParser::parse_enum_value(), bsl::SymbolParser::parse_function_arguments(), bsl::SymbolParser::parse_loop_arguments(), bsl::SymbolParser::parse_pipeline_decl(), bsl::SymbolParser::parse_preprocessor(), bsl::SymbolParser::parse_structured_binding(), bsl::SymbolParser::parse_template_arguments(), and bsl::SymbolParser::parse_var_decl().
| SymbolClass* bsl::SymbolTable::void_cls = nullptr |
Definition at line 68 of file symbol_table.hh.
Referenced by bsl::SymbolParser::parse_function_return_type(), and bsl::SymbolParser::parse_pipeline_decl().