diff options
author | Alon Zakai <azakai@google.com> | 2019-04-25 17:10:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-25 17:10:06 -0700 |
commit | 78a4f9ef1afd6c209a5c69a8e7906ffe33575f58 (patch) | |
tree | 0f7443f2ca32ce1a6131a6cc95212de9b5ececb1 /src/ir/effects.h | |
parent | 21f014f4bd0ea1086895d8674f1473af222eb416 (diff) | |
download | binaryen-78a4f9ef1afd6c209a5c69a8e7906ffe33575f58.tar.gz binaryen-78a4f9ef1afd6c209a5c69a8e7906ffe33575f58.tar.bz2 binaryen-78a4f9ef1afd6c209a5c69a8e7906ffe33575f58.zip |
wasm2js2: optimize call_indirect and select operands (#2056)
Don't use temp vars to reorder them unless we need to.
Diffstat (limited to 'src/ir/effects.h')
-rw-r--r-- | src/ir/effects.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h index 1c33964a7..e1fa77af0 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h @@ -59,13 +59,13 @@ struct EffectAnalyzer : public PostWalker<EffectAnalyzer, OverriddenVisitor<Effe // Helper functions to check for various effect types - bool accessesLocal() { return localsRead.size() + localsWritten.size() > 0; } - bool accessesGlobal() { return globalsRead.size() + globalsWritten.size() > 0; } - bool accessesMemory() { return calls || readsMemory || writesMemory; } + bool accessesLocal() const { return localsRead.size() + localsWritten.size() > 0; } + bool accessesGlobal() const { return globalsRead.size() + globalsWritten.size() > 0; } + bool accessesMemory() const { return calls || readsMemory || writesMemory; } - bool hasGlobalSideEffects() { return calls || globalsWritten.size() > 0 || writesMemory || isAtomic; } - bool hasSideEffects() { return hasGlobalSideEffects() || localsWritten.size() > 0 || branches || implicitTrap; } - bool hasAnything() { return branches || calls || accessesLocal() || readsMemory || writesMemory || accessesGlobal() || implicitTrap || isAtomic; } + bool hasGlobalSideEffects() const { return calls || globalsWritten.size() > 0 || writesMemory || isAtomic; } + bool hasSideEffects() const { return hasGlobalSideEffects() || localsWritten.size() > 0 || branches || implicitTrap; } + bool hasAnything() const { return branches || calls || accessesLocal() || readsMemory || writesMemory || accessesGlobal() || implicitTrap || isAtomic; } bool noticesGlobalSideEffects() { return calls || readsMemory || isAtomic || globalsRead.size(); } @@ -73,7 +73,7 @@ struct EffectAnalyzer : public PostWalker<EffectAnalyzer, OverriddenVisitor<Effe bool hasExternalBreakTargets() { return !breakNames.empty(); } // checks if these effects would invalidate another set (e.g., if we write, we invalidate someone that reads, they can't be moved past us) - bool invalidates(EffectAnalyzer& other) { + bool invalidates(const EffectAnalyzer& other) { if ((branches && other.hasSideEffects()) || (other.branches && hasSideEffects()) || ((writesMemory || calls) && other.accessesMemory()) || |