diff options
Diffstat (limited to 'src/passes/LogExecution.cpp')
-rw-r--r-- | src/passes/LogExecution.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/passes/LogExecution.cpp b/src/passes/LogExecution.cpp index abdaa8d23..7bfee7c24 100644 --- a/src/passes/LogExecution.cpp +++ b/src/passes/LogExecution.cpp @@ -28,26 +28,22 @@ // value. // -#include <wasm.h> -#include <wasm-builder.h> -#include <pass.h> -#include "shared-constants.h" -#include "asmjs/shared-constants.h" #include "asm_v_wasm.h" +#include "asmjs/shared-constants.h" #include "ir/function-type-utils.h" +#include "shared-constants.h" +#include <pass.h> +#include <wasm-builder.h> +#include <wasm.h> namespace wasm { Name LOGGER("log_execution"); struct LogExecution : public WalkerPass<PostWalker<LogExecution>> { - void visitLoop(Loop* curr) { - curr->body = makeLogCall(curr->body); - } + void visitLoop(Loop* curr) { curr->body = makeLogCall(curr->body); } - void visitReturn(Return* curr) { - replaceCurrent(makeLogCall(curr)); - } + void visitReturn(Return* curr) { replaceCurrent(makeLogCall(curr)); } void visitFunction(Function* curr) { if (curr->imported()) { @@ -61,7 +57,7 @@ struct LogExecution : public WalkerPass<PostWalker<LogExecution>> { curr->body = makeLogCall(curr->body); } - void visitModule(Module *curr) { + void visitModule(Module* curr) { // Add the import auto import = new Function; import->name = LOGGER; @@ -79,17 +75,11 @@ private: Builder builder(*getModule()); return builder.makeSequence( builder.makeCall( - LOGGER, - { builder.makeConst(Literal(int32_t(id++))) }, - none - ), - curr - ); + LOGGER, {builder.makeConst(Literal(int32_t(id++)))}, none), + curr); } }; -Pass *createLogExecutionPass() { - return new LogExecution(); -} +Pass* createLogExecutionPass() { return new LogExecution(); } } // namespace wasm |