summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_expression_flattening.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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 <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Comment that expression flattening is used for matrix operations.Kenneth Graunke2012-03-261-1/+4
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* 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