From: Marek Olšák Date: Sat, 11 Jun 2016 16:53:15 +0000 (+0200) Subject: radeonsi: move LLVMTargetMachineRef creation to a separate function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6781a2a9942c760776a6b769e8891916bb8c3a82;p=mesa.git radeonsi: move LLVMTargetMachineRef creation to a separate function Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 57c3fbde3f6..06b32db43db 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -123,14 +123,29 @@ static void si_emit_string_marker(struct pipe_context *ctx, dd_parse_apitrace_marker(string, len, &sctx->apitrace_call_number); } +static LLVMTargetMachineRef +si_create_llvm_target_machine(struct si_screen *sscreen) +{ + const char *triple = "amdgcn--"; + + return LLVMCreateTargetMachine(radeon_llvm_get_r600_target(triple), triple, + r600_get_llvm_processor_name(sscreen->b.family), +#if HAVE_LLVM >= 0x0308 + sscreen->b.debug_flags & DBG_SI_SCHED ? + SI_LLVM_DEFAULT_FEATURES ",+si-scheduler" : +#endif + SI_LLVM_DEFAULT_FEATURES, + LLVMCodeGenLevelDefault, + LLVMRelocDefault, + LLVMCodeModelDefault); +} + static struct pipe_context *si_create_context(struct pipe_screen *screen, void *priv, unsigned flags) { struct si_context *sctx = CALLOC_STRUCT(si_context); struct si_screen* sscreen = (struct si_screen *)screen; struct radeon_winsys *ws = sscreen->b.ws; - LLVMTargetRef r600_target; - const char *triple = "amdgcn--"; int shader, i; if (!sctx) @@ -279,18 +294,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, sctx->scratch_waves = MAX2(32 * sscreen->b.info.num_good_compute_units, max_threads_per_block / 64); - /* Initialize LLVM TargetMachine */ - r600_target = radeon_llvm_get_r600_target(triple); - sctx->tm = LLVMCreateTargetMachine(r600_target, triple, - r600_get_llvm_processor_name(sscreen->b.family), -#if HAVE_LLVM >= 0x0308 - sscreen->b.debug_flags & DBG_SI_SCHED ? - SI_LLVM_DEFAULT_FEATURES ",+si-scheduler" : -#endif - SI_LLVM_DEFAULT_FEATURES, - LLVMCodeGenLevelDefault, - LLVMRelocDefault, - LLVMCodeModelDefault); + sctx->tm = si_create_llvm_target_machine(sscreen); return &sctx->b.b; fail: