nir: add nir_break_if helper

I see people open-coding this all over the tree and it makes nir_builder loops
really annoying. Make them slightly less annoying with a helper.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29877>
This commit is contained in:
Alyssa Rosenzweig
2024-06-24 11:38:39 -04:00
committed by Marge Bot
parent 3482ea599b
commit d57934fdec

View File

@@ -2123,6 +2123,16 @@ nir_goto_if(nir_builder *build, struct nir_block *target, nir_def *cond,
nir_builder_instr_insert(build, &jump->instr);
}
static inline void
nir_break_if(nir_builder *build, nir_def *cond)
{
nir_if *nif = nir_push_if(build, cond);
{
nir_jump(build, nir_jump_break);
}
nir_pop_if(build, nif);
}
static inline void
nir_build_call(nir_builder *build, nir_function *func, size_t count,
nir_def **args)