summaryrefslogtreecommitdiff
path: root/src/passes
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes')
-rw-r--r--src/passes/LegalizeJSInterface.cpp6
-rw-r--r--src/passes/Metrics.cpp1
-rw-r--r--src/passes/NameManager.cpp2
-rw-r--r--src/passes/Print.cpp3
-rw-r--r--src/passes/RemoveUnusedModuleElements.cpp4
5 files changed, 9 insertions, 7 deletions
diff --git a/src/passes/LegalizeJSInterface.cpp b/src/passes/LegalizeJSInterface.cpp
index 4bb25361f..b52c1d330 100644
--- a/src/passes/LegalizeJSInterface.cpp
+++ b/src/passes/LegalizeJSInterface.cpp
@@ -41,7 +41,7 @@ struct LegalizeJSInterface : public Pass {
for (auto& ex : module->exports) {
if (ex->kind == ExternalKind::Function) {
// if it's an import, ignore it
- if (auto* func = module->checkFunction(ex->value)) {
+ if (auto* func = module->getFunctionOrNull(ex->value)) {
if (isIllegal(func)) {
auto legalName = makeLegalStub(func, module);
ex->value = legalName;
@@ -159,7 +159,7 @@ private:
}
// a method may be exported multiple times
- if (!module->checkFunction(legal->name)) {
+ if (!module->getFunctionOrNull(legal->name)) {
module->addFunction(legal);
}
return legal->name;
@@ -225,7 +225,7 @@ private:
}
void ensureTempRet0(Module* module) {
- if (!module->checkGlobal(TEMP_RET_0)) {
+ if (!module->getGlobalOrNull(TEMP_RET_0)) {
Global* global = new Global;
global->name = TEMP_RET_0;
global->type = i32;
diff --git a/src/passes/Metrics.cpp b/src/passes/Metrics.cpp
index 4dd8b1955..fe14135a4 100644
--- a/src/passes/Metrics.cpp
+++ b/src/passes/Metrics.cpp
@@ -17,6 +17,7 @@
#include <algorithm>
#include <iomanip>
#include <pass.h>
+#include <support/colors.h>
#include <wasm.h>
namespace wasm {
diff --git a/src/passes/NameManager.cpp b/src/passes/NameManager.cpp
index 9f0198c2f..035586a77 100644
--- a/src/passes/NameManager.cpp
+++ b/src/passes/NameManager.cpp
@@ -60,7 +60,7 @@ void NameManager::visitFunctionType(FunctionType* curr) {
void NameManager::visitFunction(Function* curr) {
names.insert(curr->name);
for (Index i = 0; i < curr->getNumLocals(); i++) {
- Name name = curr->tryLocalName(i);
+ Name name = curr->getLocalNameOrDefault(i);
if (name.is()) {
names.insert(name);
}
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index c46a0621d..04bf74529 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -21,6 +21,7 @@
#include <wasm.h>
#include <wasm-printing.h>
#include <pass.h>
+#include <pretty_printing.h>
namespace wasm {
@@ -90,7 +91,7 @@ struct PrintSExpression : public Visitor<PrintSExpression> {
Name printableLocal(Index index) {
Name name;
if (currFunction) {
- name = currFunction->tryLocalName(index);
+ name = currFunction->getLocalNameOrDefault(index);
}
if (!name.is()) {
name = Name::fromInt(index);
diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp
index 52a3ffc08..392096b72 100644
--- a/src/passes/RemoveUnusedModuleElements.cpp
+++ b/src/passes/RemoveUnusedModuleElements.cpp
@@ -59,13 +59,13 @@ struct ReachabilityAnalyzer : public PostWalker<ReachabilityAnalyzer> {
reachable.insert(curr);
if (curr.first == ModuleElementKind::Function) {
// if not an import, walk it
- auto* func = module->checkFunction(curr.second);
+ auto* func = module->getFunctionOrNull(curr.second);
if (func) {
walk(func->body);
}
} else {
// if not imported, it has an init expression we need to walk
- auto* glob = module->checkGlobal(curr.second);
+ auto* glob = module->getGlobalOrNull(curr.second);
if (glob) {
walk(glob->init);
}