diff options
author | Eric Anholt <[email protected]> | 2015-01-27 16:42:38 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2015-02-06 15:57:55 -0800 |
commit | 6706537dd4d6794f71de4fe105ec99bc84b526e0 (patch) | |
tree | b4ca9d9c0cd0985eb5bc82dea37c26189cec3cde /src/glsl/nir | |
parent | 9e35af08aff9ee08243fa8cbbda803dc6b95d00d (diff) |
nir: Slightly simplify algebraic code generation by reusing a struct.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/nir')
-rw-r--r-- | src/glsl/nir/nir_algebraic.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/glsl/nir/nir_algebraic.py b/src/glsl/nir/nir_algebraic.py index ea7f5fc65f9..4929745dfa5 100644 --- a/src/glsl/nir/nir_algebraic.py +++ b/src/glsl/nir/nir_algebraic.py @@ -179,10 +179,7 @@ struct transform { ${xform.replace.render()} % endfor -static const struct { - const nir_search_expression *search; - const nir_search_value *replace; -} ${pass_name}_${opcode}_xforms[] = { +static const struct transform ${pass_name}_${opcode}_xforms[] = { % for xform in xform_list: { &${xform.search.name}, ${xform.replace.c_ptr} }, % endfor @@ -211,8 +208,8 @@ ${pass_name}_block(nir_block *block, void *void_state) % for opcode in xform_dict.keys(): case nir_op_${opcode}: for (unsigned i = 0; i < ARRAY_SIZE(${pass_name}_${opcode}_xforms); i++) { - if (nir_replace_instr(alu, ${pass_name}_${opcode}_xforms[i].search, - ${pass_name}_${opcode}_xforms[i].replace, + const struct transform *xform = &${pass_name}_${opcode}_xforms[i]; + if (nir_replace_instr(alu, xform->search, xform->replace, state->mem_ctx)) { state->progress = true; break; |