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/wasm/wasm-s-parser.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/wasm/wasm-s-parser.cpp')
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 1319d80fc..20aff2091 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -1268,7 +1268,7 @@ SExpressionWasmBuilder::makeLoad(Element& s, Type type, bool isAtomic) { auto* ret = allocator.alloc<Load>(); ret->isAtomic = isAtomic; ret->type = type; - ret->bytes = parseMemBytes(extra, getTypeSize(type)); + ret->bytes = parseMemBytes(extra, type.getByteSize()); ret->signed_ = extra[0] && extra[1] == 's'; size_t i = parseMemAttributes(s, &ret->offset, &ret->align, ret->bytes); ret->ptr = parseExpression(s[i]); @@ -1282,7 +1282,7 @@ SExpressionWasmBuilder::makeStore(Element& s, Type type, bool isAtomic) { auto ret = allocator.alloc<Store>(); ret->isAtomic = isAtomic; ret->valueType = type; - ret->bytes = parseMemBytes(extra, getTypeSize(type)); + ret->bytes = parseMemBytes(extra, type.getByteSize()); size_t i = parseMemAttributes(s, &ret->offset, &ret->align, ret->bytes); ret->ptr = parseExpression(s[i]); ret->value = parseExpression(s[i + 1]); @@ -1294,7 +1294,7 @@ Expression* SExpressionWasmBuilder::makeAtomicRMWOrCmpxchg(Element& s, Type type) { const char* extra = findMemExtra( *s[0], 11 /* after "type.atomic.rmw" */, /* isAtomic = */ false); - auto bytes = parseMemBytes(extra, getTypeSize(type)); + auto bytes = parseMemBytes(extra, type.getByteSize()); extra = strchr(extra, '.'); // after the optional '_u' and before the opcode if (!extra) { throw ParseException("malformed atomic rmw instruction"); |