summaryrefslogtreecommitdiff
path: root/src/passes/Print.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2017-08-24 12:43:12 -0700
committerGitHub <noreply@github.com>2017-08-24 12:43:12 -0700
commite60fcd0ba97ed75440c6f838619455be7a5e90a3 (patch)
treedbf187ed1eefcc9e16d5f5fac4be38b3fb539f94 /src/passes/Print.cpp
parentb07fafcebebab82dba46012256edc6445862cfce (diff)
downloadbinaryen-e60fcd0ba97ed75440c6f838619455be7a5e90a3.tar.gz
binaryen-e60fcd0ba97ed75440c6f838619455be7a5e90a3.tar.bz2
binaryen-e60fcd0ba97ed75440c6f838619455be7a5e90a3.zip
Add support for atomic wait and wake operators (#1140)
According to spec at https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wait-and-wake-operators
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r--src/passes/Print.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 33e06d7a5..3c538a40e 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -368,6 +368,7 @@ struct PrintSExpression : public Visitor<PrintSExpression> {
}
void visitAtomicRMW(AtomicRMW* curr) {
o << '(';
+ prepareColor(o);
printRMWSize(o, curr->type, curr->bytes);
switch (curr->op) {
case Add: o << "add"; break;
@@ -388,6 +389,7 @@ struct PrintSExpression : public Visitor<PrintSExpression> {
}
void visitAtomicCmpxchg(AtomicCmpxchg* curr) {
o << '(';
+ prepareColor(o);
printRMWSize(o, curr->type, curr->bytes);
o << "cmpxchg";
restoreNormalColor(o);
@@ -400,6 +402,24 @@ struct PrintSExpression : public Visitor<PrintSExpression> {
printFullLine(curr->replacement);
decIndent();
}
+ void visitAtomicWait(AtomicWait* curr) {
+ o << '(' ;
+ prepareColor(o);
+ o << printWasmType(curr->expectedType) << ".wait";
+ restoreNormalColor(o);
+ incIndent();
+ printFullLine(curr->ptr);
+ printFullLine(curr->expected);
+ printFullLine(curr->timeout);
+ decIndent();
+ }
+ void visitAtomicWake(AtomicWake* curr) {
+ printOpening(o, "wake");
+ incIndent();
+ printFullLine(curr->ptr);
+ printFullLine(curr->wakeCount);
+ decIndent();
+ }
void visitConst(Const *curr) {
o << curr->value;
}
@@ -562,8 +582,7 @@ struct PrintSExpression : public Visitor<PrintSExpression> {
decIndent();
}
void visitDrop(Drop *curr) {
- o << '(';
- prepareColor(o) << "drop";
+ printOpening(o, "drop");
incIndent();
printFullLine(curr->value);
decIndent();