aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-06-11 18:53:15 +0200
committerMarek Olšák <[email protected]>2016-07-05 00:47:13 +0200
commit6781a2a9942c760776a6b769e8891916bb8c3a82 (patch)
tree826e7e185a4f6c0695635178d7c02f5f82bc81ce /src
parent8a4ace4a47a07323997da5c2dbc865a32df52451 (diff)
radeonsi: move LLVMTargetMachineRef creation to a separate function
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c32
1 files changed, 18 insertions, 14 deletions
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: