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 <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16494>
This commit is contained in:
Samuel Pitoiset 2022-05-13 11:19:21 +02:00 committed by Marge Bot
parent 07eba9a15a
commit 8510d5daa3
3 changed files with 14 additions and 2 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);