Commit Graph

391 Commits

Author SHA1 Message Date
Ian Romanick 85ba37b97d Always return a value from ast_type_specifier::hir 2010-04-28 18:22:54 -07:00
Ian Romanick 8bec5e92e0 Support structures in glsl_type::generate_constructor_prototype 2010-04-28 18:22:54 -07:00
Ian Romanick ae000fcb2e Implement structures and arrays in ir_dereference::is_lvalue 2010-04-28 18:22:54 -07:00
Ian Romanick 73986a7a26 Ensure that structure fields have non-NULL types 2010-04-28 18:22:54 -07:00
Ian Romanick 1d28b617ba Ensure that anonymous structures have non-NULL names 2010-04-28 18:22:54 -07:00
Ian Romanick 6efaeeea44 Convert structure field dereferences to HIR 2010-04-28 18:22:54 -07:00
Ian Romanick 7ee79fb6b7 Add ir_dereference constructor for structure field dereferences 2010-04-28 18:22:54 -07:00
Ian Romanick 8f755dcb67 Add glsl_type::field_type
Query the type of a structure field
2010-04-28 18:22:54 -07:00
Ian Romanick 3455ce6144 Begin converting structure definitions to IR 2010-04-28 18:22:53 -07:00
Ian Romanick 1f959ab4d6 Use IDENTIFIER instead of TYPE_NAME for structure names
Since there is no track of which names are structure names during parsing,
TYPE_NAME cannot be produced by the lexer.  Use IDENTIFIER and let the AST
processor sort it out.
2010-04-28 18:22:47 -07:00
Kenneth Graunke bf783ecea6 ir_reader: Slightly better error message when failing to read swizzles. 2010-04-28 18:14:54 -07:00
Kenneth Graunke 92eb64cd33 ir_reader: Don't print out the S-Expression.
It's no longer useful for debugging.
2010-04-28 18:14:54 -07:00
Kenneth Graunke b51557fbe2 ir_reader: Read function calls. 2010-04-28 18:14:54 -07:00
Kenneth Graunke b142aeeb20 ir_reader: Replace function prototypes with the definition.
Previously, we just created a new one, which was wrong.
2010-04-28 18:14:54 -07:00
Kenneth Graunke 21128c23c6 ir_reader: Fix incorrect error message for expressions. 2010-04-28 18:14:54 -07:00
Kenneth Graunke 46a223224c Make ir_read_error print out the given S-Expression, for context. 2010-04-28 18:14:54 -07:00
Kenneth Graunke 951632253f ir_reader: Fix for swizzles. 2010-04-28 18:14:54 -07:00
Kenneth Graunke 8df335d7f9 ir_reader: Preliminary work toward reading functions. 2010-04-28 18:14:54 -07:00
Kenneth Graunke 09cad1339d ir_reader: Perform a preliminary pass to scan for function prototypes. 2010-04-28 18:14:54 -07:00
Kenneth Graunke ddf5a011e2 ir_reader: Don't initialize globals, builtins, or constructors.
All of these are currently emitted as part of the IR, so by initializing
them, we actually end up with two copies.  For constructors, we may
eventually wish to avoid emitting them as part of the IR output.
2010-04-28 18:14:54 -07:00
Kenneth Graunke 4ec982fb86 Make ir_read_error set state->error. 2010-04-28 18:14:54 -07:00
Kenneth Graunke 396fa9eba6 ir_reader: Add support for "break" and "continue" in loops.
Includes threading the ir_loop * context through various functions.
2010-04-28 18:14:54 -07:00
Kenneth Graunke 32b305207c ir_reader: Add initial loop support; doesn't yet support break/continue. 2010-04-28 18:14:54 -07:00
Kenneth Graunke 451381c220 ir_reader: Add support for reading (var_ref ...) and (array_ref ...) 2010-04-28 18:14:54 -07:00
Kenneth Graunke 46ef8f19d7 ir_reader: rvalues are instructions too! 2010-04-28 18:14:54 -07:00
Kenneth Graunke 3ea0582803 ir_reader: Add support for reading conditionals: (if ...) 2010-04-28 18:14:54 -07:00
Kenneth Graunke 5794497542 ir_reader: Add support for reading array types.
Also, constify glsl_type pointers; this was necessary to use
glsl_type::get_array_instance.
2010-04-28 18:14:54 -07:00
Kenneth Graunke 9d2ff7617a ir_reader: Add support for reading (return ...) 2010-04-28 18:14:54 -07:00
Kenneth Graunke d1d2ada3c6 ir_reader: Add support for reading variable declarations.
It also now reads a list of instructions, as it should, rather than a
single rvalue.
2010-04-28 18:14:54 -07:00
Kenneth Graunke f955649af3 Partial IR reader.
Currently reads assignments, constants, expressions, and swizzles.
2010-04-28 18:14:53 -07:00
Kenneth Graunke e8b399270d Set language_version to 130 (the max currently supported) when reading IR.
This is necessary so _mesa_glsl_initialize_types can create appropriate
glsl_types and add them to the symbol table.

In the future, we'll want to set it to the max GLSL version supported by
the current driver.
2010-04-28 18:14:53 -07:00
Kenneth Graunke 34350be2cd Add stub ir_reader and new 'i' mode for reading IR rather than GLSL. 2010-04-28 18:14:53 -07:00
Kenneth Graunke 1bfe1c3fdd Add a simple S-Expression reader and printer. 2010-04-28 18:14:36 -07:00
Kenneth Graunke 9d290d786d Use "neg" when printing/reading unary negation rather than "-".
"-" is now only used for binary subtraction.
2010-04-28 15:42:07 -07:00
Kenneth Graunke 3b96996b7e Move array of operator strings out of ir_print_visitor.cpp.
Also implement a reverse-lookup function for use in the IR reader.
2010-04-28 15:42:07 -07:00
Kenneth Graunke bff6013d46 Factor out parameter list replacement for later reuse. 2010-04-28 15:34:52 -07:00
Kenneth Graunke 0d605cb97c Factor out parameter list matching from ast_function::hir for later reuse.
Unfortunately, we still have two kinds of matching - one, with implicit
conversions (for use in calls) and another without them (for finding a
prototype to overwrite when processing a function body).  This commit
does not attempt to coalesce the two.
2010-04-28 15:34:52 -07:00
Kenneth Graunke abd40b1521 Factor out qualifier checking code for later reuse. 2010-04-28 15:34:52 -07:00
Kenneth Graunke 0e385196f6 ir_print_visitor: Re-parenthesize ir_call output. 2010-04-28 15:34:52 -07:00
Kenneth Graunke dde9678162 ir_print_visitor: Print return type of ir_function_signatures. 2010-04-28 15:34:52 -07:00
Kenneth Graunke 405e122a47 ir_print_visitor: Print (constant bool (1)) instead of "true"
It might be better to simply handle "true" in the reader, but since
booleans normally aren't printed as "true" or "false", we may as well go
for consistency.
2010-04-28 15:34:52 -07:00
Kenneth Graunke 2bc582d265 ir_print_visitor: Remove unnecessary parens around expression operands. 2010-04-28 15:34:52 -07:00
Kenneth Graunke 668d0a992a ir_print_visitor: Remove unnecessary parens around array size in types. 2010-04-28 15:34:52 -07:00
Kenneth Graunke aecdefa8c0 ir_print_visitor: Fix unclosed parenthesis in (call... 2010-04-28 15:34:52 -07:00
Kenneth Graunke c84f636c97 ir_print_visitor: Fix unclosed parenthesis in (assign ...
Also remove useless parens around subexpressions.
2010-04-28 15:34:52 -07:00
Kenneth Graunke a02c5afce8 Add parens around printed IR so it's an official list of instructions. 2010-04-28 15:34:52 -07:00
Kenneth Graunke 1168d95109 ir_print_visitor: Remove unnecessary parenthesis around variable names. 2010-04-28 15:34:52 -07:00
Kenneth Graunke 7dd6adbe2e Refactor ir_expression::get_num_operands.
A new static version takes an ir_expression_operation enum, and the
original non-static version now uses it.  This will make it easier to
read operations (where the ir_expression doesn't yet exist).
2010-04-28 15:34:52 -07:00
Kenneth Graunke 1a3a096bf5 ir_print_visitor: print the type of expressions.
This can be useful for debugging - it allows us to see that the inferred
type is what we think it should be.  Furthermore, it will allow the IR
reader to avoid complex, operator-specific type inference.
2010-04-28 15:34:52 -07:00
Kenneth Graunke 295bb7ff8d ir_print_visitor: Remove unnecessary parenthesis around type names.
Parenthesis should only be present for compound types (i.e. arrays
or structures).  For atomic types, simply print the symbol.
2010-04-28 15:34:52 -07:00