x86_64: implement error set and enum safety

This is all of the expected 0.14.0 progress on #21530, which can now be
postponed once this commit is merged.

This required rewriting the (un)wrap operations since the original
implementations were extremely buggy.

Also adds an easy way to retrigger Sema OPV bugs so that I don't have to
keep updating #22419 all the time.
This commit is contained in:
Jacob Young
2025-02-13 17:09:21 -05:00
parent 5ab5113077
commit 8159ff8b81
155 changed files with 4834 additions and 4054 deletions

View File

@@ -83,8 +83,10 @@ pub fn generateLazyFunction(
debug_output: link.File.DebugInfoOutput,
) CodeGenError!void {
const zcu = pt.zcu;
const file = Type.fromInterned(lazy_sym.ty).typeDeclInstAllowGeneratedTag(zcu).?.resolveFile(&zcu.intern_pool);
const target = zcu.fileByIndex(file).mod.resolved_target.result;
const target = if (Type.fromInterned(lazy_sym.ty).typeDeclInstAllowGeneratedTag(zcu)) |inst_index|
zcu.fileByIndex(inst_index.resolveFile(&zcu.intern_pool)).mod.resolved_target.result
else
zcu.getTarget();
switch (target_util.zigBackend(target, false)) {
else => unreachable,
inline .stage2_x86_64, .stage2_riscv64 => |backend| {