nir: Add nir_builder_create returning nir_builder
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 26 Jun 2023 14:20:04 +0000 (10:20 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 27 Jun 2023 18:13:02 +0000 (18:13 +0000)
More ergonomic.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23860>

src/compiler/nir/nir_builder.h

index 8002c32..b71d140 100644 (file)
@@ -50,6 +50,14 @@ typedef struct nir_builder {
 
 void nir_builder_init(nir_builder *build, nir_function_impl *impl);
 
+static inline nir_builder
+nir_builder_create(nir_function_impl *impl)
+{
+   nir_builder b;
+   nir_builder_init(&b, impl);
+   return b;
+}
+
 nir_builder MUST_CHECK PRINTFLIKE(3, 4)
 nir_builder_init_simple_shader(gl_shader_stage stage,
                                const nir_shader_compiler_options *options,