Commit Graph

465 Commits

Author SHA1 Message Date
Ian Romanick 2fd22486d4 Reimplement ir_copy_propagation_visitor using ir_hierarchical_vistor 2010-05-26 17:04:19 -07:00
Ian Romanick 4b389492b9 Reimplement ir_expression_flattening_visitor using ir_hierarchical_vistor 2010-05-26 16:07:49 -07:00
Kenneth Graunke 13e1b6b725 ir_reader: Read record_refs.
Also changes the print visitor to not emit extraneous parenthesis.
2010-05-26 15:24:53 -07:00
Kenneth Graunke 350bd70348 ir_reader: Fix reading of array deferences and correct error messages.
Previously, the syntax was (array_ref <variable name> <index>), but the
subject is now a general rvalue (not a name).  In particular, it might
be a (var_ref ...).

Also, remove "expected ... or (swiz)" from error messages; swiz is not
allowed inside a var_ref.
2010-05-26 15:24:40 -07:00
Ian Romanick a9159f9e87 Fix setting the maximum accessed array element
Array dereferences now point to variable dereferences instead of
pointing directly to variables.  This necessitated some changes to the
way the variable is accessed when setting the maximum index array element.
2010-05-26 15:23:25 -07:00
Ian Romanick fd55da2147 ir_dereference::mode is no longer used, kill with fire 2010-05-26 15:23:25 -07:00
Ian Romanick b067db2e25 Refactor whole-variable assigment checking into member function 2010-05-26 15:23:25 -07:00
Ian Romanick 36ea28646c Refactor ir_dereference data fields to subclasses 2010-05-26 15:23:25 -07:00
Ian Romanick 7fe3de6fde Replace open coded deref navigation with hierarchical visitors 2010-05-26 15:23:25 -07:00
Ian Romanick c7b1046a9f Refactor ir_dereference support for ir_visitor
Move the accept method for visitors from ir_dereference to the derived
classes.
2010-05-26 15:23:25 -07:00
Ian Romanick f3a002b503 Refactor ir_dereference support for ir_hierarchical_visitor
Move the accept method for hierarchical visitors from ir_dereference
to the derived classes.  This was mostly straight-forward, but I
suspect that ir_dead_code_local may be broken now.
2010-05-26 15:23:25 -07:00
Ian Romanick 70fe8b6663 Begin refactoring ir_dereference
Create separate subclasses of ir_dereference for variable, array, and
record dereferences.  As a side effect, array and record dereferences
no longer point to ir_variable objects directly.  Instead they each
point to an ir_dereference_variable object.

This is the first of several steps in the refactoring process.  The
intention is that ir_dereference will eventually become an abstract
base class.
2010-05-26 15:23:19 -07:00
Ian Romanick 461c294ac5 Use ir_rvalue::variable_referenced instead of open coding it 2010-05-18 13:53:20 +02:00
Ian Romanick c65cfef317 ir_visit_tree is no longer used, remove ir_visit_tree.{cpp,h} 2010-05-17 12:03:13 -07:00
Ian Romanick 551c9c0deb Reimplement kill_for_derefs using ir_hierarchical_vistor
The output of all test cases was verified to be the same using diff.
2010-05-17 12:03:13 -07:00
Ian Romanick 77dd4f3536 Reimplement has_call_callback using ir_hierarchical_vistor
This has the added advantage that it will stop traversing the tree as
soon as the first call is found.

The output of all test cases was verified to be the same using diff.
2010-05-17 12:03:13 -07:00
Ian Romanick a0b4f3d631 Reimplement ir_if_simplicifation_visitor using ir_hierarchical_vistor
The output of all test cases was verified to be the same using diff.
2010-05-17 12:03:13 -07:00
Ian Romanick 458d5c61ef Make visit_list_elements safe against node removals 2010-05-17 12:03:13 -07:00
Ian Romanick 671e4f6321 Reimplement ir_function_can_inline_visitor using ir_hierarchical_vistor
The output of all test cases was verified to be the same using diff.
2010-05-17 12:03:13 -07:00
Ian Romanick b5a7cf9344 Reimplement ir_dead_code_visitor using ir_hierarchical_vistor
The output of all test cases was verified to be the same using diff.
2010-05-17 12:03:13 -07:00
Ian Romanick 8895bae55b Add ir_hierarchical_visitor base class and associated infrastructure
This type of visitor should eventually replace all or almost all
current uses of ir_visitor.
2010-05-17 12:03:13 -07:00
Ian Romanick 86790dd43f Replace find_dead_code with visit_exec_list
find_dead_code appears to be an open-coded version of visit_exec_list
that was implemented first.
2010-05-17 12:03:13 -07:00
Ian Romanick 5d82e239f9 Use ir_rvalue::variable_referenced instead of open-coding it 2010-05-14 17:36:00 -07:00
Ian Romanick 2b3c476fa0 Add ir_rvalue::variable_referenced 2010-05-14 17:35:42 -07:00
Kenneth Graunke 67e07ad3a3 Refresh autogenerated builtin_function.cpp. 2010-05-14 16:34:46 -07:00
Kenneth Graunke c8de850dd5 Implement "tan" builtin. 2010-05-14 16:34:46 -07:00
Kenneth Graunke 57e7da173e Implement "sin" and "cos" builtins via new expression operators. 2010-05-14 16:34:46 -07:00
Kenneth Graunke 6a9b1e1f06 Implement "cross" builtin. 2010-05-14 16:34:46 -07:00
Kenneth Graunke d9bda3c29d Implement "fract" builtin. 2010-05-14 16:34:46 -07:00
Kenneth Graunke a4b7b5a654 Implement "sign" builtin via a new expression operator. 2010-05-14 16:34:46 -07:00
Kenneth Graunke c2de187523 Implement "smoothstep" builtin. 2010-05-14 16:34:46 -07:00
Kenneth Graunke a2b63d3ed1 Implement "step" builtin. 2010-05-14 16:34:46 -07:00
Kenneth Graunke 9287ecc3aa Integrate generate_builtins.pl into the build process.
make will now regenerate builtin_function.cpp whenever you
change/add/remove files in the builtins/* folders.
2010-05-14 16:34:46 -07:00
Kenneth Graunke b3262128fe Replace old builtin_function.cpp with new autogenerated one. 2010-05-14 16:34:46 -07:00
Kenneth Graunke 4c7367b3f9 Add a perl script to generate builtin_function.cpp.
Usage: ./builtins/tools/generate_builtins.pl > builtin_function.cpp
2010-05-14 16:34:46 -07:00
Kenneth Graunke a40e68b256 Fix bogus expression typing in various builtins. 2010-05-14 16:34:46 -07:00
Kenneth Graunke e4afc64290 Initial commit of IR for builtins.
These were all generated by Eric's existing builtin_functions.cpp; I split
the uvec* signatures out of 110 into the 130 folder.
2010-05-14 16:34:46 -07:00
Kenneth Graunke f6c90d8b34 ir_reader: Set function signatures as defined. 2010-05-14 16:34:46 -07:00
Eric Anholt c05bc5b7cc FS gl_FragCoord and and gl_FrontFacing are FS ins, not outs. 2010-05-14 16:11:37 -07:00
Ian Romanick 2384937835 Fix function call parameter printer to omit extraneous leading comma
The output of all test cases was verified to be the same using diff.
2010-05-14 16:07:04 -07:00
Ian Romanick 2b97dc657a Replace many uses of foreach_list with foreach_list_typed 2010-05-10 17:42:05 -07:00
Ian Romanick 4cfbad9e4d exec_list: Add foreach_list_typed and foreach_list_typed_const
These variations are parameterized by the type of the nodes in the
list.  This enables skipping the explicit usage of exec_node_data in
the loop body.
2010-05-10 17:40:41 -07:00
Ian Romanick 304ea90233 Convert ast_node use of simple_node to exec_list and exec_node 2010-05-10 11:17:53 -07:00
Ian Romanick 752c905b8c exec_list: Add simpler exec_list for-each macros 2010-05-10 11:17:23 -07:00
Ian Romanick 43bfc2b6b5 exec_list: Add macros to get ptr to structure containing a node
This has some ugly hackery to work-around C++ fail.  I have
emperically determined that it works in all the cases that matter.
2010-05-10 11:16:24 -07:00
Ian Romanick 4f9d72fa9e Loop bodies, then-statements, and else-statements are not lists
The statement making up a loop body, a then-statement, or an
else-statement are single nodes.  If the statement is a block, the
single node will be an ast_compound_statement.  There is no need to
loop at the top level when processing these statements.
2010-05-10 11:10:26 -07:00
Ian Romanick f4e06981cc Remove unnecessary include of simple_list.h 2010-05-10 11:04:22 -07:00
Ian Romanick 3521f0bdd5 Store AST function call parameters in expressions
Previously the list of function call parameters was stored as a
circular list in ast_expression::subexpressions[1].  They are now
stored as a regular list in ast_expression::expressions.
2010-05-10 11:04:02 -07:00
Eric Anholt bdd9b1f3ff Move optimization pass prototypes to a single header. 2010-05-05 11:47:33 -07:00
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