summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm.h3
-rw-r--r--src/wasm/wasm.cpp8
2 files changed, 11 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h
index a1c386289..b52e7539b 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -588,6 +588,9 @@ public:
assert(int(_id) == int(T::SpecificId));
return (const T*)this;
}
+
+ // Print the expression to stderr. Meant for use while debugging.
+ void dump();
};
const char* getExpressionName(Expression* curr);
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 6f86a13ac..f1d51bbca 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -16,6 +16,7 @@
#include "wasm.h"
#include "ir/branch-utils.h"
+#include "wasm-printing.h"
#include "wasm-traversal.h"
namespace wasm {
@@ -93,6 +94,13 @@ Name ATTR("attr");
// Expressions
+void Expression::dump() {
+ WasmPrinter::printExpression(this,
+ std::cerr,
+ /*minify=*/false,
+ /*full=*/true);
+}
+
const char* getExpressionName(Expression* curr) {
switch (curr->_id) {
case Expression::Id::InvalidId: