Function un [src]
Prototype
pub fn un( self: *WipFunction, tag: Instruction.Tag, val: Value, name: []const u8, ) Allocator.Error!Value
Parameters
self: *WipFunction
tag: Instruction.Tag
val: Value
name: []const u8
Source
pub fn un(
self: *WipFunction,
tag: Instruction.Tag,
val: Value,
name: []const u8,
) Allocator.Error!Value {
switch (tag) {
.fneg,
.@"fneg fast",
=> assert(val.typeOfWip(self).scalarType(self.builder).isFloatingPoint()),
else => unreachable,
}
try self.ensureUnusedExtraCapacity(1, NoExtra, 0);
const instruction = try self.addInst(name, .{ .tag = tag, .data = @intFromEnum(val) });
return instruction.toValue();
}