JSSpecCompiler: Add control flow graph simplification pass

It removes empty `BasicBlock`s with an unconditional jump continuation
and then removes unreferenced blocks from the graph.
This commit is contained in:
Dan Klishch 2023-08-19 16:20:04 -04:00 committed by Andrew Kaster
parent 475ef6965a
commit 12072dbac5
Notes: sideshowbarker 2024-07-17 03:27:40 +09:00
7 changed files with 215 additions and 1 deletions

View file

@ -9,6 +9,7 @@
#include <LibMain/Main.h>
#include "Compiler/Passes/CFGBuildingPass.h"
#include "Compiler/Passes/CFGSimplificationPass.h"
#include "Compiler/Passes/FunctionCallCanonicalizationPass.h"
#include "Compiler/Passes/IfBranchMergingPass.h"
#include "Compiler/Passes/ReferenceResolvingPass.h"
@ -106,6 +107,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
pipeline.add_compilation_pass<IfBranchMergingPass>();
pipeline.add_compilation_pass<ReferenceResolvingPass>();
pipeline.add_compilation_pass<CFGBuildingPass>();
pipeline.add_compilation_pass<CFGSimplificationPass>();
pipeline.for_each_step_in(passes_to_dump_ast, [](CompilationStepWithDumpOptions& step) {
step.dump_ast = true;