summaryrefslogtreecommitdiff
path: root/src/binary-reader-ir.cc
diff options
context:
space:
mode:
authorKeith Winstein <keithw@cs.stanford.edu>2022-08-15 14:39:34 -0700
committerGitHub <noreply@github.com>2022-08-15 21:39:34 +0000
commit8c50fd5fdcf7e14fc5ab3acf1191e12afa4116ab (patch)
tree6698f8341781aa545954250fa29f7cb54ce2e422 /src/binary-reader-ir.cc
parent3bf73a83b909f43b8e4530562d5763721c49e4a7 (diff)
downloadwabt-8c50fd5fdcf7e14fc5ab3acf1191e12afa4116ab.tar.gz
wabt-8c50fd5fdcf7e14fc5ab3acf1191e12afa4116ab.tar.bz2
wabt-8c50fd5fdcf7e14fc5ab3acf1191e12afa4116ab.zip
Support multi-memory in all memory ops and in apply/resolve-names (#1962)
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r--src/binary-reader-ir.cc48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc
index 44e93782..49feb255 100644
--- a/src/binary-reader-ir.cc
+++ b/src/binary-reader-ir.cc
@@ -164,22 +164,28 @@ class BinaryReaderIR : public BinaryReaderNop {
Result OnOpcode(Opcode opcode) override;
Result OnAtomicLoadExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnAtomicStoreExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnAtomicRmwExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnAtomicRmwCmpxchgExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnAtomicWaitExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnAtomicFenceExpr(uint32_t consistency_model) override;
Result OnAtomicNotifyExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnBinaryExpr(Opcode opcode) override;
@@ -262,9 +268,11 @@ class BinaryReaderIR : public BinaryReaderNop {
uint64_t value) override;
Result OnSimdShuffleOpExpr(Opcode opcode, v128 value) override;
Result OnLoadSplatExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
Result OnLoadZeroExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) override;
@@ -737,38 +745,43 @@ Result BinaryReaderIR::OnOpcode(Opcode opcode) {
}
Result BinaryReaderIR::OnAtomicLoadExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(
- MakeUnique<AtomicLoadExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(MakeUnique<AtomicLoadExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnAtomicStoreExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(
- MakeUnique<AtomicStoreExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(MakeUnique<AtomicStoreExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnAtomicRmwExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(
- MakeUnique<AtomicRmwExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(MakeUnique<AtomicRmwExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnAtomicRmwCmpxchgExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(
- MakeUnique<AtomicRmwCmpxchgExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(MakeUnique<AtomicRmwCmpxchgExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnAtomicWaitExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(
- MakeUnique<AtomicWaitExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(MakeUnique<AtomicWaitExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnAtomicFenceExpr(uint32_t consistency_model) {
@@ -776,10 +789,11 @@ Result BinaryReaderIR::OnAtomicFenceExpr(uint32_t consistency_model) {
}
Result BinaryReaderIR::OnAtomicNotifyExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(
- MakeUnique<AtomicNotifyExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(MakeUnique<AtomicNotifyExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnBinaryExpr(Opcode opcode) {
@@ -1193,17 +1207,19 @@ Result BinaryReaderIR::OnSimdShuffleOpExpr(Opcode opcode, v128 value) {
}
Result BinaryReaderIR::OnLoadSplatExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(
- MakeUnique<LoadSplatExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(MakeUnique<LoadSplatExpr>(
+ opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnLoadZeroExpr(Opcode opcode,
+ Index memidx,
Address alignment_log2,
Address offset) {
- return AppendExpr(
- MakeUnique<LoadZeroExpr>(opcode, 1 << alignment_log2, offset));
+ return AppendExpr(MakeUnique<LoadZeroExpr>(opcode, Var(memidx, GetLocation()),
+ 1 << alignment_log2, offset));
}
Result BinaryReaderIR::OnElemSegmentCount(Index count) {