summaryrefslogtreecommitdiff
path: root/src/binary-reader-ir.cc
diff options
context:
space:
mode:
authorYuhan Deng <31569419+yhdengh@users.noreply.github.com>2021-11-30 14:04:40 -0800
committerGitHub <noreply@github.com>2021-11-30 22:04:40 +0000
commitcf1e138ba9cde79d51f56d873e10b7ac9e4481b1 (patch)
tree22451a2d589797e4fd3c653e90ab7859234b38d0 /src/binary-reader-ir.cc
parentf65fadeedff3458e1dd9c157553cd0ed891683dd (diff)
downloadwabt-cf1e138ba9cde79d51f56d873e10b7ac9e4481b1.tar.gz
wabt-cf1e138ba9cde79d51f56d873e10b7ac9e4481b1.tar.bz2
wabt-cf1e138ba9cde79d51f56d873e10b7ac9e4481b1.zip
Add multi-memory feature support (#1751)
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r--src/binary-reader-ir.cc41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc
index f454174b..27e97c85 100644
--- a/src/binary-reader-ir.cc
+++ b/src/binary-reader-ir.cc
@@ -165,18 +165,19 @@ class BinaryReaderIR : public BinaryReaderNop {
Result OnI64ConstExpr(uint64_t value) override;
Result OnIfExpr(Type sig_type) override;
Result OnLoadExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnLocalGetExpr(Index local_index) override;
Result OnLocalSetExpr(Index local_index) override;
Result OnLocalTeeExpr(Index local_index) override;
Result OnLoopExpr(Type sig_type) override;
- Result OnMemoryCopyExpr() override;
+ Result OnMemoryCopyExpr(Index srcmemidx, Index destmemidx) override;
Result OnDataDropExpr(Index segment_index) override;
- Result OnMemoryFillExpr() override;
- Result OnMemoryGrowExpr() override;
- Result OnMemoryInitExpr(Index segment_index) override;
- Result OnMemorySizeExpr() override;
+ Result OnMemoryFillExpr(Index memidx) override;
+ Result OnMemoryGrowExpr(Index memidx) override;
+ Result OnMemoryInitExpr(Index segment_index, Index memidx) override;
+ Result OnMemorySizeExpr(Index memidx) override;
Result OnTableCopyExpr(Index dst_index, Index src_index) override;
Result OnElemDropExpr(Index segment_index) override;
Result OnTableInitExpr(Index segment_index, Index table_index) override;
@@ -193,6 +194,7 @@ class BinaryReaderIR : public BinaryReaderNop {
Result OnReturnExpr() override;
Result OnSelectExpr(Index result_count, Type* result_types) override;
Result OnStoreExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnThrowExpr(Index tag_index) override;
@@ -873,9 +875,11 @@ Result BinaryReaderIR::OnIfExpr(Type sig_type) {
}
Result BinaryReaderIR::OnLoadExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<LoadExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(
+ MakeUnique<LoadExpr>(opcode, Var(memidx), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnLoopExpr(Type sig_type) {
@@ -887,28 +891,29 @@ Result BinaryReaderIR::OnLoopExpr(Type sig_type) {
return Result::Ok;
}
-Result BinaryReaderIR::OnMemoryCopyExpr() {
- return AppendExpr(MakeUnique<MemoryCopyExpr>());
+Result BinaryReaderIR::OnMemoryCopyExpr(Index srcmemidx, Index destmemidx) {
+ return AppendExpr(
+ MakeUnique<MemoryCopyExpr>(Var(srcmemidx), Var(destmemidx)));
}
Result BinaryReaderIR::OnDataDropExpr(Index segment) {
return AppendExpr(MakeUnique<DataDropExpr>(Var(segment)));
}
-Result BinaryReaderIR::OnMemoryFillExpr() {
- return AppendExpr(MakeUnique<MemoryFillExpr>());
+Result BinaryReaderIR::OnMemoryFillExpr(Index memidx) {
+ return AppendExpr(MakeUnique<MemoryFillExpr>(Var(memidx)));
}
-Result BinaryReaderIR::OnMemoryGrowExpr() {
- return AppendExpr(MakeUnique<MemoryGrowExpr>());
+Result BinaryReaderIR::OnMemoryGrowExpr(Index memidx) {
+ return AppendExpr(MakeUnique<MemoryGrowExpr>(Var(memidx)));
}
-Result BinaryReaderIR::OnMemoryInitExpr(Index segment) {
- return AppendExpr(MakeUnique<MemoryInitExpr>(Var(segment)));
+Result BinaryReaderIR::OnMemoryInitExpr(Index segment, Index memidx) {
+ return AppendExpr(MakeUnique<MemoryInitExpr>(Var(segment), Var(memidx)));
}
-Result BinaryReaderIR::OnMemorySizeExpr() {
- return AppendExpr(MakeUnique<MemorySizeExpr>());
+Result BinaryReaderIR::OnMemorySizeExpr(Index memidx) {
+ return AppendExpr(MakeUnique<MemorySizeExpr>(Var(memidx)));
}
Result BinaryReaderIR::OnTableCopyExpr(Index dst_index, Index src_index) {
@@ -983,9 +988,11 @@ Result BinaryReaderIR::OnLocalSetExpr(Index local_index) {
}
Result BinaryReaderIR::OnStoreExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(MakeUnique<StoreExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(
+ MakeUnique<StoreExpr>(opcode, Var(memidx), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnThrowExpr(Index tag_index) {