[Mesa-dev] [PATCH 1/9] nir: Slightly simplify algebraic code generation by reusing a struct.

Jason Ekstrand jason at jlekstrand.net
Sun Feb 1 14:07:20 PST 2015


Wow...

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
On Feb 1, 2015 1:17 PM, "Eric Anholt" <eric at anholt.net> wrote:

> ---
>  src/glsl/nir/nir_algebraic.py | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/src/glsl/nir/nir_algebraic.py b/src/glsl/nir/nir_algebraic.py
> index ea7f5fc..4929745 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;
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150201/698daecc/attachment.html>


More information about the mesa-dev mailing list