[Mesa-dev] [PATCH 3/4] radeonsi: reorder code in si_llvm_context_init

Marek Olšák maraeo at gmail.com
Wed Jul 4 06:02:44 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

---
 .../drivers/radeonsi/si_shader_tgsi_setup.c   | 26 +++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 6c1e18ff812..b8cfd15a67f 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -949,35 +949,35 @@ void si_llvm_context_init(struct si_shader_context *ctx,
 
 	/* Initialize the gallivm object:
 	 * We are only using the module, context, and builder fields of this struct.
 	 * This should be enough for us to be able to pass our gallivm struct to the
 	 * helper functions in the gallivm module.
 	 */
 	memset(ctx, 0, sizeof(*ctx));
 	ctx->screen = sscreen;
 	ctx->compiler = compiler;
 
-	ctx->gallivm.context = LLVMContextCreate();
-	ctx->gallivm.module = ac_create_module(compiler->tm, ctx->gallivm.context);
-
-	bool unsafe_fpmath = (sscreen->debug_flags & DBG(UNSAFE_MATH)) != 0;
-	enum ac_float_mode float_mode =
-		unsafe_fpmath ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
-				AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH;
+	ctx->ac.context = LLVMContextCreate();
+	ac_llvm_context_init(&ctx->ac, ctx->ac.context,
+			     sscreen->info.chip_class, sscreen->info.family);
 
-	ctx->gallivm.builder = ac_create_builder(ctx->gallivm.context,
-						 float_mode);
+	ctx->ac.module = ac_create_module(compiler->tm, ctx->ac.context);
 
-	ac_llvm_context_init(&ctx->ac, ctx->gallivm.context,
-			     sscreen->info.chip_class, sscreen->info.family);
-	ctx->ac.module = ctx->gallivm.module;
-	ctx->ac.builder = ctx->gallivm.builder;
+	enum ac_float_mode float_mode =
+		sscreen->debug_flags & DBG(UNSAFE_MATH) ?
+			AC_FLOAT_MODE_UNSAFE_FP_MATH :
+			AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH;
+	ctx->ac.builder = ac_create_builder(ctx->ac.context, float_mode);
+
+	ctx->gallivm.context = ctx->ac.context;
+	ctx->gallivm.module = ctx->ac.module;
+	ctx->gallivm.builder = ctx->ac.builder;
 
 	struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
 
 	type.floating = true;
 	type.fixed = false;
 	type.sign = true;
 	type.norm = false;
 	type.width = 32;
 	type.length = 1;
 
-- 
2.17.1



More information about the mesa-dev mailing list