Prototype
pub fn alloca( self: *WipFunction, kind: Instruction.Alloca.Kind, ty: Type, len: Value, alignment: Alignment, addr_space: AddrSpace, name: []const u8, ) Allocator.Error!Value
Source
pub fn alloca(
self: *WipFunction,
kind: Instruction.Alloca.Kind,
ty: Type,
len: Value,
alignment: Alignment,
addr_space: AddrSpace,
name: []const u8,
) Allocator.Error!Value {
assert(len == .none or len.typeOfWip(self).isInteger(self.builder));
_ = try self.builder.ptrType(addr_space);
try self.ensureUnusedExtraCapacity(1, Instruction.Alloca, 0);
const instruction = try self.addInst(name, .{
.tag = switch (kind) {
.normal => .alloca,
.inalloca => .@"alloca inalloca",
},
.data = self.addExtraAssumeCapacity(Instruction.Alloca{
.type = ty,
.len = switch (len) {
.none => .@"1",
else => len,
},
.info = .{ .alignment = alignment, .addr_space = addr_space },
}),
});
return instruction.toValue();
}