summaryrefslogtreecommitdiffstats
path: root/src/amd/common
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-06-27 08:36:41 +1000
committerDave Airlie <[email protected]>2018-07-04 05:15:23 +1000
commit473be16c745d0d78a0be71828d05aeb5d8a7cb76 (patch)
treef0bc4bf306d48c9f6bfbb10f89563c3a8d29aed1 /src/amd/common
parent590cc7c8f67902423d812ab219afec93031c6252 (diff)
ac/radv: split the non-common init_once code from the common target code. (v2)
This just splits out the non-shared code and reuses ac_get_llvm_target in radv. v2: rebase on Marek's patch - fixup brace position/whitespace Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r--src/amd/common/ac_llvm_util.c7
-rw-r--r--src/amd/common/ac_llvm_util.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
index 99cc677edce..25ff4a8c22a 100644
--- a/src/amd/common/ac_llvm_util.c
+++ b/src/amd/common/ac_llvm_util.c
@@ -57,13 +57,16 @@ static void ac_init_llvm_target()
static once_flag ac_init_llvm_target_once_flag = ONCE_FLAG_INIT;
+void ac_init_llvm_once(void)
+{
+ call_once(&ac_init_llvm_target_once_flag, ac_init_llvm_target);
+}
+
LLVMTargetRef ac_get_llvm_target(const char *triple)
{
LLVMTargetRef target = NULL;
char *err_message = NULL;
- call_once(&ac_init_llvm_target_once_flag, ac_init_llvm_target);
-
if (LLVMGetTargetFromTriple(triple, &target, &err_message)) {
fprintf(stderr, "Cannot find target for triple %s ", triple);
if (err_message) {
diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
index 6e6d15bb56c..4311c5ea8a4 100644
--- a/src/amd/common/ac_llvm_util.h
+++ b/src/amd/common/ac_llvm_util.h
@@ -111,6 +111,8 @@ ac_get_store_intr_attribs(bool writeonly_memory)
unsigned
ac_count_scratch_private_memory(LLVMValueRef function);
+void ac_init_llvm_once(void);
+
#ifdef __cplusplus
}
#endif