From: Samuel Pitoiset Date: Fri, 13 May 2022 09:19:21 +0000 (+0200) Subject: aco: use ac_is_llvm_processor_supported() for checking LLVM asm support X-Git-Tag: upstream/22.3.5~8739 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8510d5daa3d6d5ea5bd081a06c74a2076a785135;p=platform%2Fupstream%2Fmesa.git aco: use ac_is_llvm_processor_supported() for checking LLVM asm support It seems more universal but it's needed to create a temporary TM. Signed-off-by: Samuel Pitoiset Reviewed-by: Rhys Perry Part-of: --- diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp index 2535de2..974ef76 100644 --- a/src/amd/compiler/aco_print_asm.cpp +++ b/src/amd/compiler/aco_print_asm.cpp @@ -407,7 +407,18 @@ check_print_asm_support(Program* program) #ifdef LLVM_AVAILABLE if (program->gfx_level >= GFX8) { /* LLVM disassembler only supports GFX8+ */ - return true; + const char* name = ac_get_llvm_processor_name(program->family); + const char* triple = "amdgcn--"; + LLVMTargetRef target = ac_get_llvm_target(triple); + + LLVMTargetMachineRef tm = LLVMCreateTargetMachine( + target, triple, name, "", LLVMCodeGenLevelDefault, LLVMRelocDefault, LLVMCodeModelDefault); + + bool supported = ac_is_llvm_processor_supported(tm, name); + LLVMDisposeTargetMachine(tm); + + if (supported) + return true; } #endif diff --git a/src/amd/llvm/ac_llvm_util.c b/src/amd/llvm/ac_llvm_util.c index d83d82b..561ef53 100644 --- a/src/amd/llvm/ac_llvm_util.c +++ b/src/amd/llvm/ac_llvm_util.c @@ -87,7 +87,7 @@ void ac_init_llvm_once(void) #endif } -static LLVMTargetRef ac_get_llvm_target(const char *triple) +LLVMTargetRef ac_get_llvm_target(const char *triple) { LLVMTargetRef target = NULL; char *err_message = NULL; diff --git a/src/amd/llvm/ac_llvm_util.h b/src/amd/llvm/ac_llvm_util.h index 79bab02..546f9e2 100644 --- a/src/amd/llvm/ac_llvm_util.h +++ b/src/amd/llvm/ac_llvm_util.h @@ -89,6 +89,7 @@ struct ac_llvm_compiler { struct ac_compiler_passes *low_opt_passes; }; +LLVMTargetRef ac_get_llvm_target(const char *triple); const char *ac_get_llvm_processor_name(enum radeon_family family); bool ac_is_llvm_processor_supported(LLVMTargetMachineRef tm, const char *processor); void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);