diff options
author | Thomas Lively <tlively@google.com> | 2023-11-02 21:50:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-02 13:50:25 -0700 |
commit | 4fba26a77ea344b8d2b49cc8e1afdc8fcda13e96 (patch) | |
tree | 5409b665b4610bc8c07f2e7629d5883f4f3c0633 /src/analysis/cfg.cpp | |
parent | 2c3860b8f6e9ba3e0878ecadfdef409da0f471b7 (diff) | |
download | binaryen-4fba26a77ea344b8d2b49cc8e1afdc8fcda13e96.tar.gz binaryen-4fba26a77ea344b8d2b49cc8e1afdc8fcda13e96.tar.bz2 binaryen-4fba26a77ea344b8d2b49cc8e1afdc8fcda13e96.zip |
[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.
Diffstat (limited to 'src/analysis/cfg.cpp')
-rw-r--r-- | src/analysis/cfg.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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"; |