radv: port to use common passmgr code.
This adds a inline always pass, but otherwise should work the same. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
@@ -172,6 +172,7 @@ LLVMPassManagerRef ac_create_passmgr(LLVMTargetLibraryInfoRef target_library_inf
|
|||||||
if (!passmgr)
|
if (!passmgr)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (target_library_info)
|
||||||
LLVMAddTargetLibraryInfo(target_library_info,
|
LLVMAddTargetLibraryInfo(target_library_info,
|
||||||
passmgr);
|
passmgr);
|
||||||
|
|
||||||
|
@@ -2996,30 +2996,10 @@ static void ac_llvm_finalize_module(struct radv_shader_context *ctx,
|
|||||||
const struct radv_nir_compiler_options *options)
|
const struct radv_nir_compiler_options *options)
|
||||||
{
|
{
|
||||||
LLVMPassManagerRef passmgr;
|
LLVMPassManagerRef passmgr;
|
||||||
/* Create the pass manager */
|
|
||||||
passmgr = LLVMCreateFunctionPassManagerForModule(
|
|
||||||
ctx->ac.module);
|
|
||||||
|
|
||||||
if (options->check_ir)
|
passmgr = ac_create_passmgr(NULL, options->check_ir);
|
||||||
LLVMAddVerifierPass(passmgr);
|
|
||||||
|
|
||||||
/* This pass should eliminate all the load and store instructions */
|
|
||||||
LLVMAddPromoteMemoryToRegisterPass(passmgr);
|
|
||||||
|
|
||||||
/* Add some optimization passes */
|
|
||||||
LLVMAddScalarReplAggregatesPass(passmgr);
|
|
||||||
LLVMAddLICMPass(passmgr);
|
|
||||||
LLVMAddAggressiveDCEPass(passmgr);
|
|
||||||
LLVMAddCFGSimplificationPass(passmgr);
|
|
||||||
/* This is recommended by the instruction combining pass. */
|
|
||||||
LLVMAddEarlyCSEMemSSAPass(passmgr);
|
|
||||||
LLVMAddInstructionCombiningPass(passmgr);
|
|
||||||
|
|
||||||
/* Run the pass */
|
|
||||||
LLVMInitializeFunctionPassManager(passmgr);
|
|
||||||
LLVMRunFunctionPassManager(passmgr, ctx->main_function);
|
|
||||||
LLVMFinalizeFunctionPassManager(passmgr);
|
|
||||||
|
|
||||||
|
LLVMRunPassManager(passmgr, ctx->ac.module);
|
||||||
LLVMDisposeBuilder(ctx->ac.builder);
|
LLVMDisposeBuilder(ctx->ac.builder);
|
||||||
LLVMDisposePassManager(passmgr);
|
LLVMDisposePassManager(passmgr);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user