diff options
author | Alon Zakai <azakai@google.com> | 2023-07-19 08:44:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-19 08:44:03 -0700 |
commit | a15d71f5fb4f3488e8a25071cb8813fe6045290e (patch) | |
tree | 6e5c27c266afd859d686c62da445be0f3360e393 /src | |
parent | 4a6d45ff6ffd0eae971f4b0894b69f365cfc86c6 (diff) | |
download | binaryen-a15d71f5fb4f3488e8a25071cb8813fe6045290e.tar.gz binaryen-a15d71f5fb4f3488e8a25071cb8813fe6045290e.tar.bz2 binaryen-a15d71f5fb4f3488e8a25071cb8813fe6045290e.zip |
[NFC] Allow running multiple analyses in ParallelFunctionAnalysis (#5824)
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/module-utils.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h index 1ab365b81..f4c8c51c4 100644 --- a/src/ir/module-utils.h +++ b/src/ir/module-utils.h @@ -414,12 +414,21 @@ struct ParallelFunctionAnalysis { using Func = std::function<void(Function*, T&)>; ParallelFunctionAnalysis(Module& wasm, Func work) : wasm(wasm) { - // Fill in map, as we operate on it in parallel (each function to its own + // Fill in the map as we operate on it in parallel (each function to its own // entry). for (auto& func : wasm.functions) { map[func.get()]; } + doAnalysis(work); + } + + // Perform an analysis by operating on each function, in parallel. + // + // This is called from the constructor (with the work function given there), + // and can also be called later as well if the user has additional operations + // to perform. + void doAnalysis(Func work) { // Run on the imports first. TODO: parallelize this too for (auto& func : wasm.functions) { if (func->imported()) { |