diff options
author | Dave Airlie <[email protected]> | 2018-07-03 09:51:42 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2018-07-04 10:29:03 +1000 |
commit | d853d3a59bd5f8720a5b021bcd64a193d370b623 (patch) | |
tree | 2ccdf575546420a285d616f4203254df6faa5997 /src/gallium | |
parent | 35c82af5399fd5d31572098f7aaf760c1d750dc8 (diff) |
ac/radeonsi: port compiler init/destroy out of radeonsi.
We want to share this code with radv in the future, so port
it out of radeonsi.
Add a return value as radv will want that to know if this
succeeds
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 5ac1a12a058..ad0ca7c6169 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -114,35 +114,12 @@ static void si_init_compiler(struct si_screen *sscreen, (!sscreen->llvm_has_working_vgpr_indexing ? AC_TM_PROMOTE_ALLOCA_TO_SCRATCH : 0) | (sscreen->debug_flags & DBG(CHECK_IR) ? AC_TM_CHECK_IR : 0); - const char *triple; - ac_init_llvm_once(); - compiler->tm = ac_create_target_machine(sscreen->info.family, - tm_options, &triple); - if (!compiler->tm) - return; - - compiler->target_library_info = - gallivm_create_target_library_info(triple); - if (!compiler->target_library_info) - return; - - compiler->passmgr = ac_create_passmgr(compiler->target_library_info, - tm_options & AC_TM_CHECK_IR); - if (!compiler->passmgr) - return; + ac_init_llvm_compiler(compiler, sscreen->info.family, tm_options); } static void si_destroy_compiler(struct ac_llvm_compiler *compiler) { - if (compiler->passmgr) - LLVMDisposePassManager(compiler->passmgr); -#if HAVE_LLVM >= 0x0700 - /* This crashes on LLVM 5.0 and 6.0 and Ubuntu 18.04, so leak it there. */ - if (compiler->target_library_info) - gallivm_dispose_target_library_info(compiler->target_library_info); -#endif - if (compiler->tm) - LLVMDisposeTargetMachine(compiler->tm); + ac_destroy_llvm_compiler(compiler); } /* |