
This commit adds a bunch of passes, the most interesting of which is a pass that merges blocks together, and a pass that places blocks that flow into each other next to each other, and a very simply pass that removes duplicate basic blocks. Note that this does not remove the jump at the end of each block in that pass to avoid scope creep in the passes.
27 lines
630 B
C++
27 lines
630 B
C++
/*
|
|
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Bytecode/PassManager.h>
|
|
#include <stdio.h>
|
|
|
|
namespace JS::Bytecode::Passes {
|
|
|
|
void DumpCFG::perform(PassPipelineExecutable& executable)
|
|
{
|
|
started();
|
|
|
|
VERIFY(executable.cfg.has_value());
|
|
outln(m_file, "CFG Dump for {} basic blocks:", executable.executable.basic_blocks.size());
|
|
for (auto& entry : executable.cfg.value()) {
|
|
for (auto& value : entry.value)
|
|
outln(m_file, "{} -> {}", entry.key->name(), value->name());
|
|
}
|
|
outln(m_file);
|
|
|
|
finished();
|
|
}
|
|
|
|
}
|