Commit Graph

24 Commits

Author SHA1 Message Date
Eric Anholt 6255a1f4c6 ir_dead_code_local: Remove redundant assignments within basic blocks.
This cleans up a bunch of junk code in some of the GLSL parser tests,
and could potentially help real-world too (particularly after copy
propagation has happened).
2010-05-05 11:08:18 -07:00
Eric Anholt 5c89f0ecb9 ir_copy_propagation: New pass to rewrite dereferences to avoid copies.
This is pretty basic.  Right now it only handles pure assignments --
same type on each side, no swizzling, and only within basic blocks.
2010-05-04 17:00:42 -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
Eric Anholt e8e9748722 ir_function_inlining: Implement inlining in many more cases.
We still don't inline for control flow in the inlined function, and we
don't have any limits on what we will inline.
2010-04-23 16:12:44 -07:00
Eric Anholt 8d3e59f1f3 Replace builtin_types.h generation with the generated output.
The script to generate it was longer and more obfuscated than the output.
2010-04-23 16:12:44 -07:00
Eric Anholt 7d21104a8b Remove dead code assignments and variable declarations.
This pass only works on assignments where the variable is never
referenced.  There is no code flow analysis, so it can't do a better
job of avoiding redundant assignments.

For now, the optimizer only does do_dead_code_unlinked(), so it won't
trim the builtin variable list or initializers outside of the scope of
functions.  This is because we don't have the visibility into other
functions that might get linked in in order to eliminate work on
global variables.
2010-04-19 15:33:52 -07:00
Eric Anholt 0d42321ec1 Add support for inlining calls done inside of expressions. 2010-04-16 12:56:18 -07:00
Eric Anholt 5ba9420608 Add an ir_if simplification pass.
This is relatively simple at the moment, recognizing only constant
values, and not (for example) values that are restricted to a range
that make the branching constant.  However, it does remove 59 lines
from the printout of CorrectParse2.vert.
2010-04-14 17:05:13 -07:00
Eric Anholt cad9766118 Inline functions consisting of a return of an expression. 2010-04-08 11:24:06 -07:00
Eric Anholt 62735694a1 Add a constant folding optimization pass. 2010-04-06 11:42:31 -07:00
Ian Romanick 1cf43a4331 Initial bits of constant expression evaluator
Currently only works for constants.  The rest will be added later.
2010-03-30 16:56:50 -07:00
Eric Anholt c22c40015d Implement the first builtin function: exp(). 2010-03-29 12:48:45 -07:00
Eric Anholt f41fc53728 Include other generated sources in BUILT_SOURCES.
Otherwise, having cleaned glsl_parser.h, we'd never regenerate it because
glsl_parser.cpp was already right where it needed to be.
2010-03-23 12:32:25 -07:00
Eric Anholt e5ba18083b Use bash for the built file generation since builtin_types.sh requires it. 2010-03-23 12:32:25 -07:00
Eric Anholt 6985a43832 Clean the built sources with make clean. 2010-03-23 12:32:25 -07:00
Ian Romanick bbddcb3092 Factor ast_type_specifier code out to ast_type.cpp 2010-03-15 14:09:23 -07:00
Ian Romanick 548fa293a3 Move ast_function_expression::hir to ast_function.cpp 2010-03-15 13:04:13 -07:00
Ian Romanick 471471f834 Initial pass at resolving function calls
The code is still really rough and *REALLY* incomplete.  This at least
passes the first few trivially simple test cases.
2010-03-11 14:57:26 -08:00
Ian Romanick adfb0cd740 IR variable: Initial work to support GLSL built-in variables 2010-03-10 10:43:54 -08:00
Ian Romanick 78b51b0fdd IR visitor: Add initial version of ir_visitor classes
The ir_visitor class is the abstract base class for all visitors.
ir_print_visitor contains the beginnings of a concrete visitor class
that will print out an IR sequence in a Lisp / Scheme-like syntax.
2010-03-09 16:26:15 -08:00
Ian Romanick eccf0bf5f2 Make glsl_type a class
Among other benefits, this cleans up a the hackery invovled in
initializing the union field in builtin_types.h.
2010-03-09 15:49:31 -08:00
Ian Romanick 18238de6c3 Make AST->HIR conversion a method of ast_node, re-enable 2010-03-01 13:49:10 -08:00
Ian Romanick d59673c9de autoconf for the ... 2010-02-25 17:17:23 -08:00