aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_pipe.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-04-09 19:13:37 -0400
committerMarek Olšák <[email protected]>2018-04-27 17:56:04 -0400
commit797d673c9a8c2d0a392f80b3c2190606ba8a6c83 (patch)
tree76e34db0ba1ad6cd415d259b74afedd78cb7a597 /src/gallium/drivers/radeonsi/si_pipe.c
parentc1823ff661b016defe93baa0038e5fd6ca8522c4 (diff)
radeonsi: move passmgr into si_compiler
Reviewed-by: Timothy Arceri <[email protected]> Tested-by: Benedikt Schemmer <ben at besd.de> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pipe.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 19b570e569e..eeb7ff81f92 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -41,6 +41,12 @@
#include "vl/vl_decoder.h"
#include "driver_ddebug/dd_util.h"
+#include <llvm-c/Transforms/IPO.h>
+#include <llvm-c/Transforms/Scalar.h>
+#if HAVE_LLVM >= 0x0700
+#include <llvm-c/Transforms/Utils.h>
+#endif
+
static const struct debug_named_value debug_options[] = {
/* Shader logging options: */
{ "vs", DBG(VS), "Print vertex shaders" },
@@ -121,10 +127,34 @@ static void si_init_compiler(struct si_screen *sscreen,
gallivm_create_target_library_info(compiler->triple);
if (!compiler->target_library_info)
return;
+
+ compiler->passmgr = LLVMCreatePassManager();
+ if (!compiler->passmgr)
+ return;
+
+ LLVMAddTargetLibraryInfo(compiler->target_library_info,
+ compiler->passmgr);
+
+ /* Add LLVM passes into the pass manager. */
+ if (sscreen->debug_flags & DBG(CHECK_IR))
+ LLVMAddVerifierPass(compiler->passmgr);
+
+ LLVMAddAlwaysInlinerPass(compiler->passmgr);
+ /* This pass should eliminate all the load and store instructions. */
+ LLVMAddPromoteMemoryToRegisterPass(compiler->passmgr);
+ LLVMAddScalarReplAggregatesPass(compiler->passmgr);
+ LLVMAddLICMPass(compiler->passmgr);
+ LLVMAddAggressiveDCEPass(compiler->passmgr);
+ LLVMAddCFGSimplificationPass(compiler->passmgr);
+ /* This is recommended by the instruction combining pass. */
+ LLVMAddEarlyCSEMemSSAPass(compiler->passmgr);
+ LLVMAddInstructionCombiningPass(compiler->passmgr);
}
static void si_destroy_compiler(struct si_compiler *compiler)
{
+ if (compiler->passmgr)
+ LLVMDisposePassManager(compiler->passmgr);
if (compiler->target_library_info)
gallivm_dispose_target_library_info(compiler->target_library_info);
if (compiler->tm)