<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 13, 2016 at 8:43 PM, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 2016-02-13 18:14:20, Jason Ekstrand wrote:<br>
> ---<br>
>  src/compiler/nir/nir.c | 32 ++++++++++++++++++++++----------<br>
>  src/compiler/nir/nir.h |  2 ++<br>
>  2 files changed, 24 insertions(+), 10 deletions(-)<br>
><br>
> diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c<br>
> index acb2692..0e4d981 100644<br>
> --- a/src/compiler/nir/nir.c<br>
> +++ b/src/compiler/nir/nir.c<br>
> @@ -258,16 +258,11 @@ cf_init(nir_cf_node *node, nir_cf_node_type type)<br>
>  }<br>
><br>
>  nir_function_impl *<br>
> -nir_function_impl_create(nir_function *function)<br>
> +nir_function_impl_create_bare(nir_shader *shader)<br>
>  {<br>
> -   assert(function->impl == NULL);<br>
> -<br>
> -   void *mem_ctx = ralloc_parent(function);<br>
> +   nir_function_impl *impl = ralloc(shader, nir_function_impl);<br>
><br>
> -   nir_function_impl *impl = ralloc(mem_ctx, nir_function_impl);<br>
> -<br>
> -   function->impl = impl;<br>
> -   impl->function = function;<br>
> +   impl->function = NULL;<br>
><br>
>     cf_init(&impl->cf_node, nir_cf_node_function);<br>
><br>
> @@ -282,8 +277,8 @@ nir_function_impl_create(nir_function *function)<br>
>     impl->valid_metadata = nir_metadata_none;<br>
><br>
>     /* create start & end blocks */<br>
> -   nir_block *start_block = nir_block_create(mem_ctx);<br>
> -   nir_block *end_block = nir_block_create(mem_ctx);<br>
> +   nir_block *start_block = nir_block_create(shader);<br>
> +   nir_block *end_block = nir_block_create(shader);<br>
>     start_block->cf_node.parent = &impl->cf_node;<br>
>     end_block->cf_node.parent = &impl->cf_node;<br>
>     impl->end_block = end_block;<br>
> @@ -295,6 +290,23 @@ nir_function_impl_create(nir_function *function)<br>
>     return impl;<br>
>  }<br>
><br>
> +nir_function_impl *<br>
> +nir_function_impl_create(nir_function *function)<br>
> +{<br>
> +   assert(function->impl == NULL);<br>
> +<br>
> +   nir_function_impl *impl = nir_function_impl_create_bare(function->shader);<br>
> +<br>
> +   function->impl = impl;<br>
> +   impl->function = function;<br>
> +<br>
> +   impl->num_params = function->num_params;<br>
> +   impl->params = ralloc_array(function->shader,<br>
> +                               nir_variable *, impl->num_params);<br>
<br>
</div></div>Initializing num_params & params is new in nir_function_impl_create as<br>
of this change, right? It's not mentioned in the commit message...<br></blockquote><div><br></div><div>I guess it is.  I can move that to patch 4 if you'd like.<br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
-Jordan<br>
<span class=""><br>
> +<br>
> +   return impl;<br>
> +}<br>
> +<br>
>  nir_block *<br>
>  nir_block_create(nir_shader *shader)<br>
>  {<br>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
> index ef3b79e..ff09075 100644<br>
> --- a/src/compiler/nir/nir.h<br>
> +++ b/src/compiler/nir/nir.h<br>
> @@ -1732,6 +1732,8 @@ nir_variable *nir_local_variable_create(nir_function_impl *impl,<br>
>  nir_function *nir_function_create(nir_shader *shader, const char *name);<br>
><br>
>  nir_function_impl *nir_function_impl_create(nir_function *func);<br>
> +/** creates a function_impl that isn't tied to any particular function */<br>
> +nir_function_impl *nir_function_impl_create_bare(nir_shader *shader);<br>
><br>
>  nir_block *nir_block_create(nir_shader *shader);<br>
>  nir_if *nir_if_create(nir_shader *shader);<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</span>> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>