diff options
author | Marek Olšák <[email protected]> | 2018-04-09 19:23:55 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-04-27 17:56:04 -0400 |
commit | e75fc8d03396ea47506cc044cb1c11a7352ea283 (patch) | |
tree | 6e4dfdb3fd1c7c1d2a9641bba2fe84f6071cb68f /src/gallium/drivers/radeonsi | |
parent | 797d673c9a8c2d0a392f80b3c2190606ba8a6c83 (diff) |
radeonsi: move data_layout into si_compiler
Reviewed-by: Timothy Arceri <[email protected]>
Tested-by: Benedikt Schemmer <ben at besd.de>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 7 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index eeb7ff81f92..aa92f889e6e 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -149,10 +149,19 @@ static void si_init_compiler(struct si_screen *sscreen, /* This is recommended by the instruction combining pass. */ LLVMAddEarlyCSEMemSSAPass(compiler->passmgr); LLVMAddInstructionCombiningPass(compiler->passmgr); + + /* Get the data layout. */ + LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(compiler->tm); + if (!data_layout) + return; + compiler->data_layout = LLVMCopyStringRepOfTargetData(data_layout); + LLVMDisposeTargetData(data_layout); } static void si_destroy_compiler(struct si_compiler *compiler) { + if (compiler->data_layout) + LLVMDisposeMessage((char*)compiler->data_layout); if (compiler->passmgr) LLVMDisposePassManager(compiler->passmgr); if (compiler->target_library_info) diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index a0122d23910..94366f41204 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -315,6 +315,7 @@ struct si_shader; struct si_compiler { LLVMTargetMachineRef tm; const char *triple; + const char *data_layout; LLVMTargetLibraryInfoRef target_library_info; LLVMPassManagerRef passmgr; }; diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index 29b1e50dc47..a4c2a1f27ab 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -1005,12 +1005,7 @@ void si_llvm_context_init(struct si_shader_context *ctx, ctx->gallivm.module = LLVMModuleCreateWithNameInContext("tgsi", ctx->gallivm.context); LLVMSetTarget(ctx->gallivm.module, compiler->triple); - - LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(compiler->tm); - char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout); - LLVMSetDataLayout(ctx->gallivm.module, data_layout_str); - LLVMDisposeTargetData(data_layout); - LLVMDisposeMessage(data_layout_str); + LLVMSetDataLayout(ctx->gallivm.module, compiler->data_layout); bool unsafe_fpmath = (sscreen->debug_flags & DBG(UNSAFE_MATH)) != 0; enum ac_float_mode float_mode = |