diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-10-24 12:08:26 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2023-10-25 04:28:30 -0400 |
| commit | b55377a5ab34ba17336d25a9336a3bc18f535c43 (patch) | |
| tree | 1111a2b1f4f3f808a4f08b554c16be97be3d3b66 /src/codegen.zig | |
| parent | 030da45c8e8437d31e7443077f8f2493d334a7d1 (diff) | |
| download | zig-b55377a5ab34ba17336d25a9336a3bc18f535c43.tar.gz zig-b55377a5ab34ba17336d25a9336a3bc18f535c43.zip | |
x86_64: pass more tests
* 128-bit integer multiplication with overflow
* more instruction encodings used by std inline asm
* implement the `try_ptr` air instruction
* follow correct stack frame abi
* enable full panic handler
* enable stack traces
Diffstat (limited to 'src/codegen.zig')
| -rw-r--r-- | src/codegen.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/codegen.zig b/src/codegen.zig index 72084c3741..051c2b33b3 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -850,7 +850,7 @@ fn genDeclRef( bin_file: *link.File, src_loc: Module.SrcLoc, tv: TypedValue, - decl_index: Module.Decl.Index, + ptr_decl_index: Module.Decl.Index, ) CodeGenError!GenResult { const mod = bin_file.options.module.?; log.debug("genDeclRef: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) }); @@ -859,6 +859,12 @@ fn genDeclRef( const ptr_bits = target.ptrBitWidth(); const ptr_bytes: u64 = @divExact(ptr_bits, 8); + const ptr_decl = mod.declPtr(ptr_decl_index); + const decl_index = switch (mod.intern_pool.indexToKey(try ptr_decl.internValue(mod))) { + .func => |func| func.owner_decl, + .extern_func => |extern_func| extern_func.decl, + else => ptr_decl_index, + }; const decl = mod.declPtr(decl_index); if (!decl.ty.isFnOrHasRuntimeBitsIgnoreComptime(mod)) { |
