From 4fba26a77ea344b8d2b49cc8e1afdc8fcda13e96 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 2 Nov 2023 21:50:25 +0100 Subject: [analysis] Make it easier to implement a transfer function (#6077) Combine the `transfer` and `getDependents` methods of a transfer function so that a transfer function only has to implement `transfer`, which now returns a range of basic blocks that may need to be re-analyzed. To make it easier to implement the returned basic block range, change the requirement so that it provides iterators to `const BasicBlock*` rather than `BasicBlock`. This allows us to entirely remove cfg-impl.h. --- src/analysis/cfg.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/analysis/cfg.cpp') diff --git a/src/analysis/cfg.cpp b/src/analysis/cfg.cpp index 0d651526b..ba638ec5a 100644 --- a/src/analysis/cfg.cpp +++ b/src/analysis/cfg.cpp @@ -80,19 +80,19 @@ void CFG::print(std::ostream& os, Module* wasm) const { void BasicBlock::print(std::ostream& os, Module* wasm, size_t start) const { os << ";; preds: ["; - for (auto& pred : preds()) { - if (&pred != &*preds().begin()) { + for (const auto* pred : preds()) { + if (pred != *preds().begin()) { os << ", "; } - os << pred.index; + os << pred->index; } os << "], succs: ["; - for (auto& succ : succs()) { - if (&succ != &*succs().begin()) { + for (const auto* succ : succs()) { + if (succ != *succs().begin()) { os << ", "; } - os << succ.index; + os << succ->index; } os << "]\n"; -- cgit v1.2.3