From d949a9afb0a01e9678a4343f66b056b41a2e48a9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 10 Mar 2010 09:55:22 -0800 Subject: [PATCH] Move top-level AST to HIR conversion to _mesa_ast_to_hir --- ast.h | 3 +++ ast_to_hir.cpp | 11 +++++++++++ glsl_parser_extras.cpp | 4 +--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ast.h b/ast.h index fa84a91..3631692 100644 --- a/ast.h +++ b/ast.h @@ -492,6 +492,9 @@ public: }; +extern void +_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); + extern struct ir_instruction * _mesa_ast_field_selection_to_hir(const struct ast_expression *expr, exec_list *instructions, diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index becc832..e371007 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -56,6 +56,17 @@ #include "glsl_types.h" #include "ir.h" +void +_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) +{ + struct simple_node *ptr; + + foreach (ptr, & state->translation_unit) { + ((ast_node *)ptr)->hir(instructions, state); + } +} + + static const struct glsl_type * arithmetic_result_type(const struct glsl_type *type_a, const struct glsl_type *type_b, diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index 222f06b..d066ca3 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -718,9 +718,7 @@ main(int argc, char **argv) ((ast_node *)ptr)->print(); } - foreach (ptr, & state.translation_unit) { - ((ast_node *)ptr)->hir(&instructions, &state); - } + _mesa_ast_to_hir(&instructions, &state); printf("\n\n"); foreach_iter(exec_list_iterator, iter, instructions) { -- 2.7.4