diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2020-04-02 10:36:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 10:36:19 -0700 |
commit | 80c5164e1f50ed26e6fab373a563fd7a84135429 (patch) | |
tree | ac944407ac6bf1b26e524d31a3db8c410e4599e7 /src/passes/SimplifyGlobals.cpp | |
parent | 702b99508487bc5f56c409d890644b3b9212ae81 (diff) | |
download | binaryen-80c5164e1f50ed26e6fab373a563fd7a84135429.tar.gz binaryen-80c5164e1f50ed26e6fab373a563fd7a84135429.tar.bz2 binaryen-80c5164e1f50ed26e6fab373a563fd7a84135429.zip |
Tuple globals (#2718)
Since it wasn't easy to support tuples in Asyncify's call support
using temporary functions, we decided to allow tuple-typed globals
after all. This PR adds support for parsing, printing, lowering, and
interpreting tuple globals and also adds validation ensuring that
imported and exported globals do not have tuple types.
Diffstat (limited to 'src/passes/SimplifyGlobals.cpp')
-rw-r--r-- | src/passes/SimplifyGlobals.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/passes/SimplifyGlobals.cpp b/src/passes/SimplifyGlobals.cpp index 55c16910a..5fa1686fc 100644 --- a/src/passes/SimplifyGlobals.cpp +++ b/src/passes/SimplifyGlobals.cpp @@ -109,7 +109,7 @@ struct ConstantGlobalApplier if (auto* set = curr->dynCast<GlobalSet>()) { if (Properties::isConstantExpression(set->value)) { currConstantGlobals[set->name] = - getSingleLiteralFromConstExpression(set->value); + getLiteralsFromConstExpression(set->value); } else { currConstantGlobals.erase(set->name); } @@ -160,7 +160,7 @@ private: bool replaced = false; // The globals currently constant in the linear trace. - std::map<Name, Literal> currConstantGlobals; + std::map<Name, Literals> currConstantGlobals; }; } // anonymous namespace @@ -248,12 +248,12 @@ struct SimplifyGlobals : public Pass { void propagateConstantsToGlobals() { // Go over the list of globals in order, which is the order of // initialization as well, tracking their constant values. - std::map<Name, Literal> constantGlobals; + std::map<Name, Literals> constantGlobals; for (auto& global : module->globals) { if (!global->imported()) { if (Properties::isConstantExpression(global->init)) { constantGlobals[global->name] = - getSingleLiteralFromConstExpression(global->init); + getLiteralsFromConstExpression(global->init); } else if (auto* get = global->init->dynCast<GlobalGet>()) { auto iter = constantGlobals.find(get->name); if (iter != constantGlobals.end()) { |