DoxigAlpha

storeAtomic

Function parameters

Parameters

#
self:*WipFunction

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#

= 16

Values

#

Source

Implementation

#
pub fn storeAtomic(
    self: *WipFunction,
    access_kind: MemoryAccessKind,
    val: Value,
    ptr: Value,
    sync_scope: SyncScope,
    ordering: AtomicOrdering,
    alignment: Alignment,
) Allocator.Error!Instruction.Index {
    assert(ptr.typeOfWip(self).isPointer(self.builder));
    try self.ensureUnusedExtraCapacity(1, Instruction.Store, 0);
    const instruction = try self.addInst(null, .{
        .tag = switch (ordering) {
            .none => .store,
            else => .@"store atomic",
        },
        .data = self.addExtraAssumeCapacity(Instruction.Store{
            .info = .{
                .access_kind = access_kind,
                .sync_scope = switch (ordering) {
                    .none => .system,
                    else => sync_scope,
                },
                .success_ordering = ordering,
                .alignment = alignment,
            },
            .val = val,
            .ptr = ptr,
        }),
    });
    return instruction;
}