aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_function_inlining.cpp
Commit message (Collapse)AuthorAgeFilesLines
* exec_list: Make various places use the new length() method.Connor Abbott2014-07-151-5/+2
| | | | | | | | | | Instead of hand-rolling it. v2 [mattst88]: Rename get_size to length. Expand comment in ir_reader. Reviewed-by: Ian Romanick <[email protected]> [v1] Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* glsl: Use typed foreach_in_list_safe instead of foreach_list_safe.Matt Turner2014-07-011-2/+1
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use typed foreach_in_list instead of foreach_list.Matt Turner2014-07-011-3/+2
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use a new foreach_two_lists macro for walking two lists at once.Kenneth Graunke2014-01-131-21/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When handling function calls, we often want to walk through the list of formal parameters and list of actual parameters at the same time. (Both are guaranteed to be the same length.) Previously, we used a pattern of: exec_list_iterator 1st_iter = <1st list>.iterator(); foreach_iter(exec_list_iterator, 2nd_iter, <2nd list>) { ... 1st_iter.next(); } This was awkward, since you had to manually iterate through one of the two lists. This patch introduces a foreach_two_lists macro which safely walks through two lists at the same time, so you can simply do: foreach_two_lists(1st_node, <1st list>, 2nd_node, <2nd list>) { ... } v2: Rename macro from foreach_list2 to foreach_two_lists, as suggested by Ian Romanick. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Cast ir_call parameters to ir_rvalue, not ir_instruction.Kenneth Graunke2014-01-131-2/+2
| | | | | | | | | | A function call's parameters are always rvalues. ir_rvalue may not always be a subclass of ir_instruction in the future, so we should use the right one. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Convert piles of foreach_iter to foreach_list_safe.Kenneth Graunke2014-01-131-2/+2
| | | | | | | | | In these cases, we edit the list (or at least might be), so we use the foreach_list_safe variant. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Convert piles of foreach_iter to the newer foreach_list macro.Kenneth Graunke2014-01-131-3/+3
| | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: move variables in to ir_variable::data, part ITapani Pälli2013-12-121-6/+6
| | | | | | | | | | This patch moves following bitfields in to the data structure: used, assigned, how_declared, mode, interpolation, origin_upper_left, pixel_center_integer Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: introduce data section to ir_variableTapani Pälli2013-12-121-1/+1
| | | | | | | | Data section helps serialization and cloning of a ir_variable. This patch includes the helper bits used for read only ir_variables. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Fix the function inlining pass to deal with general opaque arguments.Francisco Jerez2013-10-291-33/+33
| | | | | | | Almost a trivial change, it boils down to renaming a few identifiers so their names still make sense for opaque types other than sampler. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Eliminate ambiguity between function ins/outs and shader ins/outsPaul Berry2013-01-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces the three ir_variable_mode enums: - ir_var_in - ir_var_out - ir_var_inout with the following five: - ir_var_shader_in - ir_var_shader_out - ir_var_function_in - ir_var_function_out - ir_var_function_inout This eliminates a frustrating ambiguity: it used to be impossible to tell whether an ir_var_{in,out} variable was a shader in/out or a function in/out without seeing where the variable was declared in the IR. This complicated some optimization and lowering passes, and would have become a problem for implementing varying structs. In the lisp-style serialization of GLSL IR to strings performed by ir_print_visitor.cpp and ir_reader.cpp, I've retained the names "in", "out", and "inout" for function parameters, to avoid introducing code churn to the src/glsl/builtins/ir/ directory. Note: a couple of comments in the code seemed to indicate that we were planning for a possible future in which geometry shaders could have shader-scope inout variables. Our GLSL grammar rejects shader-scope inout variables, and I've been unable to find any evidence in the GLSL standards documents (or extensions) that this will ever be allowed, so I've eliminated these comments. Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Put a bunch of optimization visitors under anonymous namespaces.Eric Anholt2012-06-111-0/+3
| | | | | | | | | | | | | | | | | Because these classes are used entirely from their own source files and not from separate DSOs, the linker gets to produce massively less code. This cuts about 13k of text in the libdricore case. In the non-libdricore case, the additional linkage information allows the compiler to inline some code, so libglsl.a size actually increases by about 300 bytes. For a dricore build, improves shader_runner runtime on glsl-fs-copy-propagation-texcoords-1 by 0.21% +/- 0.03% (n=353574, outliers removed). No statistically significant difference with n=322 on glslparsertest on a yofrankie shader intended to test compiler performance. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Convert ir_call to be a statement rather than a value.Kenneth Graunke2012-04-021-57/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Remove unneeded headers.Stéphane Marchesin2011-10-041-1/+0
|
* glsl: Use insert_before for lists instead of open coding itIan Romanick2011-03-081-4/+1
|
* glsl: Function signatures cannot have NULL return typeIan Romanick2011-03-081-1/+1
| | | | | The return type can be void, and this is the case where a `_ret_val' variable should not be declared.
* glsl: Introduce a new "const_in" variable mode.Kenneth Graunke2011-01-311-0/+1
| | | | | | | | This annotation is for an "in" function parameter for which it is only legal to pass constant expressions. The only known example of this, currently, is the textureOffset functions. This should never be used for globals.
* Convert everything from the talloc API to the ralloc API.Kenneth Graunke2011-01-311-3/+3
|
* glsl: Fix Doxygen tag \file in recently renamed filesChad Versace2010-11-171-1/+1
|
* glsl: Rename various ir_* files to lower_* and opt_*.Kenneth Graunke2010-11-151-0/+424
This helps distinguish between lowering passes, optimization passes, and other compiler code.