summaryrefslogtreecommitdiff
path: root/src/analysis/lattice.h
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-10-25 19:00:55 +0200
committerGitHub <noreply@github.com>2023-10-25 19:00:55 +0200
commitef8e424ac85a4d719233764f980a331842af6907 (patch)
tree3c1eccc0da5cc8bf1f5808bd45d1f78c7359673f /src/analysis/lattice.h
parentdfd8c7e244a8a6b3666221fa4a7e611e3a97467d (diff)
downloadbinaryen-ef8e424ac85a4d719233764f980a331842af6907.tar.gz
binaryen-ef8e424ac85a4d719233764f980a331842af6907.tar.bz2
binaryen-ef8e424ac85a4d719233764f980a331842af6907.zip
[analysis] Simplify core analysis code (#6034)
Simplify the monotone analyzer by replacing all the state it used to store in `BlockState` with a simple vector of lattice elements. Use simple indices to refer to both blocks and their associated states in the vector. Remove the ability for transfer functions to control the initial enqueued order of basic blocks since that was a leaky abstraction. Replace the worklist with a UniqueDeferredQueue since that has generally proven to be more efficient in smiilarly contexts, and more importantly, it has a nicer API. Make miscellaneous simplifications to other code as well. Delete a few unit tests that exposed the order in which blocks were analyzed because they printed intermediate results. These tests should be replaced with tests of analyses' public APIs in the future.
Diffstat (limited to 'src/analysis/lattice.h')
-rw-r--r--src/analysis/lattice.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/analysis/lattice.h b/src/analysis/lattice.h
index 8d2b22243..7865de20b 100644
--- a/src/analysis/lattice.h
+++ b/src/analysis/lattice.h
@@ -19,7 +19,7 @@
#if __cplusplus >= 202002L
#include <concepts>
-#endif
+#endif // __cplusplus >= 202002L
namespace wasm::analysis {
@@ -45,6 +45,7 @@ concept Lattice = requires(const L& lattice,
typename L::Element& elem) {
// Lattices must have elements.
typename L::Element;
+ requires std::copyable<typename L::Element>;
// We need to be able to get the bottom element.
{ lattice.getBottom() } noexcept -> std::same_as<typename L::Element>;
// Elements should be comparable. TODO: use <=> and std::three_way_comparable
@@ -57,7 +58,7 @@ concept Lattice = requires(const L& lattice,
{ elem.makeLeastUpperBound(constElem) } noexcept -> std::same_as<bool>;
};
-#else
+#else // __cplusplus >= 202002L
#define Lattice typename