Tiny progress on the self-hosted compiler
All checks were successful
CI / ci (ReleaseFast, ubuntu-latest) (push) Successful in 2m1s
CI / ci (ReleaseSmall, ubuntu-latest) (push) Successful in 1m59s
CI / ci (ReleaseSafe, ubuntu-latest) (push) Successful in 2m5s
CI / ci (Debug, ubuntu-latest) (push) Successful in 3m11s

This commit is contained in:
David Gonzalez Martin 2025-04-17 17:08:54 -06:00
parent 4dedaf3006
commit c19f456156
2 changed files with 27 additions and 0 deletions

View File

@ -7204,6 +7204,13 @@ pub const Module = struct {
u64_type.resolve(module);
_ = module.llvm.builder.create_memset(left_llvm, u8_type.llvm.abi.?.get_zero().to_value(), u64_type.llvm.abi.?.to_integer().get_constant(value_type.get_byte_size(), 0).to_value(), pointer_type.bb.pointer.alignment);
},
.variable_reference => |variable| switch (right.kind) {
.left => @trap(),
.right => {
const uint64 = module.integer_type(64, false);
_ = module.llvm.builder.create_memcpy(left_llvm, pointer_type.bb.pointer.alignment, variable.storage.?.llvm.?, variable.storage.?.type.?.bb.pointer.alignment, uint64.llvm.abi.?.to_integer().get_constant(value_type.get_byte_size(), @intFromBool(false)).to_value());
},
},
else => @trap(),
},
.complex => @trap(),

View File

@ -243,9 +243,22 @@ BuildMode = enum
aggressively_optimize_for_size,
}
CompileFile = struct
{
relative_file_path: []u8,
build_mode: BuildMode,
has_debug_info: u1,
silent: u1,
}
compile_file = fn (arena: &Arena, compile: CompileFile) void
{
}
[export] main = fn [cc(c)] (argument_count: u32, argv: &&u8) s32
{
global_state_initialize();
>arena = global_state.arena;
if (argument_count < 2)
{
@ -323,6 +336,13 @@ BuildMode = enum
{
return 1;
}
compile_file(arena, {
.relative_file_path = relative_file_path,
.build_mode = build_mode,
.has_debug_info = has_debug_info,
.silent = 0,
});
},
.test =>
{