LLVM: Move pt field from Object to NavGen

* LLVM: Pass correct tid to emit
* Store stack trace type in Zcu
* Don't use pt.errorIntType in LLVM backend
This commit is contained in:
antlilja 2024-08-02 16:48:36 +02:00 committed by Andrew Kelley
parent e7b18a7ce6
commit e3b79d65d8
5 changed files with 639 additions and 612 deletions

View File

@ -3042,7 +3042,7 @@ fn flush(
// If there's an output file, it wants to decide where the LLVM object goes!
const sub_prog_node = comp.link_prog_node.start("LLVM Emit Object", 0);
defer sub_prog_node.end();
try llvm_object.emit(.{
try llvm_object.emit(.{ .zcu = zcu, .tid = tid }, .{
.pre_ir_path = comp.verbose_llvm_ir,
.pre_bc_path = comp.verbose_llvm_bc,

View File

@ -9916,6 +9916,8 @@ fn finishFunc(
// lower this fn type.
const unresolved_stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace);
try unresolved_stack_trace_ty.resolveFields(pt);
if (zcu.stack_trace_type == .none) zcu.stack_trace_type = unresolved_stack_trace_ty.toIntern();
}
return Air.internedToRef(if (opt_func_index != .none) opt_func_index else func_ty);

View File

@ -308,6 +308,7 @@ free_type_references: std.ArrayListUnmanaged(u32) = .empty,
/// Populated by analysis of `AnalUnit.wrap(.{ .memoized_state = s })`, where `s` depends on the element.
builtin_decl_values: BuiltinDecl.Memoized = .initFill(.none),
stack_trace_type: InternPool.Index = .none,
incremental_debug_state: if (build_options.enable_debug_extensions) IncrementalDebugState else void =
if (build_options.enable_debug_extensions) .init else {},

File diff suppressed because it is too large Load Diff

View File

@ -3807,10 +3807,11 @@ pub fn flush(
tid: Zcu.PerThread.Id,
prog_node: std.Progress.Node,
) link.File.FlushError!void {
_ = tid;
// The goal is to never use this because it's only needed if we need to
// write to InternPool, but flush is too late to be writing to the
// InternPool.
_ = tid;
const comp = wasm.base.comp;
const diags = &comp.link_diags;
const gpa = comp.gpa;