summaryrefslogtreecommitdiff
path: root/src/passes/Print.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-01-27 19:40:08 +0000
committerGitHub <noreply@github.com>2021-01-27 11:40:08 -0800
commit5331e9d18b9359aa0e9d6e0df455883f62e46ea0 (patch)
tree7114cb1190a1a2c6c886b267092d613d74ad50b9 /src/passes/Print.cpp
parent2bdc4841b680ee44e132bbb07f5167eaa7226f99 (diff)
downloadbinaryen-5331e9d18b9359aa0e9d6e0df455883f62e46ea0.tar.gz
binaryen-5331e9d18b9359aa0e9d6e0df455883f62e46ea0.tar.bz2
binaryen-5331e9d18b9359aa0e9d6e0df455883f62e46ea0.zip
Simplfy getExpressionName (#3522)
This used to return a simple name like "if" for an If, but it is redundant with our proper printing logic. This PR turns it into a trivial helper that just prints out the name of the class, so it now prints "If" with a capital. That is useful for some logging, like in Metrics I think it is clearer than it was earlier (since we are actually counting the classes, and our old emitting of text-format-like names are just confusing, as we emitted "binary" there which is not valid). Also replace some usages of that method with proper printing.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r--src/passes/Print.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index a6efd5f1f..23590ebd5 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -3200,15 +3200,12 @@ static std::ostream& printExpression(Expression* expression,
static std::ostream&
printStackInst(StackInst* inst, std::ostream& o, Function* func) {
switch (inst->op) {
- case StackInst::Basic: {
- PrintExpressionContents(func, o).visit(inst->origin);
- break;
- }
+ case StackInst::Basic:
case StackInst::BlockBegin:
case StackInst::IfBegin:
case StackInst::LoopBegin:
case StackInst::TryBegin: {
- o << getExpressionName(inst->origin);
+ PrintExpressionContents(func, o).visit(inst->origin);
break;
}
case StackInst::BlockEnd: