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/SafeHeap.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/SafeHeap.cpp')
-rw-r--r-- | src/passes/SafeHeap.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/passes/SafeHeap.cpp b/src/passes/SafeHeap.cpp index 37610a90b..fc6706f3e 100644 --- a/src/passes/SafeHeap.cpp +++ b/src/passes/SafeHeap.cpp @@ -176,7 +176,7 @@ struct SafeHeap : public Pass { load.type = type; for (Index bytes : {1, 2, 4, 8, 16}) { load.bytes = bytes; - if (bytes > getTypeSize(type) || (type == f32 && bytes != 4) || + if (bytes > type.getByteSize() || (type == f32 && bytes != 4) || (type == f64 && bytes != 8) || (type == v128 && bytes != 16)) { continue; } @@ -212,7 +212,7 @@ struct SafeHeap : public Pass { store.type = none; for (Index bytes : {1, 2, 4, 8, 16}) { store.bytes = bytes; - if (bytes > getTypeSize(valueType) || + if (bytes > valueType.getByteSize() || (valueType == f32 && bytes != 4) || (valueType == f64 && bytes != 8) || (valueType == v128 && bytes != 16)) { |