summaryrefslogtreecommitdiff
path: root/src/passes
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes')
-rw-r--r--src/passes/Print.cpp12
-rw-r--r--src/passes/SimplifyGlobals.cpp8
2 files changed, 10 insertions, 10 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index d6dbb3300..18f2beb43 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -59,12 +59,12 @@ static std::ostream& printLocal(Index index, Function* func, std::ostream& o) {
// Unlike the default format, tuple types in s-expressions should not have
// commas.
-struct LocalType {
+struct SExprType {
Type type;
- LocalType(Type type) : type(type){};
+ SExprType(Type type) : type(type){};
};
-static std::ostream& operator<<(std::ostream& o, const LocalType& localType) {
+static std::ostream& operator<<(std::ostream& o, const SExprType& localType) {
Type type = localType.type;
if (type.isMulti()) {
const std::vector<Type>& types = type.expand();
@@ -2072,9 +2072,9 @@ struct PrintSExpression : public OverriddenVisitor<PrintSExpression> {
}
void emitGlobalType(Global* curr) {
if (curr->mutable_) {
- o << "(mut " << curr->type << ')';
+ o << "(mut " << SExprType(curr->type) << ')';
} else {
- o << curr->type;
+ o << SExprType(curr->type);
}
}
void visitImportedGlobal(Global* curr) {
@@ -2155,7 +2155,7 @@ struct PrintSExpression : public OverriddenVisitor<PrintSExpression> {
o << '(';
printMinor(o, "local ");
printLocal(i, currFunction, o)
- << ' ' << LocalType(curr->getLocalType(i)) << ')';
+ << ' ' << SExprType(curr->getLocalType(i)) << ')';
o << maybeNewLine;
}
// Print the body.
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()) {