[Mesa-dev] [PATCH v2 0/5] NIR opcodes and constant folding

Connor Abbott cwabbott0 at gmail.com
Thu Jan 22 20:32:12 PST 2015


This is a series I had floating around a while. The idea is to have all the
opcode stuff, including constant folding, derived from a single Python file.
I've cleaned it up a little by using {}-style Python formatting instead of the
pile of text-replacement and regular expressions we had before for getting the
constant expressions to a state where they could be compiled as C code.


In addition to a bunch of cleanups, I've deleted patch 5 in favor of Eric's
patch and replaced it with a patch that makes opt_algebraic take advantage of
the opcode information. I think we should hold off on pushing this one, though,
since Jason is modifying the same code and all it does is improve safety in
some cases. Nevertheless, I've left it in as an example of how we can use

This series is also available at:

git://people.freedesktop.org/~cwabbott0/mesa nir-opcodes-cleanup-v2

Connor Abbott (5):
  nir: add generated file to .gitignore
  nir: use Python to autogenerate opcode information
  nir: add new constant folding infrastructure
  nir/constant_folding: use the new constant folding infrastructure
  nir/opt_algebraic: be more careful about constant types

 src/glsl/Makefile.am                     |  21 +-
 src/glsl/Makefile.sources                |   7 +-
 src/glsl/nir/.gitignore                  |   4 +
 src/glsl/nir/nir.h                       |   9 -
 src/glsl/nir/nir_algebraic.py            |  38 +-
 src/glsl/nir/nir_constant_expressions.h  |  32 ++
 src/glsl/nir/nir_constant_expressions.py | 324 +++++++++++++++++
 src/glsl/nir/nir_opcodes.c               |  46 ---
 src/glsl/nir/nir_opcodes.h               | 366 --------------------
 src/glsl/nir/nir_opcodes.py              | 575 +++++++++++++++++++++++++++++++
 src/glsl/nir/nir_opcodes_c.py            |  56 +++
 src/glsl/nir/nir_opcodes_h.py            |  39 +++
 src/glsl/nir/nir_opt_algebraic.py        |   6 +-
 src/glsl/nir/nir_opt_constant_folding.c  | 179 ++--------
 14 files changed, 1107 insertions(+), 595 deletions(-)
 create mode 100644 src/glsl/nir/.gitignore
 create mode 100644 src/glsl/nir/nir_constant_expressions.h
 create mode 100644 src/glsl/nir/nir_constant_expressions.py
 delete mode 100644 src/glsl/nir/nir_opcodes.c
 delete mode 100644 src/glsl/nir/nir_opcodes.h
 create mode 100644 src/glsl/nir/nir_opcodes.py
 create mode 100644 src/glsl/nir/nir_opcodes_c.py
 create mode 100644 src/glsl/nir/nir_opcodes_h.py


More information about the mesa-dev mailing list