diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-03 19:12:53 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:40:04 -0700 |
| commit | ca3cf93b21bc77535fbaa7ca6aa411654dcfe069 (patch) | |
| tree | 2bec1cb13da757280595ef217556c1eeddf77414 /src/codegen | |
| parent | 836d8a1f64cb811641e621799429c54f222717eb (diff) | |
| download | zig-ca3cf93b21bc77535fbaa7ca6aa411654dcfe069.tar.gz zig-ca3cf93b21bc77535fbaa7ca6aa411654dcfe069.zip | |
stage2: move most simple values to InternPool
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/c.zig | 2 | ||||
| -rw-r--r-- | src/codegen/llvm.zig | 4 | ||||
| -rw-r--r-- | src/codegen/spirv.zig | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 2e5e45d54c..327ccb0119 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -1191,7 +1191,7 @@ pub const DeclGen = struct { } }, .Bool => { - if (val.toBool()) { + if (val.toBool(mod)) { return writer.writeAll("true"); } else { return writer.writeAll("false"); diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 232cd9d42f..1a092dff69 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -2793,7 +2793,7 @@ pub const DeclGen = struct { if (std.debug.runtime_safety and false) check: { if (t.zigTypeTag(mod) == .Opaque) break :check; if (!t.hasRuntimeBits(mod)) break :check; - if (!llvm_ty.isSized().toBool()) break :check; + if (!llvm_ty.isSized().toBool(mod)) break :check; const zig_size = t.abiSize(mod); const llvm_size = dg.object.target_data.abiSizeOfType(llvm_ty); @@ -3272,7 +3272,7 @@ pub const DeclGen = struct { switch (tv.ty.zigTypeTag(mod)) { .Bool => { const llvm_type = try dg.lowerType(tv.ty); - return if (tv.val.toBool()) llvm_type.constAllOnes() else llvm_type.constNull(); + return if (tv.val.toBool(mod)) llvm_type.constAllOnes() else llvm_type.constNull(); }, // TODO this duplicates code with Pointer but they should share the handling // of the tv.val.tag() and then Int should do extra constPtrToInt on top diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 3a5f5d6f6a..417a8035b5 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -621,7 +621,7 @@ pub const DeclGen = struct { switch (ty.zigTypeTag(mod)) { .Int => try self.addInt(ty, val), .Float => try self.addFloat(ty, val), - .Bool => try self.addConstBool(val.toBool()), + .Bool => try self.addConstBool(val.toBool(mod)), .Array => switch (val.tag()) { .aggregate => { const elem_vals = val.castTag(.aggregate).?.data; @@ -989,8 +989,8 @@ pub const DeclGen = struct { } }, .Bool => switch (repr) { - .direct => return try self.spv.constBool(result_ty_ref, val.toBool()), - .indirect => return try self.spv.constInt(result_ty_ref, @boolToInt(val.toBool())), + .direct => return try self.spv.constBool(result_ty_ref, val.toBool(mod)), + .indirect => return try self.spv.constInt(result_ty_ref, @boolToInt(val.toBool(mod))), }, .Float => return switch (ty.floatBits(target)) { 16 => try self.spv.resolveId(.{ .float = .{ .ty = result_ty_ref, .value = .{ .float16 = val.toFloat(f16) } } }), |
