From 54c77ff7c48d250a1a5b0aa2a262689fa8184d78 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 27 Jan 2016 18:34:14 -0800 Subject: Adds a --metrics command line argument to print metrics about .wast files between optimization passes. --- src/wasm.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/wasm.h') diff --git a/src/wasm.h b/src/wasm.h index 987a8da6b..856c0ebeb 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -350,6 +350,32 @@ public: } }; +inline const char *getExpressionName(Expression *curr) { + switch (curr->_id) { + case Expression::Id::InvalidId: abort(); + case Expression::Id::BlockId: return "block"; + case Expression::Id::IfId: return "if"; + case Expression::Id::LoopId: return "loop"; + case Expression::Id::BreakId: return "break"; + case Expression::Id::SwitchId: return "switch"; + case Expression::Id::CallId: return "call"; + case Expression::Id::CallImportId: return "call_import"; + case Expression::Id::CallIndirectId: return "call_indirect"; + case Expression::Id::GetLocalId: return "get_local"; + case Expression::Id::SetLocalId: return "set_local"; + case Expression::Id::LoadId: return "load"; + case Expression::Id::StoreId: return "store"; + case Expression::Id::ConstId: return "const"; + case Expression::Id::UnaryId: return "unary"; + case Expression::Id::BinaryId: return "binary"; + case Expression::Id::SelectId: return "select"; + case Expression::Id::HostId: return "host"; + case Expression::Id::NopId: return "nop"; + case Expression::Id::UnreachableId: return "unreachable"; + default: WASM_UNREACHABLE(); + } +} + typedef std::vector ExpressionList; // TODO: optimize? class Nop : public Expression { -- cgit v1.2.3