From c8a57dee5e9c99c51433f3d08da3edc2aadb0140 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 30 May 2016 12:08:17 -0700 Subject: add an option to run passes on individual functions, and to get default optimization passes suitable for that, or not. refactor visitFunction/Module for this. --- src/wasm-traversal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wasm-traversal.h') diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h index 9ed02027e..e5da420b0 100644 --- a/src/wasm-traversal.h +++ b/src/wasm-traversal.h @@ -187,6 +187,7 @@ struct Walker : public VisitorType { void walkFunction(Function* func) { setFunction(func); static_cast(this)->doWalkFunction(func); + static_cast(this)->visitFunction(func); } // override this to provide custom functionality @@ -197,6 +198,7 @@ struct Walker : public VisitorType { void walkModule(Module *module) { setModule(module); static_cast(this)->doWalkModule(module); + static_cast(this)->visitModule(module); } // override this to provide custom functionality @@ -223,7 +225,6 @@ struct Walker : public VisitorType { allocated = std::unique_ptr(instance); } instance->walkFunction(func); - instance->visitFunction(func); }; // if this is not a function-parallel traversal, run @@ -259,7 +260,6 @@ struct Walker : public VisitorType { } self->visitTable(&module->table); self->visitMemory(&module->memory); - self->visitModule(module); } // Walk implementation. We don't use recursion as ASTs may be highly -- cgit v1.2.3