[Mesa-dev] [PATCH v3 056/104] spirv/cfg: Make the builder fully capable for both walks
Jason Ekstrand
jason at jlekstrand.net
Tue Apr 3 18:33:23 UTC 2018
We were only initializing vtn_builder::func for the pre-walk where we
build the CFG. We were only initializing the nir_builder for the later
walk through the instructions even though were were setting b->cursor
for the pre-walk. Let's set both both places so that everything is
consistent. This useful because we handle OpFunctionParameter in the
pre-walk and we're going to need to be able to emit instructions.
---
src/compiler/spirv/vtn_cfg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index 54616d6..7f186c3 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -95,6 +95,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
func->return_type = func_type->return_type->type;
b->func->impl = nir_function_impl_create(func);
+ nir_builder_init(&b->nb, func->impl);
b->nb.cursor = nir_before_cf_list(&b->func->impl->body);
b->func_param_idx = 0;
@@ -878,6 +879,7 @@ vtn_function_emit(struct vtn_builder *b, struct vtn_function *func,
vtn_instruction_handler instruction_handler)
{
nir_builder_init(&b->nb, func->impl);
+ b->func = func;
b->nb.cursor = nir_after_cf_list(&func->impl->body);
b->has_loop_continue = false;
b->phi_table = _mesa_hash_table_create(b, _mesa_hash_pointer,
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list