summaryrefslogtreecommitdiffstats
path: root/src/amd/common
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-06-27 09:27:03 +1000
committerDave Airlie <[email protected]>2018-07-04 10:29:16 +1000
commit7398913a62a59282e742758a7e789ed3df27e49c (patch)
treee64e59eb906fccde70a2c19b72c6244a0f263dc2 /src/amd/common
parentd853d3a59bd5f8720a5b021bcd64a193d370b623 (diff)
ac/radv: move llvm compiler info to struct and init in one place
This ports radv to the shared code, however due to a bug in LLVM version prior to 7, radv cannot add target info at this stage, as it would leak one for every shader compile, however I'd prefer to keep this llvm damage in the shared code, since it isn't the driver at fault here. We just add a flag to denote if the driver can support leaking the target info or not, and the common code does the right thing depending on the llvm version. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r--src/amd/common/ac_llvm_util.c11
-rw-r--r--src/amd/common/ac_llvm_util.h1
2 files changed, 8 insertions, 4 deletions
diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
index fa85c625b33..2be2edf1e6a 100644
--- a/src/amd/common/ac_llvm_util.c
+++ b/src/amd/common/ac_llvm_util.c
@@ -285,6 +285,7 @@ ac_count_scratch_private_memory(LLVMValueRef function)
bool
ac_init_llvm_compiler(struct ac_llvm_compiler *compiler,
+ bool okay_to_leak_target_library_info,
enum radeon_family family,
enum ac_target_machine_options tm_options)
{
@@ -296,10 +297,12 @@ ac_init_llvm_compiler(struct ac_llvm_compiler *compiler,
if (!compiler->tm)
return false;
- compiler->target_library_info =
- ac_create_target_library_info(triple);
- if (!compiler->target_library_info)
- goto fail;
+ if (okay_to_leak_target_library_info || (HAVE_LLVM >= 0x0700)) {
+ compiler->target_library_info =
+ ac_create_target_library_info(triple);
+ if (!compiler->target_library_info)
+ goto fail;
+ }
compiler->passmgr = ac_create_passmgr(compiler->target_library_info,
tm_options & AC_TM_CHECK_IR);
diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
index cd56ff5f41c..ad463c69564 100644
--- a/src/amd/common/ac_llvm_util.h
+++ b/src/amd/common/ac_llvm_util.h
@@ -127,6 +127,7 @@ void ac_init_llvm_once(void);
bool ac_init_llvm_compiler(struct ac_llvm_compiler *compiler,
+ bool okay_to_leak_target_library_info,
enum radeon_family family,
enum ac_target_machine_options tm_options);
void ac_destroy_llvm_compiler(struct ac_llvm_compiler *compiler);