diff options
author | Sam Clegg <sbc@chromium.org> | 2024-05-15 08:47:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-15 08:47:24 -0700 |
commit | 940f4570cb13db7f7b381cbe35ba546708ed7556 (patch) | |
tree | 7081e06dee7fbd39a18688c9580e24d150104da2 /src | |
parent | 140386ed24ece9f30b2ad7dc55f63716f7a61f5e (diff) | |
download | binaryen-940f4570cb13db7f7b381cbe35ba546708ed7556.tar.gz binaryen-940f4570cb13db7f7b381cbe35ba546708ed7556.tar.bz2 binaryen-940f4570cb13db7f7b381cbe35ba546708ed7556.zip |
Remove redundant ptrType from MemorySize/Grow instructions. NFC (#6590)
I recently add TableSize/Grow and noticed I didn't need these. It seems
they are superfluous.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/Memory64Lowering.cpp | 4 | ||||
-rw-r--r-- | src/wasm-builder.h | 4 | ||||
-rw-r--r-- | src/wasm-delegations-fields.def | 2 | ||||
-rw-r--r-- | src/wasm.h | 4 | ||||
-rw-r--r-- | src/wasm/wasm-binary.cpp | 4 | ||||
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 4 | ||||
-rw-r--r-- | src/wasm/wasm.cpp | 6 |
7 files changed, 9 insertions, 19 deletions
diff --git a/src/passes/Memory64Lowering.cpp b/src/passes/Memory64Lowering.cpp index 194d593d8..e0301936a 100644 --- a/src/passes/Memory64Lowering.cpp +++ b/src/passes/Memory64Lowering.cpp @@ -70,7 +70,7 @@ struct Memory64Lowering : public WalkerPass<PostWalker<Memory64Lowering>> { if (memory->is64()) { auto size = static_cast<Expression*>(curr); extendAddress64(size, curr->memory); - curr->ptrType = Type::i32; + curr->type = Type::i32; replaceCurrent(size); } } @@ -82,7 +82,7 @@ struct Memory64Lowering : public WalkerPass<PostWalker<Memory64Lowering>> { wrapAddress64(curr->delta, curr->memory); auto size = static_cast<Expression*>(curr); extendAddress64(size, curr->memory); - curr->ptrType = Type::i32; + curr->type = Type::i32; replaceCurrent(size); } } diff --git a/src/wasm-builder.h b/src/wasm-builder.h index fbc680d17..54766a789 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -666,7 +666,7 @@ public: MemoryInfo info = MemoryInfo::Unspecified) { auto* ret = wasm.allocator.alloc<MemorySize>(); if (isMemory64(memoryName, info)) { - ret->make64(); + ret->type = Type::i64; } ret->memory = memoryName; ret->finalize(); @@ -677,7 +677,7 @@ public: MemoryInfo info = MemoryInfo::Unspecified) { auto* ret = wasm.allocator.alloc<MemoryGrow>(); if (isMemory64(memoryName, info)) { - ret->make64(); + ret->type = Type::i64; } ret->delta = delta; ret->memory = memoryName; diff --git a/src/wasm-delegations-fields.def b/src/wasm-delegations-fields.def index b5eebfc2b..3ffd29534 100644 --- a/src/wasm-delegations-fields.def +++ b/src/wasm-delegations-fields.def @@ -485,12 +485,10 @@ DELEGATE_FIELD_OPTIONAL_CHILD(Return, value) DELEGATE_FIELD_CASE_END(Return) DELEGATE_FIELD_CASE_START(MemorySize) -DELEGATE_FIELD_TYPE(MemorySize, ptrType) DELEGATE_FIELD_NAME_KIND(MemorySize, memory, ModuleItemKind::Memory) DELEGATE_FIELD_CASE_END(MemorySize) DELEGATE_FIELD_CASE_START(MemoryGrow) -DELEGATE_FIELD_TYPE(MemoryGrow, ptrType) DELEGATE_FIELD_CHILD(MemoryGrow, delta) DELEGATE_FIELD_NAME_KIND(MemoryGrow, memory, ModuleItemKind::Memory) DELEGATE_FIELD_CASE_END(MemoryGrow) diff --git a/src/wasm.h b/src/wasm.h index dd7164499..29240723f 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -1305,10 +1305,8 @@ public: MemorySize() { type = Type::i32; } MemorySize(MixedArena& allocator) : MemorySize() {} - Type ptrType = Type::i32; Name memory; - void make64(); void finalize(); }; @@ -1318,10 +1316,8 @@ public: MemoryGrow(MixedArena& allocator) : MemoryGrow() {} Expression* delta = nullptr; - Type ptrType = Type::i32; Name memory; - void make64(); void finalize(); }; diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index d72626b90..c8ced1327 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -6882,7 +6882,7 @@ void WasmBinaryReader::visitMemorySize(MemorySize* curr) { BYN_TRACE("zz node: MemorySize\n"); Index index = getU32LEB(); if (getMemory(index)->is64()) { - curr->make64(); + curr->type = Type::i64; } curr->finalize(); memoryRefs[index].push_back(&curr->memory); @@ -6893,7 +6893,7 @@ void WasmBinaryReader::visitMemoryGrow(MemoryGrow* curr) { curr->delta = popNonVoidExpression(); Index index = getU32LEB(); if (getMemory(index)->is64()) { - curr->make64(); + curr->type = Type::i64; } memoryRefs[index].push_back(&curr->memory); } diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index be6fc5100..aa386f841 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -1537,7 +1537,7 @@ Expression* SExpressionWasmBuilder::makeMemorySize(Element& s) { } ret->memory = memory; if (isMemory64(memory)) { - ret->make64(); + ret->type = Type::i64; } ret->finalize(); return ret; @@ -1554,7 +1554,7 @@ Expression* SExpressionWasmBuilder::makeMemoryGrow(Element& s) { } ret->memory = memory; if (isMemory64(memory)) { - ret->make64(); + ret->type = Type::i64; } ret->delta = parseExpression(s[i]); ret->finalize(); diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 9bc0f6e0b..82ddd553f 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -789,15 +789,11 @@ void Drop::finalize() { } } -void MemorySize::make64() { type = ptrType = Type::i64; } -void MemorySize::finalize() { type = ptrType; } +void MemorySize::finalize() {} -void MemoryGrow::make64() { type = ptrType = Type::i64; } void MemoryGrow::finalize() { if (delta->type == Type::unreachable) { type = Type::unreachable; - } else { - type = ptrType; } } |