DoxigAlpha

loadAtomic

Function parameters

Parameters

#
self:*WipFunction
name:[]const u8

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#

= 16

Values

#

Source

Implementation

#
pub fn loadAtomic(
    self: *WipFunction,
    access_kind: MemoryAccessKind,
    ty: Type,
    ptr: Value,
    sync_scope: SyncScope,
    ordering: AtomicOrdering,
    alignment: Alignment,
    name: []const u8,
) Allocator.Error!Value {
    assert(ptr.typeOfWip(self).isPointer(self.builder));
    try self.ensureUnusedExtraCapacity(1, Instruction.Load, 0);
    const instruction = try self.addInst(name, .{
        .tag = switch (ordering) {
            .none => .load,
            else => .@"load atomic",
        },
        .data = self.addExtraAssumeCapacity(Instruction.Load{
            .info = .{
                .access_kind = access_kind,
                .sync_scope = switch (ordering) {
                    .none => .system,
                    else => sync_scope,
                },
                .success_ordering = ordering,
                .alignment = alignment,
            },
            .type = ty,
            .ptr = ptr,
        }),
    });
    return instruction.toValue();
}