ir
This commit is contained in:
10
src/core.zig
10
src/core.zig
@@ -6,6 +6,7 @@ const sema = @import("sema.zig");
|
||||
const codegen = @import("codegen.zig");
|
||||
const errors = @import("errors.zig");
|
||||
const c_import = @import("c_import.zig");
|
||||
const ir = @import("ir/ir.zig");
|
||||
const Node = ast.Node;
|
||||
|
||||
pub const TargetConfig = codegen.TargetConfig;
|
||||
@@ -112,6 +113,15 @@ pub const Compilation = struct {
|
||||
return c_import.collectCImportSources(self.allocator, root);
|
||||
}
|
||||
|
||||
/// Lower the parsed AST to the sx IR module (shadow pipeline).
|
||||
pub fn lowerToIR(self: *Compilation) ir.Module {
|
||||
const root = self.resolved_root orelse self.root orelse return ir.Module.init(self.allocator);
|
||||
var module = ir.Module.init(self.allocator);
|
||||
var lowering = ir.Lowering.init(&module);
|
||||
lowering.lowerRoot(root);
|
||||
return module;
|
||||
}
|
||||
|
||||
pub fn renderErrors(self: *const Compilation) void {
|
||||
self.diagnostics.renderDebug();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user