aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-07-12 17:35:39 -0400
committerMarek Olšák <[email protected]>2019-07-19 20:16:19 -0400
commit81091a5183fb853d2de37ea82b51122601a36c93 (patch)
treed0ffefae20a7797aac908df5a999fa216aa426ef
parenteb54b8c222e6ac7d81a3efde1dfed58b33c6a601 (diff)
ac: create the LLVM builder in ac_llvm_context_init
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r--src/amd/common/ac_llvm_build.c4
-rw-r--r--src/amd/common/ac_llvm_build.h3
-rw-r--r--src/amd/vulkan/radv_nir_to_llvm.c18
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c7
4 files changed, 15 insertions, 17 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 4465acbd0ad..855ebb3d3dd 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -60,7 +60,7 @@ void
ac_llvm_context_init(struct ac_llvm_context *ctx,
struct ac_llvm_compiler *compiler,
enum chip_class chip_class, enum radeon_family family,
- unsigned wave_size)
+ enum ac_float_mode float_mode, unsigned wave_size)
{
LLVMValueRef args[1];
@@ -72,7 +72,7 @@ ac_llvm_context_init(struct ac_llvm_context *ctx,
ctx->module = ac_create_module(wave_size == 32 ? compiler->tm_wave32
: compiler->tm,
ctx->context);
- ctx->builder = NULL;
+ ctx->builder = ac_create_builder(ctx->context, float_mode);
ctx->voidt = LLVMVoidTypeInContext(ctx->context);
ctx->i1 = LLVMInt1TypeInContext(ctx->context);
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index 9efd755b90b..cc1807221b2 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -49,6 +49,7 @@ enum {
struct ac_llvm_flow;
struct ac_llvm_compiler;
+enum ac_float_mode;
struct ac_llvm_context {
LLVMContextRef context;
@@ -113,7 +114,7 @@ void
ac_llvm_context_init(struct ac_llvm_context *ctx,
struct ac_llvm_compiler *compiler,
enum chip_class chip_class, enum radeon_family family,
- unsigned wave_size);
+ enum ac_float_mode float_mode, unsigned wave_size);
void
ac_llvm_context_dispose(struct ac_llvm_context *ctx);
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index 0c739e1ebd9..27b46d2e1ba 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -4319,14 +4319,13 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm,
ctx.options = options;
ctx.shader_info = shader_info;
- ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class, options->family, 64);
- ctx.context = ctx.ac.context;
-
enum ac_float_mode float_mode =
options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
AC_FLOAT_MODE_DEFAULT;
- ctx.ac.builder = ac_create_builder(ctx.context, float_mode);
+ ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class,
+ options->family, float_mode, 64);
+ ctx.context = ctx.ac.context;
radv_nir_shader_info_init(&shader_info->info);
@@ -4837,16 +4836,15 @@ radv_compile_gs_copy_shader(struct ac_llvm_compiler *ac_llvm,
ctx.options = options;
ctx.shader_info = shader_info;
- ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class, options->family, 64);
- ctx.context = ctx.ac.context;
-
- ctx.is_gs_copy_shader = true;
-
enum ac_float_mode float_mode =
options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
AC_FLOAT_MODE_DEFAULT;
- ctx.ac.builder = ac_create_builder(ctx.context, float_mode);
+ ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class,
+ options->family, float_mode, 64);
+ ctx.context = ctx.ac.context;
+
+ ctx.is_gs_copy_shader = true;
ctx.stage = MESA_SHADER_VERTEX;
radv_nir_shader_info_pass(geom_shader, options, &shader_info->info);
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 3de720c27b8..c534a445db4 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -962,14 +962,13 @@ void si_llvm_context_init(struct si_shader_context *ctx,
ctx->screen = sscreen;
ctx->compiler = compiler;
- ac_llvm_context_init(&ctx->ac, compiler, sscreen->info.chip_class,
- sscreen->info.family, 64);
-
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);
+
+ ac_llvm_context_init(&ctx->ac, compiler, sscreen->info.chip_class,
+ sscreen->info.family, float_mode, 64);
ctx->gallivm.context = ctx->ac.context;
ctx->gallivm.module = ctx->ac.module;