summaryrefslogtreecommitdiff
path: root/src/analysis/monotone-analyzer-impl.h
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-10-25 19:43:29 +0200
committerGitHub <noreply@github.com>2023-10-25 19:43:29 +0200
commit9af7abd106e6e1b1dccdd70125a761b385f653d8 (patch)
treed5abf8978ce9715b8b623833aa809e1ad1f4591a /src/analysis/monotone-analyzer-impl.h
parentef8e424ac85a4d719233764f980a331842af6907 (diff)
downloadbinaryen-9af7abd106e6e1b1dccdd70125a761b385f653d8.tar.gz
binaryen-9af7abd106e6e1b1dccdd70125a761b385f653d8.tar.bz2
binaryen-9af7abd106e6e1b1dccdd70125a761b385f653d8.zip
[analysis][NFC] Rename `makeLeastUpperBound` to `join` and move it to lattice (#6035)
In general, the operation of taking the least upper bound of two lattice elements may depend on some state stored in the lattice object rather than in the elements themselves. To avoid forcing the elements to be larger and more complicated in that case (by storing a parent pointer back to the lattice), move the least upper bound operation to make it a method of the lattice rather than the lattice element. This is also more consistent with where we put e.g. the `compare` method. While we are at it, rename `makeLeastUpperBound` to `join`, which is much shorter and nicer. Usually we avoid using esoteric mathematical jargon like this, but "join" as a normal verb actually describes the operation nicely, so I think it is ok in this case.
Diffstat (limited to 'src/analysis/monotone-analyzer-impl.h')
-rw-r--r--src/analysis/monotone-analyzer-impl.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/analysis/monotone-analyzer-impl.h b/src/analysis/monotone-analyzer-impl.h
index e52ac5759..1f8182908 100644
--- a/src/analysis/monotone-analyzer-impl.h
+++ b/src/analysis/monotone-analyzer-impl.h
@@ -45,7 +45,7 @@ inline void MonotoneCFGAnalyzer<L, TxFn>::evaluate() {
for (auto& dep : txfn.getDependents(cfg[i])) {
// If the input state for the dependent block changes, we need to
// re-analyze it.
- if (states[dep.getIndex()].makeLeastUpperBound(state)) {
+ if (lattice.join(states[dep.getIndex()], state)) {
worklist.push(dep.getIndex());
}
}