authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-04-05 09:16:33+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-04-13 11:47:51+02:00
log382de7bf1de8314e97eb67426b693b966f2c4e1b
tree5c50e9cad16c132cdb632e12d5b6d4f1034d498e
parent5154ece8b9fd64f276fb6cb6f88fdfda1fc0f935

codegen: use non-debug Type/Value formatting


1 files changed, 10 insertions(+), 5 deletions(-)

src/codegen.zig+10-5
...@@ -493,7 +493,7 @@ pub fn generateSymbol(...@@ -493,7 +493,7 @@ pub fn generateSymbol(
493 bin_file.allocator,493 bin_file.allocator,
494 src_loc,494 src_loc,
495 "TODO implement generateSymbol for big int enums ('{}')",495 "TODO implement generateSymbol for big int enums ('{}')",
496 .{typed_value.ty.fmtDebug()},496 .{typed_value.ty.fmt(mod)},
497 ),497 ),
498 };498 };
499 }499 }
...@@ -957,13 +957,13 @@ fn genDeclRef(...@@ -957,13 +957,13 @@ fn genDeclRef(
957 tv: TypedValue,957 tv: TypedValue,
958 decl_index: Module.Decl.Index,958 decl_index: Module.Decl.Index,
959) CodeGenError!GenResult {959) CodeGenError!GenResult {
960 log.debug("genDeclRef: ty = {}, val = {}", .{ tv.ty.fmtDebug(), tv.val.fmtDebug() });960 const module = bin_file.options.module.?;
961 log.debug("genDeclRef: ty = {}, val = {}", .{ tv.ty.fmt(module), tv.val.fmtValue(tv.ty, module) });
961962
962 const target = bin_file.options.target;963 const target = bin_file.options.target;
963 const ptr_bits = target.cpu.arch.ptrBitWidth();964 const ptr_bits = target.cpu.arch.ptrBitWidth();
964 const ptr_bytes: u64 = @divExact(ptr_bits, 8);965 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
965966
966 const module = bin_file.options.module.?;
967 const decl = module.declPtr(decl_index);967 const decl = module.declPtr(decl_index);
968968
969 if (!decl.ty.isFnOrHasRuntimeBitsIgnoreComptime()) {969 if (!decl.ty.isFnOrHasRuntimeBitsIgnoreComptime()) {
...@@ -1025,7 +1025,8 @@ fn genUnnamedConst(...@@ -1025,7 +1025,8 @@ fn genUnnamedConst(
1025 tv: TypedValue,1025 tv: TypedValue,
1026 owner_decl_index: Module.Decl.Index,1026 owner_decl_index: Module.Decl.Index,
1027) CodeGenError!GenResult {1027) CodeGenError!GenResult {
1028 log.debug("genUnnamedConst: ty = {}, val = {}", .{ tv.ty.fmtDebug(), tv.val.fmtDebug() });1028 const mod = bin_file.options.module.?;
1029 log.debug("genUnnamedConst: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) });
10291030
1030 const target = bin_file.options.target;1031 const target = bin_file.options.target;
1031 const local_sym_index = bin_file.lowerUnnamedConst(tv, owner_decl_index) catch |err| {1032 const local_sym_index = bin_file.lowerUnnamedConst(tv, owner_decl_index) catch |err| {
...@@ -1065,7 +1066,11 @@ pub fn genTypedValue(...@@ -1065,7 +1066,11 @@ pub fn genTypedValue(
1065 typed_value.val = rt.data;1066 typed_value.val = rt.data;
1066 }1067 }
10671068
1068 log.debug("genTypedValue: ty = {}, val = {}", .{ typed_value.ty.fmtDebug(), typed_value.val.fmtDebug() });1069 const mod = bin_file.options.module.?;
1070 log.debug("genTypedValue: ty = {}, val = {}", .{
1071 typed_value.ty.fmt(mod),
1072 typed_value.val.fmtValue(typed_value.ty, mod),
1073 });
10691074
1070 if (typed_value.val.isUndef())1075 if (typed_value.val.isUndef())
1071 return GenResult.mcv(.undef);1076 return GenResult.mcv(.undef);