Mesa (main): radeonsi: use nir_shader_get_entrypoint in si_nir_scan_shader

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 22 22:47:27 UTC 2022


Module: Mesa
Branch: main
Commit: 65dfb7bf2e02c750481ecbd9e6db543ce59246ee
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=65dfb7bf2e02c750481ecbd9e6db543ce59246ee

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue Jan  4 09:03:04 2022 -0500

radeonsi: use nir_shader_get_entrypoint in si_nir_scan_shader

The typecast is needed because nir is const.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14414>

---

 src/gallium/drivers/radeonsi/si_shader_info.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_info.c b/src/gallium/drivers/radeonsi/si_shader_info.c
index 630b1efabf1..26c309b2dca 100644
--- a/src/gallium/drivers/radeonsi/si_shader_info.c
+++ b/src/gallium/drivers/radeonsi/si_shader_info.c
@@ -374,6 +374,7 @@ static bool is_bindless_handle_indirect(nir_instr *src)
    return false;
 }
 
+/* TODO: convert to nir_shader_instructions_pass */
 static void scan_instruction(const struct nir_shader *nir, struct si_shader_info *info,
                              nir_instr *instr)
 {
@@ -570,8 +571,6 @@ static void scan_instruction(const struct nir_shader *nir, struct si_shader_info
 
 void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *info)
 {
-   nir_function *func;
-
    memset(info, 0, sizeof(*info));
    info->base = nir->info;
    info->stage = nir->info.stage;
@@ -658,8 +657,8 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf
       info->writes_position = nir->info.outputs_written & VARYING_BIT_POS;
    }
 
-   func = (struct nir_function *)exec_list_get_head_const(&nir->functions);
-   nir_foreach_block (block, func->impl) {
+   nir_function_impl *impl = nir_shader_get_entrypoint((nir_shader*)nir);
+   nir_foreach_block (block, impl) {
       nir_foreach_instr (instr, block)
          scan_instruction(nir, info, instr);
    }



More information about the mesa-commit mailing list