diff options
author | Tom Stellard <[email protected]> | 2014-10-15 12:24:30 -0400 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2015-01-06 12:53:21 -0800 |
commit | 761e36b4caab4e8e09a4c2b1409a825902fc7d2c (patch) | |
tree | c8b8639b11190ebfcc43f4e22fa771f86d551bd8 /src/gallium/drivers/radeonsi/si_pipe.c | |
parent | 934e41c0b31cffa4efc08f61cff2389e3149b3f3 (diff) |
radeonsi: Cache LLVMTargetMachine object in si_screen
Rather than building a new one every compile. This should reduce some
of the overhead of compiling shaders.
One consequence of this change is that we lose the MachineInstrs dumps
when dumping the shaders via R600_DEBUG. The LLVM IR and assembly is
still dumped, and if you still want to see the MachineInstr dump, you
can run the dumped LLVM IR through llc.
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pipe.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index afb6364a776..4b7156140b7 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -25,10 +25,14 @@ #include "si_public.h" #include "sid.h" +#include "radeon/radeon_llvm_emit.h" #include "radeon/radeon_uvd.h" #include "util/u_memory.h" #include "vl/vl_decoder.h" +#include <llvm-c/Target.h> +#include <llvm-c/TargetMachine.h> + /* * pipe_context */ @@ -420,6 +424,10 @@ static void si_destroy_screen(struct pipe_screen* pscreen) return; r600_destroy_common_screen(&sscreen->b); + +#if HAVE_LLVM >= 0x0306 + LLVMDisposeTargetMachine(sscreen->tm); +#endif } #define SI_TILE_MODE_COLOR_2D_8BPP 14 @@ -476,6 +484,7 @@ static bool si_initialize_pipe_config(struct si_screen *sscreen) struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws) { struct si_screen *sscreen = CALLOC_STRUCT(si_screen); + LLVMTargetRef r600_target; if (sscreen == NULL) { return NULL; } @@ -503,5 +512,13 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws) /* Create the auxiliary context. This must be done last. */ sscreen->b.aux_context = sscreen->b.b.context_create(&sscreen->b.b, NULL); +#if HAVE_LLVM >= 0x0306 + /* Initialize LLVM TargetMachine */ + r600_target = radeon_llvm_get_r600_target(); + sscreen->tm = LLVMCreateTargetMachine(r600_target, "r600--", + r600_get_llvm_processor_name(sscreen->b.family), + "+DumpCode", LLVMCodeGenLevelDefault, LLVMRelocDefault, + LLVMCodeModelDefault); +#endif return &sscreen->b.b; } |