Commit 18238de6 authored by Ian Romanick's avatar Ian Romanick

Make AST->HIR conversion a method of ast_node, re-enable

parent d59673c9
......@@ -25,8 +25,7 @@ AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = glsl
glsl_SOURCES = symbol_table.c hash_table.c glsl_types.c \
glsl_parser.ypp glsl_lexer.lpp glsl_parser_extras.cpp \
ast_expr.cpp
# ast_to_hir.cpp ir.cpp hir_field_selection.cpp
ast_expr.cpp ast_to_hir.cpp ir.cpp hir_field_selection.cpp
BUILT_SOURCES = glsl_parser.h builtin_types.h
......
......@@ -37,6 +37,8 @@ class ast_node : public simple_node {
public:
virtual ~ast_node();
virtual void print(void) const;
virtual ir_instruction *hir(struct simple_node *instructions,
struct _mesa_glsl_parse_state *state);
/**
* Retrieve the source location of an AST node
......@@ -149,6 +151,9 @@ public:
static const char *operator_string(enum ast_operators op);
virtual ir_instruction *hir(struct simple_node *instructions,
struct _mesa_glsl_parse_state *state);
virtual void print(void) const;
enum ast_operators oper;
......@@ -193,6 +198,9 @@ public:
ast_compound_statement(int new_scope, ast_node *statements);
virtual void print(void) const;
virtual ir_instruction *hir(struct simple_node *instructions,
struct _mesa_glsl_parse_state *state);
int new_scope;
struct simple_node statements;
};
......@@ -330,6 +338,9 @@ public:
ast_declarator_list(ast_fully_specified_type *);
virtual void print(void) const;
virtual ir_instruction *hir(struct simple_node *instructions,
struct _mesa_glsl_parse_state *state);
ast_fully_specified_type *type;
struct simple_node declarations;
......@@ -348,6 +359,9 @@ class ast_parameter_declarator : public ast_node {
public:
virtual void print(void) const;
virtual ir_instruction *hir(struct simple_node *instructions,
struct _mesa_glsl_parse_state *state);
ast_fully_specified_type *type;
char *identifier;
int is_array;
......@@ -392,6 +406,9 @@ public:
ast_expression_statement(ast_expression *);
virtual void print(void) const;
virtual ir_instruction *hir(struct simple_node *instructions,
struct _mesa_glsl_parse_state *state);
ast_expression *expression;
};
......@@ -466,6 +483,9 @@ class ast_function_definition : public ast_node {
public:
virtual void print(void) const;
virtual ir_instruction *hir(struct simple_node *instructions,
struct _mesa_glsl_parse_state *state);
ast_function *prototype;
ast_compound_statement *body;
};
......
This diff is collapsed.
......@@ -698,12 +698,10 @@ main(int argc, char **argv)
((ast_node *)ptr)->print();
}
#if 0
make_empty_list(& instructions);
foreach (ptr, & state.translation_unit) {
_mesa_ast_to_hir(ptr, &instructions, &state);
((ast_node *)ptr)->hir(&instructions, &state);
}
#endif
_mesa_symbol_table_dtor(state.symbols);
......
......@@ -135,7 +135,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
YYLTYPE loc;
op = _mesa_ast_to_hir(expr->subexpressions[0], instructions, state);
op = expr->subexpressions[0]->hir(instructions, state);
deref = new ir_dereference(op);
/* Initially assume that the resulting type of the field selection is an
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment