ir done'ish

This commit is contained in:
agra
2026-03-01 22:38:41 +02:00
parent 6a920dbd2c
commit f763765ea2
17 changed files with 1443 additions and 15017 deletions

View File

@@ -313,14 +313,18 @@ pub const Builder = struct {
return self.emit(.{ .struct_gep = .{ .base = base, .field_index = field_index } }, ty);
}
pub fn structGepTyped(self: *Builder, base: Ref, field_index: u32, ty: TypeId, base_type: TypeId) Ref {
return self.emit(.{ .struct_gep = .{ .base = base, .field_index = field_index, .base_type = base_type } }, ty);
}
// ── Enum ops ────────────────────────────────────────────────────
pub fn enumInit(self: *Builder, tag: u32, payload: Ref, ty: TypeId) Ref {
return self.emit(.{ .enum_init = .{ .tag = tag, .payload = payload } }, ty);
}
pub fn enumTag(self: *Builder, val: Ref) Ref {
return self.emit(.{ .enum_tag = .{ .operand = val } }, .s32);
pub fn enumTag(self: *Builder, val: Ref, tag_ty: TypeId) Ref {
return self.emit(.{ .enum_tag = .{ .operand = val } }, tag_ty);
}
// ── Optional ops ────────────────────────────────────────────────