summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2017-07-06 22:36:38 -0700
committerGitHub <noreply@github.com>2017-07-06 22:36:38 -0700
commit4995132cfaf575e430a7d0e95257b677286171c3 (patch)
tree88cad2d439177473ec8243ccaf4c620e9d85259b /src/wasm.h
parentcd2a431004aa2e165722ff0b85aeece5b32da140 (diff)
downloadbinaryen-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/wasm.h')
-rw-r--r--src/wasm.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 286604848..e98c4db63 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -130,6 +130,10 @@ enum HostOp {
PageSize, CurrentMemory, GrowMemory, HasFeature
};
+enum AtomicRMWOp {
+ Add, Sub, And, Or, Xor, Xchg,
+};
+
//
// Expressions
//
@@ -177,6 +181,7 @@ public:
HostId,
NopId,
UnreachableId,
+ AtomicCmpxchgId,
AtomicRMWId,
NumExpressionIds
};
@@ -423,6 +428,25 @@ public:
void finalize();
};
+class AtomicRMW : public SpecificExpression<Expression::AtomicRMWId> {
+ public:
+ AtomicRMW() = default;
+ AtomicRMW(MixedArena& allocator) : AtomicRMW() {}
+
+ AtomicRMWOp op;
+ uint8_t bytes;
+ Address offset;
+ Expression* ptr;
+ Expression* value;
+
+ void finalize();
+};
+
+class AtomicCmpxchg : public SpecificExpression<Expression::AtomicCmpxchgId> {
+ public:
+ AtomicCmpxchg() = default;
+};
+
class Const : public SpecificExpression<Expression::ConstId> {
public:
Const() {}
@@ -514,13 +538,6 @@ public:
Unreachable(MixedArena& allocator) : Unreachable() {}
};
-class AtomicRMW : public SpecificExpression<Expression::AtomicRMWId> {
- public:
- AtomicRMW() {}
- AtomicRMW(MixedArena& allocator) : AtomicRMW() {}
- bool finalize();
-};
-
// Globals
class Function {