lib/chant/src/lower/context.zig
daab053ee43316e1809a84551d573ddd1e5bf3d2
1 const std = @import("std");
2 const choir = @import("choir");
3 const ast = @import("../ast/root.zig");
4
5 pub const LocalKind = enum {
6 slot,
7 pointer_param,
8 loop_iv,
9 };
10
11 pub const Local = struct {
12 kind: LocalKind,
13 value: *choir.Value,
14 c_type: *const ast.Type,
15 };
16
17 pub const Scope = std.StringHashMapUnmanaged(Local);
18
19 pub const Lowerer = struct {
20 gpa: std.mem.Allocator,
21 arena: std.mem.Allocator,
22 ctx: *choir.Context,
23 loc: choir.ir.Location,
24 block: *choir.Block,
25 scopes: std.ArrayListUnmanaged(Scope),
26 functions: std.StringHashMapUnmanaged(*const ast.Type),
27 terminated: bool,
28 };