diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-12-29 21:13:12 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-29 21:13:12 -0800 |
commit | a30f1df5696ccb3490e2eaa3a9ed5e7e487c7b0e (patch) | |
tree | 3ba1038677a2d5337603682ba80666823eee9552 /src/passes/Print.cpp | |
parent | f2ba91b6340a8c3099ab6a48700c717cbd33599e (diff) | |
download | binaryen-a30f1df5696ccb3490e2eaa3a9ed5e7e487c7b0e.tar.gz binaryen-a30f1df5696ccb3490e2eaa3a9ed5e7e487c7b0e.tar.bz2 binaryen-a30f1df5696ccb3490e2eaa3a9ed5e7e487c7b0e.zip |
Move Type-related functions into Type class (NFC) (#2556)
Several type-related functions currently exist outside of `Type`
class and thus in the `wasm`, effectively global, namespace. This moves
these functions into `Type` class, making them either member functions
or static functions.
Also this renames `getSize` to `getByteSize` to make it not to be
confused with `size`, which returns the number of types in multiple
types. This also reorders the order of functions in `wasm-type.cpp` to
match that of `wasm-type.h`.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 3bad8f960..5efd1fd28 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -186,7 +186,7 @@ struct PrintExpressionContents o << ".atomic"; } o << ".load"; - if (curr->type != unreachable && curr->bytes < getTypeSize(curr->type)) { + if (curr->type != unreachable && curr->bytes < curr->type.getByteSize()) { if (curr->bytes == 1) { o << '8'; } else if (curr->bytes == 2) { @@ -233,7 +233,7 @@ struct PrintExpressionContents } static void printRMWSize(std::ostream& o, Type type, uint8_t bytes) { prepareColor(o) << forceConcrete(type) << ".atomic.rmw"; - if (type != unreachable && bytes != getTypeSize(type)) { + if (type != unreachable && bytes != type.getByteSize()) { if (bytes == 1) { o << '8'; } else if (bytes == 2) { @@ -269,7 +269,7 @@ struct PrintExpressionContents o << "xchg"; break; } - if (curr->type != unreachable && curr->bytes != getTypeSize(curr->type)) { + if (curr->type != unreachable && curr->bytes != curr->type.getByteSize()) { o << "_u"; } restoreNormalColor(o); @@ -281,7 +281,7 @@ struct PrintExpressionContents prepareColor(o); printRMWSize(o, curr->type, curr->bytes); o << "cmpxchg"; - if (curr->type != unreachable && curr->bytes != getTypeSize(curr->type)) { + if (curr->type != unreachable && curr->bytes != curr->type.getByteSize()) { o << "_u"; } restoreNormalColor(o); |