diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-04-15 13:46:51 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-04-15 11:50:08 -0400 |
| commit | 52c8ac1a847f893bc54cab5621738c0aa16f7c9d (patch) | |
| tree | 90d06edbf485730a58c0d8a34b9ade9f1fec3648 /src/codegen.zig | |
| parent | 3723eb7f3164c40c9cb204cb81efeb6ae3f43847 (diff) | |
| download | zig-52c8ac1a847f893bc54cab5621738c0aa16f7c9d.tar.gz zig-52c8ac1a847f893bc54cab5621738c0aa16f7c9d.zip | |
stage2: lower u128, and refactor some bits in x64
Diffstat (limited to 'src/codegen.zig')
| -rw-r--r-- | src/codegen.zig | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/codegen.zig b/src/codegen.zig index 68e1f3697f..7fa0b2c0f8 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -426,22 +426,20 @@ pub fn generateSymbol( }, }, .Int => { - // TODO populate .debug_info for the integer - const info = typed_value.ty.intInfo(bin_file.options.target); + const info = typed_value.ty.intInfo(target); if (info.bits <= 8) { const x = @intCast(u8, typed_value.val.toUnsignedInt(target)); try code.append(x); return Result{ .appended = {} }; } if (info.bits > 64) { - return Result{ - .fail = try ErrorMsg.create( - bin_file.allocator, - src_loc, - "TODO implement generateSymbol for big ints ('{}')", - .{typed_value.ty.fmtDebug()}, - ), - }; + var bigint_buffer: Value.BigIntSpace = undefined; + const bigint = typed_value.val.toBigInt(&bigint_buffer, target); + const abi_size = try math.cast(usize, typed_value.ty.abiSize(target)); + const start = code.items.len; + try code.resize(start + abi_size); + bigint.writeTwosComplement(code.items[start..][0..abi_size], info.bits, abi_size, endian); + return Result{ .appended = {} }; } switch (info.signedness) { .unsigned => { |
