diff options
author | Alon Zakai <azakai@google.com> | 2019-04-26 16:59:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 16:59:41 -0700 |
commit | db9124f1de0478dcac525009b6f1589b44a7edd8 (patch) | |
tree | fa26395a0f6cca53cf5cb6e10189f989c5bfa847 /src/passes/ConstHoisting.cpp | |
parent | 87636dccd404a340d75acb1d96301581343f29ca (diff) | |
download | binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.gz binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.bz2 binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.zip |
Apply format changes from #2048 (#2059)
Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
Diffstat (limited to 'src/passes/ConstHoisting.cpp')
-rw-r--r-- | src/passes/ConstHoisting.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/passes/ConstHoisting.cpp b/src/passes/ConstHoisting.cpp index 11188a9ba..f67a48645 100644 --- a/src/passes/ConstHoisting.cpp +++ b/src/passes/ConstHoisting.cpp @@ -32,10 +32,10 @@ #include <map> -#include <wasm.h> #include <pass.h> #include <wasm-binary.h> #include <wasm-builder.h> +#include <wasm.h> namespace wasm { @@ -66,16 +66,14 @@ struct ConstHoisting : public WalkerPass<PostWalker<ConstHoisting>> { if (!prelude.empty()) { Builder builder(*getModule()); // merge-blocks can optimize this into a single block later in most cases - curr->body = builder.makeSequence( - builder.makeBlock(prelude), - curr->body - ); + curr->body = builder.makeSequence(builder.makeBlock(prelude), curr->body); } } private: bool worthHoisting(Literal value, Index num) { - if (num < MIN_USES) return false; + if (num < MIN_USES) + return false; // measure the size of the constant Index size = 0; switch (value.type) { @@ -112,8 +110,7 @@ private: return after < before; } - template<typename T> - Index getWrittenSize(const T& thing) { + template<typename T> Index getWrittenSize(const T& thing) { BufferWithRandomAccess buffer; buffer << thing; return buffer.size(); @@ -125,10 +122,7 @@ private: auto type = (*(vec[0]))->type; Builder builder(*getModule()); auto temp = builder.addVar(getFunction(), type); - auto* ret = builder.makeSetLocal( - temp, - *(vec[0]) - ); + auto* ret = builder.makeSetLocal(temp, *(vec[0])); for (auto item : vec) { *item = builder.makeGetLocal(temp, type); } @@ -136,8 +130,6 @@ private: } }; -Pass *createConstHoistingPass() { - return new ConstHoisting(); -} +Pass* createConstHoistingPass() { return new ConstHoisting(); } } // namespace wasm |