summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_expression_flattening.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Use typed foreach_in_list instead of foreach_list.Matt Turner2014-07-011-3/+1
| | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glsl: Remove unused include in expr.flatt.Thomas Helland2014-06-101-2/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system. Reviewed-by: Tom Stellard <thomas.stellard@amd.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Thomas Helland <thomashelland90@gmail.com>
* glsl: Convert piles of foreach_iter to the newer foreach_list macro.Kenneth Graunke2014-01-131-2/+2
| | | | | | | | | | | | | foreach_iter and exec_list_iterators have been deprecated for some time now; we just hadn't ever bothered to convert code to the newer foreach_list and foreach_list_safe macros. In these cases, we aren't editing the list, so we can use foreach_list rather than foreach_list_safe. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glsl: Convert ir_call to be a statement rather than a value.Kenneth Graunke2012-04-021-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Aside from ir_call, our IR is cleanly split into two classes: - Statements (typeless; used for side effects, control flow) - Values (deeply nestable, pure, typed expression trees) Unfortunately, ir_call confused all this: - For void functions, we placed ir_call directly in the instruction stream, treating it as an untyped statement. Yet, it was a subclass of ir_rvalue, and no other ir_rvalue could be used in this way. - For functions with a return value, ir_call could be placed in arbitrary expression trees. While this fit naturally with the source language, it meant that expressions might not be pure, making it difficult to transform and optimize them. To combat this, we always emitted ir_call directly in the RHS of an ir_assignment, only using a temporary variable in expression trees. Many passes relied on this assumption; the acos and atan built-ins violated it. This patch makes ir_call a statement (ir_instruction) rather than a value (ir_rvalue). Non-void calls now take a ir_dereference of a variable, and store the return value there---effectively a call and assignment rolled into one. They cannot be embedded in expressions. All expression trees are now pure, without exception. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glsl: Comment that expression flattening is used for matrix operations.Kenneth Graunke2012-03-261-1/+4
| | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
* Convert everything from the talloc API to the ralloc API.Kenneth Graunke2011-01-311-1/+1
|
* glsl2: Move ir_expression_flattening to using the rvalue visitor class.Eric Anholt2010-08-261-110/+14
| | | | | | The previous implementation was missing handling of some rvalues, such as "if" conditions, leading to glsl-mat-int-from-ctor-* not getting caught.
* glsl2: Replace insert_before/remove pairs with exec_node::replace_with.Kenneth Graunke2010-07-211-2/+1
|
* glsl2: Add and use new variable mode ir_var_temporaryIan Romanick2010-07-201-1/+1
| | | | | | | | | | | | | | | | | This is quite a large patch because breaking it into smaller pieces would result in the tree being intermitently broken. The big changes are: * Add the ir_var_temporary variable mode * Change the ir_variable constructor to take the mode as a parameter and correctly specify the mode for all ir_varables. * Change the linker to not cross validate ir_var_temporary variables. * Change the linker to pull all ir_var_temporary variables from global scope into 'main'.
* glsl2: Flatten expression that appear as the parameters of ir_call as well.Eric Anholt2010-07-121-5/+12
|
* glsl2: Flatten expressions that appear as the children of ir_return as well.Eric Anholt2010-07-121-5/+3
|
* glsl2: Use a better talloc context for ir_expression_flattening.Eric Anholt2010-07-121-1/+1
| | | | | | The instruction can be hung off of any other in the tree, even if the other one will be deleted, since it'll get stolen to the shader's context later if it's still live.
* glsl2: Flatten out expressions that are the child of an assignment rhs.Eric Anholt2010-07-121-7/+19
| | | | | | | This feels a little odd, but it will be useful for ir_mat_to_vec, where I want to see a plain assignment of the expression to a variable, not to a writemasked array dereference with a call as the array index.
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-241-0/+172