diff options
author | Jason Ekstrand <[email protected]> | 2015-10-27 21:34:56 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-03-12 15:48:36 -0800 |
commit | 066d3c115ec80270bffc4981fadcc7534ca351cd (patch) | |
tree | b97cd99d7a5cf63d0677996a15930ba1d312cc00 /src/compiler/nir/nir.c | |
parent | 2ef4754a20be5fc7a6ecc2a8b6b8041637c998c6 (diff) |
nir: Add a helper for creating a "bare" nir_function_impl
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.c')
-rw-r--r-- | src/compiler/nir/nir.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index acb2692e2a0..2242317bc8d 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -258,16 +258,11 @@ cf_init(nir_cf_node *node, nir_cf_node_type type) } nir_function_impl * -nir_function_impl_create(nir_function *function) +nir_function_impl_create_bare(nir_shader *shader) { - assert(function->impl == NULL); - - void *mem_ctx = ralloc_parent(function); + nir_function_impl *impl = ralloc(shader, nir_function_impl); - nir_function_impl *impl = ralloc(mem_ctx, nir_function_impl); - - function->impl = impl; - impl->function = function; + impl->function = NULL; cf_init(&impl->cf_node, nir_cf_node_function); @@ -282,8 +277,8 @@ nir_function_impl_create(nir_function *function) impl->valid_metadata = nir_metadata_none; /* create start & end blocks */ - nir_block *start_block = nir_block_create(mem_ctx); - nir_block *end_block = nir_block_create(mem_ctx); + nir_block *start_block = nir_block_create(shader); + nir_block *end_block = nir_block_create(shader); start_block->cf_node.parent = &impl->cf_node; end_block->cf_node.parent = &impl->cf_node; impl->end_block = end_block; @@ -295,6 +290,19 @@ nir_function_impl_create(nir_function *function) return impl; } +nir_function_impl * +nir_function_impl_create(nir_function *function) +{ + assert(function->impl == NULL); + + nir_function_impl *impl = nir_function_impl_create_bare(function->shader); + + function->impl = impl; + impl->function = function; + + return impl; +} + nir_block * nir_block_create(nir_shader *shader) { |