@@ -256,6 +256,10 @@ Result<> makeStructSet(Ctx&, Index, const std::vector<Annotation>&);
256256template <typename Ctx>
257257Result<> makeAtomicStructSet (Ctx&, Index, const std::vector<Annotation>&);
258258template <typename Ctx>
259+ Result<> makeStructRMW (AtomicRMWOp, Index, const std::vector<Annotation>&);
260+ template <typename Ctx>
261+ Result<> makeStructCmpxchg (Index, const std::vector<Annotation>&);
262+ template <typename Ctx>
259263Result<>
260264makeArrayNew (Ctx&, Index, const std::vector<Annotation>&, bool default_);
261265template <typename Ctx>
@@ -2282,6 +2286,43 @@ Result<> makeAtomicStructSet(Ctx& ctx,
22822286 return ctx.makeStructSet (pos, annotations, *type, *field, *order);
22832287}
22842288
2289+ template <typename Ctx>
2290+ Result<> makeStructRMW (Ctx& ctx,
2291+ Index pos,
2292+ const std::vector<Annotation>& annotations,
2293+ AtomicRMWOp op) {
2294+ auto order1 = memorder (ctx);
2295+ CHECK_ERR (order1);
2296+ auto order2 = memorder (ctx);
2297+ CHECK_ERR (order2);
2298+ if (*order1 != *order2) {
2299+ return ctx.in .err (pos, " struct.atomic.rmw memory orders must be identical" );
2300+ }
2301+ auto type = typeidx (ctx);
2302+ CHECK_ERR (type);
2303+ auto field = fieldidx (ctx, *type);
2304+ CHECK_ERR (field);
2305+ return ctx.makeStructRMW (pos, annotations, op, *type, *field, *order1);
2306+ }
2307+
2308+ template <typename Ctx>
2309+ Result<> makeStructCmpxchg (Ctx& ctx,
2310+ Index pos,
2311+ const std::vector<Annotation>& annotations) {
2312+ auto order1 = memorder (ctx);
2313+ CHECK_ERR (order1);
2314+ auto order2 = memorder (ctx);
2315+ CHECK_ERR (order2);
2316+ if (*order1 != *order2) {
2317+ return ctx.in .err (pos, " struct.atomic.rmw memory orders must be identical" );
2318+ }
2319+ auto type = typeidx (ctx);
2320+ CHECK_ERR (type);
2321+ auto field = fieldidx (ctx, *type);
2322+ CHECK_ERR (field);
2323+ return ctx.makeStructCmpxchg (pos, annotations, *type, *field, *order1);
2324+ }
2325+
22852326template <typename Ctx>
22862327Result<> makeArrayNew (Ctx& ctx,
22872328 Index pos,
0 commit comments