DumpCFG.cpp 630 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Bytecode/PassManager.h>
  7. #include <stdio.h>
  8. namespace JS::Bytecode::Passes {
  9. void DumpCFG::perform(PassPipelineExecutable& executable)
  10. {
  11. started();
  12. VERIFY(executable.cfg.has_value());
  13. outln(m_file, "CFG Dump for {} basic blocks:", executable.executable.basic_blocks.size());
  14. for (auto& entry : executable.cfg.value()) {
  15. for (auto& value : entry.value)
  16. outln(m_file, "{} -> {}", entry.key->name(), value->name());
  17. }
  18. outln(m_file);
  19. finished();
  20. }
  21. }