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/emscripten-optimizer/optimizer.h | |
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/emscripten-optimizer/optimizer.h')
-rw-r--r-- | src/emscripten-optimizer/optimizer.h | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/emscripten-optimizer/optimizer.h b/src/emscripten-optimizer/optimizer.h index f6b3aa536..36a9322fd 100644 --- a/src/emscripten-optimizer/optimizer.h +++ b/src/emscripten-optimizer/optimizer.h @@ -19,11 +19,7 @@ #include "simple_ast.h" -extern bool preciseF32, - receiveJSON, - emitJSON, - minifyWhitespace, - last; +extern bool preciseF32, receiveJSON, emitJSON, minifyWhitespace, last; extern cashew::Ref extraInfo; @@ -39,12 +35,16 @@ enum AsmType { ASM_INT16X8, ASM_INT32X4, ASM_INT64, // non-asm.js - ASM_NONE // number of types + ASM_NONE // number of types }; struct AsmData; -AsmType detectType(cashew::Ref node, AsmData *asmData=nullptr, bool inVarDef=false, cashew::IString minifiedFround=cashew::IString(), bool allowI64=false); +AsmType detectType(cashew::Ref node, + AsmData* asmData = nullptr, + bool inVarDef = false, + cashew::IString minifiedFround = cashew::IString(), + bool allowI64 = false); struct AsmData { struct Local { @@ -57,23 +57,22 @@ struct AsmData { Locals locals; std::vector<cashew::IString> params; // in order - std::vector<cashew::IString> vars; // in order + std::vector<cashew::IString> vars; // in order AsmType ret; cashew::Ref func; AsmType getType(const cashew::IString& name) { auto ret = locals.find(name); - if (ret != locals.end()) return ret->second.type; + if (ret != locals.end()) + return ret->second.type; return ASM_NONE; } void setType(const cashew::IString& name, AsmType type) { locals[name].type = type; } - bool isLocal(const cashew::IString& name) { - return locals.count(name) > 0; - } + bool isLocal(const cashew::IString& name) { return locals.count(name) > 0; } bool isParam(const cashew::IString& name) { return isLocal(name) && locals[name].param; } @@ -81,8 +80,11 @@ struct AsmData { return isLocal(name) && !locals[name].param; } - AsmData() = default; // if you want to fill in the data yourself - AsmData(cashew::Ref f); // if you want to read data from f, and modify it as you go (parallel to denormalize) + // if you want to fill in the data yourself + AsmData() = default; + // if you want to read data from f, and modify it as you go (parallel to + // denormalize) + AsmData(cashew::Ref f); void denormalize(); @@ -108,13 +110,13 @@ struct AsmData { extern cashew::IString ASM_FLOAT_ZERO; -extern cashew::IString SIMD_INT8X16_CHECK, - SIMD_INT16X8_CHECK, - SIMD_INT32X4_CHECK, - SIMD_FLOAT32X4_CHECK, - SIMD_FLOAT64X2_CHECK; +extern cashew::IString SIMD_INT8X16_CHECK; +extern cashew::IString SIMD_INT16X8_CHECK; +extern cashew::IString SIMD_INT32X4_CHECK; +extern cashew::IString SIMD_FLOAT32X4_CHECK; +extern cashew::IString SIMD_FLOAT64X2_CHECK; -int parseInt(const char *str); +int parseInt(const char* str); struct HeapInfo { bool valid, unsign, floaty; @@ -122,10 +124,11 @@ struct HeapInfo { AsmType type; }; -HeapInfo parseHeap(const char *name); +HeapInfo parseHeap(const char* name); enum AsmSign { - ASM_FLEXIBLE = 0, // small constants can be signed or unsigned, variables are also flexible + // small constants can be signed or unsigned, variables are also flexible + ASM_FLEXIBLE = 0, ASM_SIGNED = 1, ASM_UNSIGNED = 2, ASM_NONSIGNED = 3, |