diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-05-05 09:41:01 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-05-05 10:26:01 -0700 |
commit | 715d1becddcb89c49d71aa19e62ed27f967e5860 (patch) | |
tree | 546dd534511b228a9b46c9d1b491db3a335cad80 /src | |
parent | 9afdb5e5512ae4c9c23d7f2d41a35e63ecc3a0f5 (diff) | |
download | binaryen-715d1becddcb89c49d71aa19e62ed27f967e5860.tar.gz binaryen-715d1becddcb89c49d71aa19e62ed27f967e5860.tar.bz2 binaryen-715d1becddcb89c49d71aa19e62ed27f967e5860.zip |
add optimization to c api, and so that we can find all passes in the c api library, make it dynamic
Diffstat (limited to 'src')
-rw-r--r-- | src/binaryen-c.cpp | 8 | ||||
-rw-r--r-- | src/binaryen-c.h | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index b2c695ec0..bbafdf49d 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -19,6 +19,7 @@ //=============================== #include "binaryen-c.h" +#include "pass.h" #include "wasm.h" #include "wasm-builder.h" #include "wasm-printing.h" @@ -384,6 +385,13 @@ void BinaryenModulePrint(BinaryenModuleRef module) { WasmPrinter::printModule((Module*)module); } +void BinaryenModuleOptimize(BinaryenModuleRef module) { + Module* wasm = (Module*)module; + PassRunner passRunner(wasm); + passRunner.addDefaultOptimizationPasses(); + passRunner.run(); +} + // // ========== CFG / Relooper ========== // diff --git a/src/binaryen-c.h b/src/binaryen-c.h index 2dbf27076..2e0a7b996 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -266,6 +266,9 @@ void BinaryenSetStart(BinaryenModuleRef module, const char* name); // Print a module to stdout. void BinaryenModulePrint(BinaryenModuleRef module); +// Run the standard optimization passes on the module. +void BinaryenModuleOptimize(BinaryenModuleRef module); + // // ========== CFG / Relooper ========== // |