summaryrefslogtreecommitdiff
path: root/src/pass.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-10-06 16:41:13 -0700
committerGitHub <noreply@github.com>2023-10-06 16:41:13 -0700
commitb3775b5e4e150439276ad3d34f1bb564b28e8ef5 (patch)
treeeb7b09492205249f08459ffee38e081b83cbf17d /src/pass.h
parent9c1107d17c0b7223bd377d9ab4f36fe54ef07c7d (diff)
downloadbinaryen-b3775b5e4e150439276ad3d34f1bb564b28e8ef5.tar.gz
binaryen-b3775b5e4e150439276ad3d34f1bb564b28e8ef5.tar.bz2
binaryen-b3775b5e4e150439276ad3d34f1bb564b28e8ef5.zip
Automatically discard global effects in the rare passes that add effects (#5999)
All logging/instrumentation passes need to do this, to avoid us using stale global effects that are too low (too high is not optimal either, but at least it cannot cause bugs).
Diffstat (limited to 'src/pass.h')
-rw-r--r--src/pass.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pass.h b/src/pass.h
index 090aa8d33..da9a12b95 100644
--- a/src/pass.h
+++ b/src/pass.h
@@ -466,6 +466,13 @@ public:
// For more details see the LocalStructuralDominance class.
virtual bool requiresNonNullableLocalFixups() { return true; }
+ // Many passes can remove effects, for example, by finding some path is not
+ // reached and removing a throw or a call there. The few passes that *add*
+ // effects must mark themselves as such, so that we know to discard global
+ // effects after running them. For example, a logging pass that adds new calls
+ // to imports must override this to return true.
+ virtual bool addsEffects() { return false; }
+
std::string name;
PassRunner* getPassRunner() { return runner; }