diff options
author | Jason Ekstrand <[email protected]> | 2014-11-14 17:47:56 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-15 07:20:20 -0800 |
commit | 0e145a951e64e0b955e8315e22edf9e2ab4581ec (patch) | |
tree | 458a50e7b704c85bb1db15850153c8515e113401 /src/glsl/nir/nir_search.c | |
parent | 0057dfd673c62741bd9eba34759f3539940068a2 (diff) |
nir: Add infastructure for generating algebraic transformation passes
This commit builds on the nir_search.h infastructure by adding a bit of
python code that makes it stupid easy to write an algebraic transformation
pass. The nir_algebraic.py file contains four python classes that
correspond directly to the datastructures in nir_search.c and allow you to
easily generate the C code to represent them. Given a list of
search-and-replace operations, it can then generate a function that applies
those transformations to a shader.
The transformations can be specified manually, or they can be specified
using nested tuples. The nested tuples make a neat little language for
specifying expression trees and search-and-replace operations in a very
readable and easy-to-edit fasion.
The generated code is also fairly efficient. Insteady of blindly calling
nir_replace_instr with every single transformation and on every single
instruction, it uses a switch statement on the instruction opcode to do a
first-order culling and only calls nir_replace_instr if the opcode is known
to match the first opcode in the search expression.
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_search.c')
0 files changed, 0 insertions, 0 deletions