nir: Make nir_lower_io_to_temporaries store an impl internally.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 25 Aug 2016 02:15:53 +0000 (19:15 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Aug 2016 02:18:11 +0000 (19:18 -0700)
This changes the pass internals to work with a nir_function_impl
directly rather than a nir_function.  The next patch will change
the API.

v2: Rebase after framebuffer fetch landed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/compiler/nir/nir_lower_io_to_temporaries.c

index c8f94ff6eb5d3e78a8055020c8c208d6be207f45..8cbf6838ee889f80f561af22346e56c5eadb8cd2 100644 (file)
@@ -34,7 +34,7 @@
 
 struct lower_io_state {
    nir_shader *shader;
-   nir_function *entrypoint;
+   nir_function_impl *entrypoint;
    struct exec_list old_outputs;
    struct exec_list old_inputs;
 };
@@ -93,7 +93,7 @@ emit_output_copies_impl(struct lower_io_state *state, nir_function_impl *impl)
             }
          }
       }
-   } else if (impl->function == state->entrypoint) {
+   } else if (impl == state->entrypoint) {
       nir_cursor cursor = nir_before_block(nir_start_block(impl));
       emit_copies(cursor, state->shader, &state->old_outputs,
                   &state->shader->outputs);
@@ -114,7 +114,7 @@ emit_output_copies_impl(struct lower_io_state *state, nir_function_impl *impl)
 static void
 emit_input_copies_impl(struct lower_io_state *state, nir_function_impl *impl)
 {
-   if (impl->function == state->entrypoint) {
+   if (impl == state->entrypoint) {
       nir_cursor cursor = nir_before_block(nir_start_block(impl));
       emit_copies(cursor, state->shader, &state->old_inputs,
                   &state->shader->inputs);
@@ -157,7 +157,7 @@ nir_lower_io_to_temporaries(nir_shader *shader, nir_function *entrypoint,
       return;
 
    state.shader = shader;
-   state.entrypoint = entrypoint;
+   state.entrypoint = entrypoint->impl;
 
    if (inputs)
       exec_list_move_nodes_to(&shader->inputs, &state.old_inputs);