summaryrefslogtreecommitdiff
path: root/src/expr-visitor.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-09-20 09:49:58 -0700
committerGitHub <noreply@github.com>2017-09-20 09:49:58 -0700
commit447e6f752b157d0a9951525a045d862e62d9b88c (patch)
tree2484ab5841f35fa50127f6dd83460f943a202fb6 /src/expr-visitor.cc
parentc71918746e06d2afffc46b3da5e3f2c024cc4b92 (diff)
downloadwabt-447e6f752b157d0a9951525a045d862e62d9b88c.tar.gz
wabt-447e6f752b157d0a9951525a045d862e62d9b88c.tar.bz2
wabt-447e6f752b157d0a9951525a045d862e62d9b88c.zip
Add Atomic instructions (#633)
This adds support for all atomic instructions, enabled via the `--enable-threads` flag. It supports all tools: parsing text, decoding binary, validation, and interpreting. It does not currently ensure that the memory is marked as shared; that flag is not supported in wabt yet.
Diffstat (limited to 'src/expr-visitor.cc')
-rw-r--r--src/expr-visitor.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/expr-visitor.cc b/src/expr-visitor.cc
index 9d0d211d..8975a43d 100644
--- a/src/expr-visitor.cc
+++ b/src/expr-visitor.cc
@@ -25,6 +25,23 @@ ExprVisitor::ExprVisitor(Delegate* delegate) : delegate_(delegate) {}
Result ExprVisitor::VisitExpr(Expr* expr) {
switch (expr->type()) {
+ case ExprType::AtomicLoad:
+ CHECK_RESULT(delegate_->OnAtomicLoadExpr(cast<AtomicLoadExpr>(expr)));
+ break;
+
+ case ExprType::AtomicStore:
+ CHECK_RESULT(delegate_->OnAtomicStoreExpr(cast<AtomicStoreExpr>(expr)));
+ break;
+
+ case ExprType::AtomicRmw:
+ CHECK_RESULT(delegate_->OnAtomicRmwExpr(cast<AtomicRmwExpr>(expr)));
+ break;
+
+ case ExprType::AtomicRmwCmpxchg:
+ CHECK_RESULT(
+ delegate_->OnAtomicRmwCmpxchgExpr(cast<AtomicRmwCmpxchgExpr>(expr)));
+ break;
+
case ExprType::Binary:
CHECK_RESULT(delegate_->OnBinaryExpr(cast<BinaryExpr>(expr)));
break;