radeonsi: merge si_llvm_get_amdgpu_target into ac_get_llvm_target
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
c351037d6c
commit
4560f2b90a
|
@ -40,21 +40,23 @@ static void ac_init_llvm_target()
|
||||||
LLVMInitializeAMDGPUTargetMC();
|
LLVMInitializeAMDGPUTargetMC();
|
||||||
LLVMInitializeAMDGPUAsmPrinter();
|
LLVMInitializeAMDGPUAsmPrinter();
|
||||||
|
|
||||||
/*
|
/* For inline assembly. */
|
||||||
* Workaround for bug in llvm 4.0 that causes image intrinsics
|
LLVMInitializeAMDGPUAsmParser();
|
||||||
|
|
||||||
|
/* Workaround for bug in llvm 4.0 that causes image intrinsics
|
||||||
* to disappear.
|
* to disappear.
|
||||||
* https://reviews.llvm.org/D26348
|
* https://reviews.llvm.org/D26348
|
||||||
*/
|
*/
|
||||||
#if HAVE_LLVM >= 0x0400
|
if (HAVE_LLVM >= 0x0400) {
|
||||||
const char *argv[2] = {"mesa", "-simplifycfg-sink-common=false"};
|
/* "mesa" is the prefix for error messages */
|
||||||
LLVMParseCommandLineOptions(2, argv, NULL);
|
const char *argv[2] = { "mesa", "-simplifycfg-sink-common=false" };
|
||||||
#endif
|
LLVMParseCommandLineOptions(2, argv, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static once_flag ac_init_llvm_target_once_flag = ONCE_FLAG_INIT;
|
static once_flag ac_init_llvm_target_once_flag = ONCE_FLAG_INIT;
|
||||||
|
|
||||||
static LLVMTargetRef ac_get_llvm_target(const char *triple)
|
LLVMTargetRef ac_get_llvm_target(const char *triple)
|
||||||
{
|
{
|
||||||
LLVMTargetRef target = NULL;
|
LLVMTargetRef target = NULL;
|
||||||
char *err_message = NULL;
|
char *err_message = NULL;
|
||||||
|
|
|
@ -60,6 +60,7 @@ enum ac_target_machine_options {
|
||||||
};
|
};
|
||||||
LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, enum ac_target_machine_options tm_options);
|
LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, enum ac_target_machine_options tm_options);
|
||||||
|
|
||||||
|
LLVMTargetRef ac_get_llvm_target(const char *triple);
|
||||||
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
|
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
|
||||||
bool ac_is_sgpr_param(LLVMValueRef param);
|
bool ac_is_sgpr_param(LLVMValueRef param);
|
||||||
void ac_add_function_attr(LLVMContextRef ctx, LLVMValueRef function,
|
void ac_add_function_attr(LLVMContextRef ctx, LLVMValueRef function,
|
||||||
|
|
|
@ -145,7 +145,7 @@ si_create_llvm_target_machine(struct si_screen *sscreen)
|
||||||
sscreen->b.chip_class >= GFX9 ? ",+xnack" : ",-xnack",
|
sscreen->b.chip_class >= GFX9 ? ",+xnack" : ",-xnack",
|
||||||
sscreen->b.debug_flags & DBG_SI_SCHED ? ",+si-scheduler" : "");
|
sscreen->b.debug_flags & DBG_SI_SCHED ? ",+si-scheduler" : "");
|
||||||
|
|
||||||
return LLVMCreateTargetMachine(si_llvm_get_amdgpu_target(triple), triple,
|
return LLVMCreateTargetMachine(ac_get_llvm_target(triple), triple,
|
||||||
r600_get_llvm_processor_name(sscreen->b.family),
|
r600_get_llvm_processor_name(sscreen->b.family),
|
||||||
features,
|
features,
|
||||||
LLVMCodeGenLevelDefault,
|
LLVMCodeGenLevelDefault,
|
||||||
|
|
|
@ -246,8 +246,6 @@ si_shader_context(struct lp_build_tgsi_context *bld_base)
|
||||||
|
|
||||||
void si_llvm_add_attribute(LLVMValueRef F, const char *name, int value);
|
void si_llvm_add_attribute(LLVMValueRef F, const char *name, int value);
|
||||||
|
|
||||||
LLVMTargetRef si_llvm_get_amdgpu_target(const char *triple);
|
|
||||||
|
|
||||||
unsigned si_llvm_compile(LLVMModuleRef M, struct ac_shader_binary *binary,
|
unsigned si_llvm_compile(LLVMModuleRef M, struct ac_shader_binary *binary,
|
||||||
LLVMTargetMachineRef tm,
|
LLVMTargetMachineRef tm,
|
||||||
struct pipe_debug_callback *debug);
|
struct pipe_debug_callback *debug);
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <llvm-c/Transforms/IPO.h>
|
#include <llvm-c/Transforms/IPO.h>
|
||||||
#include <llvm-c/Transforms/Scalar.h>
|
#include <llvm-c/Transforms/Scalar.h>
|
||||||
#include <llvm-c/Support.h>
|
|
||||||
|
|
||||||
/* Data for if/else/endif and bgnloop/endloop control flow structures.
|
/* Data for if/else/endif and bgnloop/endloop control flow structures.
|
||||||
*/
|
*/
|
||||||
|
@ -66,47 +65,6 @@ void si_llvm_add_attribute(LLVMValueRef F, const char *name, int value)
|
||||||
LLVMAddTargetDependentFunctionAttr(F, name, str);
|
LLVMAddTargetDependentFunctionAttr(F, name, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_amdgpu_target()
|
|
||||||
{
|
|
||||||
LLVMInitializeAMDGPUTargetInfo();
|
|
||||||
LLVMInitializeAMDGPUTarget();
|
|
||||||
LLVMInitializeAMDGPUTargetMC();
|
|
||||||
LLVMInitializeAMDGPUAsmPrinter();
|
|
||||||
|
|
||||||
/* For inline assembly. */
|
|
||||||
LLVMInitializeAMDGPUAsmParser();
|
|
||||||
|
|
||||||
if (HAVE_LLVM >= 0x0400) {
|
|
||||||
/*
|
|
||||||
* Workaround for bug in llvm 4.0 that causes image intrinsics
|
|
||||||
* to disappear.
|
|
||||||
* https://reviews.llvm.org/D26348
|
|
||||||
*/
|
|
||||||
const char *argv[2] = {"mesa", "-simplifycfg-sink-common=false"};
|
|
||||||
LLVMParseCommandLineOptions(2, argv, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static once_flag init_amdgpu_target_once_flag = ONCE_FLAG_INIT;
|
|
||||||
|
|
||||||
LLVMTargetRef si_llvm_get_amdgpu_target(const char *triple)
|
|
||||||
{
|
|
||||||
LLVMTargetRef target = NULL;
|
|
||||||
char *err_message = NULL;
|
|
||||||
|
|
||||||
call_once(&init_amdgpu_target_once_flag, init_amdgpu_target);
|
|
||||||
|
|
||||||
if (LLVMGetTargetFromTriple(triple, &target, &err_message)) {
|
|
||||||
fprintf(stderr, "Cannot find target for triple %s ", triple);
|
|
||||||
if (err_message) {
|
|
||||||
fprintf(stderr, "%s\n", err_message);
|
|
||||||
}
|
|
||||||
LLVMDisposeMessage(err_message);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct si_llvm_diagnostics {
|
struct si_llvm_diagnostics {
|
||||||
struct pipe_debug_callback *debug;
|
struct pipe_debug_callback *debug;
|
||||||
unsigned retval;
|
unsigned retval;
|
||||||
|
|
Loading…
Reference in New Issue