summaryrefslogtreecommitdiff
path: root/src/wasm-binary.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-03-11 16:42:44 -0800
committerGitHub <noreply@github.com>2021-03-11 16:42:44 -0800
commit32be343d217781045572da274eb4d63f4ead86c5 (patch)
tree6ba60558e8411f4b6d083173cbcb6dd460113573 /src/wasm-binary.h
parent74870e8a77625477e2c43883ec386380b2aea4e3 (diff)
downloadbinaryen-32be343d217781045572da274eb4d63f4ead86c5.tar.gz
binaryen-32be343d217781045572da274eb4d63f4ead86c5.tar.bz2
binaryen-32be343d217781045572da274eb4d63f4ead86c5.zip
Refactor OptimizeInstructions to use visit* methods. NFC (#3678)
Instead of a single big optimize() method we now use separate functions per instruction. This gives us smaller functions and less nesting in some cases, and avoids manually casting and checking etc. The reason this was not done originally is that this pass does repeated applications. That is, if optimize() changed something, it would run again on the result, perhaps further optimizing it. It did not need to run on the children, but just on the result itself, so it didn't just do another full walk, and so the simplest way was to just do a loop on optimize(). To replace that, this PR modifies replaceCurrent() which the methods now call to report that the current node can be replaced. There is some code in there now that keeps doing more processing while changes happen. It's not trivial code as it avoids recursion, but that slight complexity seems worthwhile in order to simplify the bulk of the (very large) pass.
Diffstat (limited to 'src/wasm-binary.h')
0 files changed, 0 insertions, 0 deletions