diff options
author | Derek Schuff <dschuff@chromium.org> | 2017-07-06 22:36:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-06 22:36:38 -0700 |
commit | 4995132cfaf575e430a7d0e95257b677286171c3 (patch) | |
tree | 88cad2d439177473ec8243ccaf4c620e9d85259b /src/passes/Print.cpp | |
parent | cd2a431004aa2e165722ff0b85aeece5b32da140 (diff) | |
download | binaryen-4995132cfaf575e430a7d0e95257b677286171c3.tar.gz binaryen-4995132cfaf575e430a7d0e95257b677286171c3.tar.bz2 binaryen-4995132cfaf575e430a7d0e95257b677286171c3.zip |
Add IR, parsing and binary support for AtomicRMW instructions from wasm threads proposal (#1082)
Also leave a stub (but valid) visitAtomicRMW in the visitor template so that not all visitors need to implement this function yet.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 7ec3e98a3..d0c9603f5 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -350,6 +350,39 @@ struct PrintSExpression : public Visitor<PrintSExpression> { printFullLine(curr->value); decIndent(); } + void visitAtomicRMW(AtomicRMW* curr) { + o << '('; + prepareColor(o) << printWasmType(curr->type) << ".atomic.rmw"; + if (curr->bytes != getWasmTypeSize(curr->type)) { + if (curr->bytes == 1) { + o << '8'; + } else if (curr->bytes == 2) { + o << "16"; + } else if (curr->bytes == 4) { + o << "32"; + } else { + WASM_UNREACHABLE(); + } + o << "_u"; + } + o << '.'; + switch (curr->op) { + case Add: o << "add"; break; + case Sub: o << "sub"; break; + case And: o << "and"; break; + case Or: o << "or"; break; + case Xor: o << "xor"; break; + case Xchg: o << "xchg"; break; + } + restoreNormalColor(o); + if (curr->offset) { + o << " offset=" << curr->offset; + } + incIndent(); + printFullLine(curr->ptr); + printFullLine(curr->value); + decIndent(); + } void visitConst(Const *curr) { o << curr->value; } |