diff options
author | Jason Ekstrand <[email protected]> | 2020-02-12 15:28:46 -0600 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-03 20:54:00 +0000 |
commit | d94e464a9fc5da334ae224810f855fff6890be50 (patch) | |
tree | 0be69e041c80c035deb4df8c17127641455a094a /src/compiler/spirv | |
parent | 255aacbec14c2d11d7756ec94b95244165120ff6 (diff) |
spirv: Make vtn_function a vtn_cf_node
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3820>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 5 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_cfg.c | 6 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_private.h | 6 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 61abc727278..3ebe85e46ab 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -5148,7 +5148,7 @@ vtn_create_builder(const uint32_t *words, size_t word_count, b->file = NULL; b->line = -1; b->col = -1; - exec_list_make_empty(&b->functions); + list_inithead(&b->functions); b->entry_point_stage = stage; b->entry_point_name = entry_point_name; b->options = dup_options; @@ -5346,7 +5346,8 @@ spirv_to_nir(const uint32_t *words, size_t word_count, bool progress; do { progress = false; - foreach_list_typed(struct vtn_function, func, node, &b->functions) { + vtn_foreach_cf_node(node, &b->functions) { + struct vtn_function *func = vtn_cf_node_as_function(node); if (func->referenced && !func->emitted) { b->const_table = _mesa_pointer_hash_table_create(b); diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index 4e42eb1dbca..a26566cb2ad 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -251,6 +251,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode, vtn_assert(b->func == NULL); b->func = rzalloc(b, struct vtn_function); + b->func->node.type = vtn_cf_node_type_function; list_inithead(&b->func->body); b->func->control = w[3]; @@ -364,7 +365,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode, * implemented functions that we'll walk later. */ b->func->start_block = b->block; - exec_list_push_tail(&b->functions, &b->func->node); + list_addtail(&b->func->node.link, &b->functions); } break; } @@ -756,7 +757,8 @@ vtn_build_cfg(struct vtn_builder *b, const uint32_t *words, const uint32_t *end) vtn_foreach_instruction(b, words, end, vtn_cfg_handle_prepass_instruction); - foreach_list_typed(struct vtn_function, func, node, &b->functions) { + vtn_foreach_cf_node(node, &b->functions) { + struct vtn_function *func = vtn_cf_node_as_function(node); vtn_cfg_walk_blocks(b, &func->body, func->start_block, NULL, NULL, NULL, NULL, NULL); } diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 1c84a2c01ee..d709c39a699 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -137,6 +137,7 @@ enum vtn_cf_node_type { vtn_cf_node_type_loop, vtn_cf_node_type_case, vtn_cf_node_type_switch, + vtn_cf_node_type_function, }; struct vtn_cf_node { @@ -226,7 +227,7 @@ struct vtn_block { }; struct vtn_function { - struct exec_node node; + struct vtn_cf_node node; struct vtn_type *type; @@ -256,6 +257,7 @@ VTN_DECL_CF_NODE_CAST(loop) VTN_DECL_CF_NODE_CAST(if) VTN_DECL_CF_NODE_CAST(case) VTN_DECL_CF_NODE_CAST(switch) +VTN_DECL_CF_NODE_CAST(function) #define vtn_foreach_cf_node(node, cf_list) \ list_for_each_entry(struct vtn_cf_node, node, cf_list, link) @@ -654,7 +656,7 @@ struct vtn_builder { bool variable_pointers; struct vtn_function *func; - struct exec_list functions; + struct list_head functions; /* Current function parameter index */ unsigned func_param_idx; |