nir: add nir_progress/nir_no_progress helpers

These will replace nir_metadata_preserve as more ergonomic replacements that
convey a notion of impl progress instead of simply updating metadata.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33722>
This commit is contained in:
Alyssa Rosenzweig 2025-02-24 13:55:19 -05:00 committed by Marge Bot
parent a17d286dc4
commit 469b8bbf3c

View file

@ -3903,6 +3903,25 @@ void nir_shader_preserve_all_metadata(nir_shader *shader);
/** dirties all metadata and fills it with obviously wrong information */
void nir_metadata_invalidate(nir_shader *shader);
static inline bool
nir_progress(bool progress, nir_function_impl *impl, nir_metadata preserved)
{
if (progress) {
nir_metadata_preserve(impl, preserved);
} else {
nir_metadata_preserve(impl, nir_metadata_all);
}
return progress;
}
/** Indicate that there is no progress. All metadata is preserved. */
static inline bool
nir_no_progress(nir_function_impl *impl)
{
return nir_progress(false, impl, nir_metadata_none /* ignored */);
}
/** creates an instruction with default swizzle/writemask/etc. with NULL registers */
nir_alu_instr *nir_alu_instr_create(nir_shader *shader, nir_op op);