| author | |
| committer | |
| log | dc88864c9742029c2980fc16cd2c9e6f04ff3568 |
| tree | 2569f14d189ef238ca7a281774e09ba49374113b |
| parent | 66e5920dc3411daa4f0c84a8f4c733c1263e8523 |
This is the first commit in which some behavior tests are passing for
both stage1 and stage2.15 files changed, 92 insertions(+), 16 deletions(-)
doc/langref.html.in+2-2| ... | ... | @@ -7165,8 +7165,8 @@ fn func(y: *i32) void { |
| 7165 | 7165 | {#header_open|@boolToInt#} |
| 7166 | 7166 | <pre>{#syntax#}@boolToInt(value: bool) u1{#endsyntax#}</pre> |
| 7167 | 7167 | <p> |
| 7168 | Converts {#syntax#}true{#endsyntax#} to {#syntax#}u1(1){#endsyntax#} and {#syntax#}false{#endsyntax#} to | |
| 7169 | {#syntax#}u1(0){#endsyntax#}. | |
| 7168 | Converts {#syntax#}true{#endsyntax#} to {#syntax#}@as(u1, 1){#endsyntax#} and {#syntax#}false{#endsyntax#} to | |
| 7169 | {#syntax#}@as(u1, 0){#endsyntax#}. | |
| 7170 | 7170 | </p> |
| 7171 | 7171 | <p> |
| 7172 | 7172 | If the value is known at compile-time, the return type is {#syntax#}comptime_int{#endsyntax#} |
src/Air.zig+6| ... | ... | @@ -189,6 +189,10 @@ pub const Inst = struct { |
| 189 | 189 | /// Converts a pointer to its address. Result type is always `usize`. |
| 190 | 190 | /// Uses the `un_op` field. |
| 191 | 191 | ptrtoint, |
| 192 | /// Given a boolean, returns 0 or 1. | |
| 193 | /// Result type is always `u1`. | |
| 194 | /// Uses the `un_op` field. | |
| 195 | bool_to_int, | |
| 192 | 196 | /// Stores a value onto the stack and returns a pointer to it. |
| 193 | 197 | /// TODO audit where this AIR instruction is emitted, maybe it should instead be emitting |
| 194 | 198 | /// alloca instruction and storing to the alloca. |
| ... | ... | @@ -490,6 +494,8 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index) Type { |
| 490 | 494 | .slice_len, |
| 491 | 495 | => return Type.initTag(.usize), |
| 492 | 496 | |
| 497 | .bool_to_int => return Type.initTag(.u1), | |
| 498 | ||
| 493 | 499 | .call => { |
| 494 | 500 | const callee_ty = air.typeOf(datas[inst].pl_op.operand); |
| 495 | 501 | return callee_ty.fnReturnType(); |
src/AstGen.zig+2| ... | ... | @@ -7754,6 +7754,7 @@ pub const simple_types = std.ComptimeStringMap(Zir.Inst.Ref, .{ |
| 7754 | 7754 | .{ "u32", .u32_type }, |
| 7755 | 7755 | .{ "u64", .u64_type }, |
| 7756 | 7756 | .{ "u128", .u128_type }, |
| 7757 | .{ "u1", .u1_type }, | |
| 7757 | 7758 | .{ "u8", .u8_type }, |
| 7758 | 7759 | .{ "undefined", .undef }, |
| 7759 | 7760 | .{ "usize", .usize_type }, |
| ... | ... | @@ -8400,6 +8401,7 @@ fn rvalue( |
| 8400 | 8401 | const as_usize = @as(u64, @enumToInt(Zir.Inst.Ref.usize_type)) << 32; |
| 8401 | 8402 | const as_void = @as(u64, @enumToInt(Zir.Inst.Ref.void_type)) << 32; |
| 8402 | 8403 | switch ((@as(u64, @enumToInt(ty_inst)) << 32) | @as(u64, @enumToInt(result))) { |
| 8404 | as_ty | @enumToInt(Zir.Inst.Ref.u1_type), | |
| 8403 | 8405 | as_ty | @enumToInt(Zir.Inst.Ref.u8_type), |
| 8404 | 8406 | as_ty | @enumToInt(Zir.Inst.Ref.i8_type), |
| 8405 | 8407 | as_ty | @enumToInt(Zir.Inst.Ref.u16_type), |
src/Liveness.zig+1| ... | ... | @@ -291,6 +291,7 @@ fn analyzeInst( |
| 291 | 291 | .is_err_ptr, |
| 292 | 292 | .is_non_err_ptr, |
| 293 | 293 | .ptrtoint, |
| 294 | .bool_to_int, | |
| 294 | 295 | .ret, |
| 295 | 296 | => { |
| 296 | 297 | const operand = inst_datas[inst].un_op; |
src/Sema.zig+9-2| ... | ... | @@ -5848,8 +5848,14 @@ fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 5848 | 5848 | |
| 5849 | 5849 | fn zirBoolToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5850 | 5850 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5851 | const src = inst_data.src(); | |
| 5852 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBoolToInt", .{}); | |
| 5851 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | |
| 5852 | const operand = sema.resolveInst(inst_data.operand); | |
| 5853 | if (try sema.resolveMaybeUndefVal(block, operand_src, operand)) |val| { | |
| 5854 | if (val.isUndef()) return sema.addConstUndef(Type.initTag(.u1)); | |
| 5855 | const bool_ints = [2]Air.Inst.Ref{ .zero, .one }; | |
| 5856 | return bool_ints[@boolToInt(val.toBool())]; | |
| 5857 | } | |
| 5858 | return block.addUnOp(.bool_to_int, operand); | |
| 5853 | 5859 | } |
| 5854 | 5860 | |
| 5855 | 5861 | fn zirEmbedFile(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| ... | ... | @@ -8252,6 +8258,7 @@ fn typeHasOnePossibleValue( |
| 8252 | 8258 | .c_longdouble, |
| 8253 | 8259 | .comptime_int, |
| 8254 | 8260 | .comptime_float, |
| 8261 | .u1, | |
| 8255 | 8262 | .u8, |
| 8256 | 8263 | .i8, |
| 8257 | 8264 | .u16, |
src/Zir.zig+5| ... | ... | @@ -1633,6 +1633,7 @@ pub const Inst = struct { |
| 1633 | 1633 | /// value and may instead be used as a sentinel to indicate null. |
| 1634 | 1634 | none, |
| 1635 | 1635 | |
| 1636 | u1_type, | |
| 1636 | 1637 | u8_type, |
| 1637 | 1638 | i8_type, |
| 1638 | 1639 | u16_type, |
| ... | ... | @@ -1719,6 +1720,10 @@ pub const Inst = struct { |
| 1719 | 1720 | pub const typed_value_map = std.enums.directEnumArray(Ref, TypedValue, 0, .{ |
| 1720 | 1721 | .none = undefined, |
| 1721 | 1722 | |
| 1723 | .u1_type = .{ | |
| 1724 | .ty = Type.initTag(.type), | |
| 1725 | .val = Value.initTag(.u1_type), | |
| 1726 | }, | |
| 1722 | 1727 | .u8_type = .{ |
| 1723 | 1728 | .ty = Type.initTag(.type), |
| 1724 | 1729 | .val = Value.initTag(.u8_type), |
src/codegen.zig+8| ... | ... | @@ -835,6 +835,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 835 | 835 | .dbg_stmt => try self.airDbgStmt(inst), |
| 836 | 836 | .floatcast => try self.airFloatCast(inst), |
| 837 | 837 | .intcast => try self.airIntCast(inst), |
| 838 | .bool_to_int => try self.airBoolToInt(inst), | |
| 838 | 839 | .is_non_null => try self.airIsNonNull(inst), |
| 839 | 840 | .is_non_null_ptr => try self.airIsNonNullPtr(inst), |
| 840 | 841 | .is_null => try self.airIsNull(inst), |
| ... | ... | @@ -1110,6 +1111,13 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1110 | 1111 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1111 | 1112 | } |
| 1112 | 1113 | |
| 1114 | fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void { | |
| 1115 | const un_op = self.air.instructions.items(.data)[inst].un_op; | |
| 1116 | const operand = try self.resolveInst(un_op); | |
| 1117 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else operand; | |
| 1118 | return self.finishAir(inst, result, .{ un_op, .none, .none }); | |
| 1119 | } | |
| 1120 | ||
| 1113 | 1121 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 1114 | 1122 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 1115 | 1123 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
src/codegen/c.zig+15| ... | ... | @@ -925,6 +925,7 @@ fn genBody(o: *Object, body: []const Air.Inst.Index) error{ AnalysisFail, OutOfM |
| 925 | 925 | .call => try airCall(o, inst), |
| 926 | 926 | .dbg_stmt => try airDbgStmt(o, inst), |
| 927 | 927 | .intcast => try airIntCast(o, inst), |
| 928 | .bool_to_int => try airBoolToInt(o, inst), | |
| 928 | 929 | .load => try airLoad(o, inst), |
| 929 | 930 | .ret => try airRet(o, inst), |
| 930 | 931 | .store => try airStore(o, inst), |
| ... | ... | @@ -1083,6 +1084,20 @@ fn airIntCast(o: *Object, inst: Air.Inst.Index) !CValue { |
| 1083 | 1084 | return local; |
| 1084 | 1085 | } |
| 1085 | 1086 | |
| 1087 | fn airBoolToInt(o: *Object, inst: Air.Inst.Index) !CValue { | |
| 1088 | if (o.liveness.isUnused(inst)) | |
| 1089 | return CValue.none; | |
| 1090 | const un_op = o.air.instructions.items(.data)[inst].un_op; | |
| 1091 | const writer = o.writer(); | |
| 1092 | const inst_ty = o.air.typeOfIndex(inst); | |
| 1093 | const operand = try o.resolveInst(un_op); | |
| 1094 | const local = try o.allocLocal(inst_ty, .Const); | |
| 1095 | try writer.writeAll(" = "); | |
| 1096 | try o.writeCValue(writer, operand); | |
| 1097 | try writer.writeAll(";\n"); | |
| 1098 | return local; | |
| 1099 | } | |
| 1100 | ||
| 1086 | 1101 | fn airStore(o: *Object, inst: Air.Inst.Index) !CValue { |
| 1087 | 1102 | // *a = b; |
| 1088 | 1103 | const bin_op = o.air.instructions.items(.data)[inst].bin_op; |
src/codegen/llvm.zig+10| ... | ... | @@ -961,6 +961,7 @@ pub const FuncGen = struct { |
| 961 | 961 | .alloc => try self.airAlloc(inst), |
| 962 | 962 | .arg => try self.airArg(inst), |
| 963 | 963 | .bitcast => try self.airBitCast(inst), |
| 964 | .bool_to_int=> try self.airBoolToInt(inst), | |
| 964 | 965 | .block => try self.airBlock(inst), |
| 965 | 966 | .br => try self.airBr(inst), |
| 966 | 967 | .switch_br => try self.airSwitchBr(inst), |
| ... | ... | @@ -1656,6 +1657,15 @@ pub const FuncGen = struct { |
| 1656 | 1657 | return self.builder.buildBitCast(operand, dest_type, ""); |
| 1657 | 1658 | } |
| 1658 | 1659 | |
| 1660 | fn airBoolToInt(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { | |
| 1661 | if (self.liveness.isUnused(inst)) | |
| 1662 | return null; | |
| 1663 | ||
| 1664 | const un_op = self.air.instructions.items(.data)[inst].un_op; | |
| 1665 | const operand = try self.resolveInst(un_op); | |
| 1666 | return operand; | |
| 1667 | } | |
| 1668 | ||
| 1659 | 1669 | fn airArg(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { |
| 1660 | 1670 | const arg_val = self.args[self.arg_index]; |
| 1661 | 1671 | self.arg_index += 1; |
src/link/Coff.zig+5-2| ... | ... | @@ -885,7 +885,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { |
| 885 | 885 | // Both stage1 and stage2 LLVM backend put the object file in the cache directory. |
| 886 | 886 | if (self.base.options.use_llvm) { |
| 887 | 887 | // Stage2 has to call flushModule since that outputs the LLVM object file. |
| 888 | if (!build_options.is_stage1) try self.flushModule(comp); | |
| 888 | if (!build_options.is_stage1 or !self.base.options.use_stage1) try self.flushModule(comp); | |
| 889 | 889 | |
| 890 | 890 | const obj_basename = try std.zig.binNameAlloc(arena, .{ |
| 891 | 891 | .root_name = self.base.options.root_name, |
| ... | ... | @@ -1269,7 +1269,10 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { |
| 1269 | 1269 | |
| 1270 | 1270 | // TODO: remove when stage2 can build compiler_rt.zig, c.zig and ssp.zig |
| 1271 | 1271 | // compiler-rt, libc and libssp |
| 1272 | if (is_exe_or_dyn_lib and !self.base.options.skip_linker_dependencies and build_options.is_stage1) { | |
| 1272 | if (is_exe_or_dyn_lib and | |
| 1273 | !self.base.options.skip_linker_dependencies and | |
| 1274 | build_options.is_stage1 and self.base.options.use_stage1) | |
| 1275 | { | |
| 1273 | 1276 | if (!self.base.options.link_libc) { |
| 1274 | 1277 | try argv.append(comp.libc_static_lib.?.full_object_path); |
| 1275 | 1278 | } |
src/link/Elf.zig+4-3| ... | ... | @@ -1257,7 +1257,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1257 | 1257 | // Both stage1 and stage2 LLVM backend put the object file in the cache directory. |
| 1258 | 1258 | if (self.base.options.use_llvm) { |
| 1259 | 1259 | // Stage2 has to call flushModule since that outputs the LLVM object file. |
| 1260 | if (!build_options.is_stage1) try self.flushModule(comp); | |
| 1260 | if (!build_options.is_stage1 or !self.base.options.use_stage1) try self.flushModule(comp); | |
| 1261 | 1261 | |
| 1262 | 1262 | const obj_basename = try std.zig.binNameAlloc(arena, .{ |
| 1263 | 1263 | .root_name = self.base.options.root_name, |
| ... | ... | @@ -1287,7 +1287,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1287 | 1287 | const allow_shlib_undefined = self.base.options.allow_shlib_undefined orelse !self.base.options.is_native_os; |
| 1288 | 1288 | const compiler_rt_path: ?[]const u8 = if (self.base.options.include_compiler_rt) blk: { |
| 1289 | 1289 | // TODO: remove when stage2 can build compiler_rt.zig |
| 1290 | if (!build_options.is_stage1) break :blk null; | |
| 1290 | if (!build_options.is_stage1 or !self.base.options.use_stage1) break :blk null; | |
| 1291 | 1291 | |
| 1292 | 1292 | // In the case of build-obj we include the compiler-rt symbols directly alongside |
| 1293 | 1293 | // the symbols of the root source file, in the same compilation unit. |
| ... | ... | @@ -1605,7 +1605,8 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1605 | 1605 | if (is_exe_or_dyn_lib and |
| 1606 | 1606 | !self.base.options.skip_linker_dependencies and |
| 1607 | 1607 | !self.base.options.link_libc and |
| 1608 | build_options.is_stage1) | |
| 1608 | build_options.is_stage1 and | |
| 1609 | self.base.options.use_stage1) | |
| 1609 | 1610 | { |
| 1610 | 1611 | try argv.append(comp.libc_static_lib.?.full_object_path); |
| 1611 | 1612 | } |
src/print_air.zig+1| ... | ... | @@ -137,6 +137,7 @@ const Writer = struct { |
| 137 | 137 | .is_err_ptr, |
| 138 | 138 | .is_non_err_ptr, |
| 139 | 139 | .ptrtoint, |
| 140 | .bool_to_int, | |
| 140 | 141 | .ret, |
| 141 | 142 | => try w.writeUnOp(s, inst), |
| 142 | 143 |
src/type.zig+15-2| ... | ... | @@ -23,6 +23,7 @@ pub const Type = extern union { |
| 23 | 23 | |
| 24 | 24 | pub fn zigTypeTag(self: Type) std.builtin.TypeId { |
| 25 | 25 | switch (self.tag()) { |
| 26 | .u1, | |
| 26 | 27 | .u8, |
| 27 | 28 | .i8, |
| 28 | 29 | .u16, |
| ... | ... | @@ -638,6 +639,7 @@ pub const Type = extern union { |
| 638 | 639 | if (self.tag_if_small_enough < Tag.no_payload_count) { |
| 639 | 640 | return Type{ .tag_if_small_enough = self.tag_if_small_enough }; |
| 640 | 641 | } else switch (self.ptr_otherwise.tag) { |
| 642 | .u1, | |
| 641 | 643 | .u8, |
| 642 | 644 | .i8, |
| 643 | 645 | .u16, |
| ... | ... | @@ -819,6 +821,7 @@ pub const Type = extern union { |
| 819 | 821 | while (true) { |
| 820 | 822 | const t = ty.tag(); |
| 821 | 823 | switch (t) { |
| 824 | .u1, | |
| 822 | 825 | .u8, |
| 823 | 826 | .i8, |
| 824 | 827 | .u16, |
| ... | ... | @@ -1082,6 +1085,7 @@ pub const Type = extern union { |
| 1082 | 1085 | |
| 1083 | 1086 | pub fn toValue(self: Type, allocator: *Allocator) Allocator.Error!Value { |
| 1084 | 1087 | switch (self.tag()) { |
| 1088 | .u1 => return Value.initTag(.u1_type), | |
| 1085 | 1089 | .u8 => return Value.initTag(.u8_type), |
| 1086 | 1090 | .i8 => return Value.initTag(.i8_type), |
| 1087 | 1091 | .u16 => return Value.initTag(.u16_type), |
| ... | ... | @@ -1141,6 +1145,7 @@ pub const Type = extern union { |
| 1141 | 1145 | |
| 1142 | 1146 | pub fn hasCodeGenBits(self: Type) bool { |
| 1143 | 1147 | return switch (self.tag()) { |
| 1148 | .u1, | |
| 1144 | 1149 | .u8, |
| 1145 | 1150 | .i8, |
| 1146 | 1151 | .u16, |
| ... | ... | @@ -1321,6 +1326,7 @@ pub const Type = extern union { |
| 1321 | 1326 | /// Asserts that hasCodeGenBits() is true. |
| 1322 | 1327 | pub fn abiAlignment(self: Type, target: Target) u32 { |
| 1323 | 1328 | return switch (self.tag()) { |
| 1329 | .u1, | |
| 1324 | 1330 | .u8, |
| 1325 | 1331 | .i8, |
| 1326 | 1332 | .bool, |
| ... | ... | @@ -1539,6 +1545,7 @@ pub const Type = extern union { |
| 1539 | 1545 | @panic("TODO abiSize unions"); |
| 1540 | 1546 | }, |
| 1541 | 1547 | |
| 1548 | .u1, | |
| 1542 | 1549 | .u8, |
| 1543 | 1550 | .i8, |
| 1544 | 1551 | .bool, |
| ... | ... | @@ -1704,7 +1711,7 @@ pub const Type = extern union { |
| 1704 | 1711 | |
| 1705 | 1712 | .u8, .i8 => 8, |
| 1706 | 1713 | |
| 1707 | .bool => 1, | |
| 1714 | .bool, .u1 => 1, | |
| 1708 | 1715 | |
| 1709 | 1716 | .vector => { |
| 1710 | 1717 | const payload = self.castTag(.vector).?.data; |
| ... | ... | @@ -2217,12 +2224,13 @@ pub const Type = extern union { |
| 2217 | 2224 | pub fn isUnsignedInt(self: Type) bool { |
| 2218 | 2225 | return switch (self.tag()) { |
| 2219 | 2226 | .int_unsigned, |
| 2220 | .u8, | |
| 2221 | 2227 | .usize, |
| 2222 | 2228 | .c_ushort, |
| 2223 | 2229 | .c_uint, |
| 2224 | 2230 | .c_ulong, |
| 2225 | 2231 | .c_ulonglong, |
| 2232 | .u1, | |
| 2233 | .u8, | |
| 2226 | 2234 | .u16, |
| 2227 | 2235 | .u32, |
| 2228 | 2236 | .u64, |
| ... | ... | @@ -2244,6 +2252,7 @@ pub const Type = extern union { |
| 2244 | 2252 | .signedness = .signed, |
| 2245 | 2253 | .bits = self.castTag(.int_signed).?.data, |
| 2246 | 2254 | }, |
| 2255 | .u1 => .{ .signedness = .unsigned, .bits = 1 }, | |
| 2247 | 2256 | .u8 => .{ .signedness = .unsigned, .bits = 8 }, |
| 2248 | 2257 | .i8 => .{ .signedness = .signed, .bits = 8 }, |
| 2249 | 2258 | .u16 => .{ .signedness = .unsigned, .bits = 16 }, |
| ... | ... | @@ -2406,6 +2415,7 @@ pub const Type = extern union { |
| 2406 | 2415 | .c_longdouble, |
| 2407 | 2416 | .comptime_int, |
| 2408 | 2417 | .comptime_float, |
| 2418 | .u1, | |
| 2409 | 2419 | .u8, |
| 2410 | 2420 | .i8, |
| 2411 | 2421 | .u16, |
| ... | ... | @@ -2446,6 +2456,7 @@ pub const Type = extern union { |
| 2446 | 2456 | .c_longdouble, |
| 2447 | 2457 | .comptime_int, |
| 2448 | 2458 | .comptime_float, |
| 2459 | .u1, | |
| 2449 | 2460 | .u8, |
| 2450 | 2461 | .i8, |
| 2451 | 2462 | .u16, |
| ... | ... | @@ -2911,6 +2922,7 @@ pub const Type = extern union { |
| 2911 | 2922 | /// See `zigTypeTag` for the function that corresponds to `std.builtin.TypeId`. |
| 2912 | 2923 | pub const Tag = enum { |
| 2913 | 2924 | // The first section of this enum are tags that require no payload. |
| 2925 | u1, | |
| 2914 | 2926 | u8, |
| 2915 | 2927 | i8, |
| 2916 | 2928 | u16, |
| ... | ... | @@ -3018,6 +3030,7 @@ pub const Type = extern union { |
| 3018 | 3030 | |
| 3019 | 3031 | pub fn Type(comptime t: Tag) type { |
| 3020 | 3032 | return switch (t) { |
| 3033 | .u1, | |
| 3021 | 3034 | .u8, |
| 3022 | 3035 | .i8, |
| 3023 | 3036 | .u16, |
src/value.zig+7| ... | ... | @@ -22,6 +22,7 @@ pub const Value = extern union { |
| 22 | 22 | |
| 23 | 23 | pub const Tag = enum { |
| 24 | 24 | // The first section of this enum are tags that require no payload. |
| 25 | u1_type, | |
| 25 | 26 | u8_type, |
| 26 | 27 | i8_type, |
| 27 | 28 | u16_type, |
| ... | ... | @@ -138,6 +139,7 @@ pub const Value = extern union { |
| 138 | 139 | |
| 139 | 140 | pub fn Type(comptime t: Tag) type { |
| 140 | 141 | return switch (t) { |
| 142 | .u1_type, | |
| 141 | 143 | .u8_type, |
| 142 | 144 | .i8_type, |
| 143 | 145 | .u16_type, |
| ... | ... | @@ -314,6 +316,7 @@ pub const Value = extern union { |
| 314 | 316 | if (self.tag_if_small_enough < Tag.no_payload_count) { |
| 315 | 317 | return Value{ .tag_if_small_enough = self.tag_if_small_enough }; |
| 316 | 318 | } else switch (self.ptr_otherwise.tag) { |
| 319 | .u1_type, | |
| 317 | 320 | .u8_type, |
| 318 | 321 | .i8_type, |
| 319 | 322 | .u16_type, |
| ... | ... | @@ -520,6 +523,7 @@ pub const Value = extern union { |
| 520 | 523 | comptime assert(fmt.len == 0); |
| 521 | 524 | var val = start_val; |
| 522 | 525 | while (true) switch (val.tag()) { |
| 526 | .u1_type => return out_stream.writeAll("u1"), | |
| 523 | 527 | .u8_type => return out_stream.writeAll("u8"), |
| 524 | 528 | .i8_type => return out_stream.writeAll("i8"), |
| 525 | 529 | .u16_type => return out_stream.writeAll("u16"), |
| ... | ... | @@ -671,6 +675,7 @@ pub const Value = extern union { |
| 671 | 675 | pub fn toType(self: Value, allocator: *Allocator) !Type { |
| 672 | 676 | return switch (self.tag()) { |
| 673 | 677 | .ty => self.castTag(.ty).?.data, |
| 678 | .u1_type => Type.initTag(.u1), | |
| 674 | 679 | .u8_type => Type.initTag(.u8), |
| 675 | 680 | .i8_type => Type.initTag(.i8), |
| 676 | 681 | .u16_type => Type.initTag(.u16), |
| ... | ... | @@ -1150,6 +1155,7 @@ pub const Value = extern union { |
| 1150 | 1155 | var hasher = std.hash.Wyhash.init(0); |
| 1151 | 1156 | |
| 1152 | 1157 | switch (self.tag()) { |
| 1158 | .u1_type, | |
| 1153 | 1159 | .u8_type, |
| 1154 | 1160 | .i8_type, |
| 1155 | 1161 | .u16_type, |
| ... | ... | @@ -1502,6 +1508,7 @@ pub const Value = extern union { |
| 1502 | 1508 | return switch (self.tag()) { |
| 1503 | 1509 | .ty, |
| 1504 | 1510 | .int_type, |
| 1511 | .u1_type, | |
| 1505 | 1512 | .u8_type, |
| 1506 | 1513 | .i8_type, |
| 1507 | 1514 | .u16_type, |
test/behavior.zig+2-5| ... | ... | @@ -2,11 +2,9 @@ const builtin = @import("builtin"); |
| 2 | 2 | |
| 3 | 3 | test { |
| 4 | 4 | // Tests that pass for both. |
| 5 | {} | |
| 5 | _ = @import("behavior/bool.zig"); | |
| 6 | 6 | |
| 7 | if (builtin.zig_is_stage2) { | |
| 8 | // Tests that only pass for stage2. | |
| 9 | } else { | |
| 7 | if (!builtin.zig_is_stage2) { | |
| 10 | 8 | // Tests that only pass for stage1. |
| 11 | 9 | _ = @import("behavior/align.zig"); |
| 12 | 10 | _ = @import("behavior/alignof.zig"); |
| ... | ... | @@ -20,7 +18,6 @@ test { |
| 20 | 18 | _ = @import("behavior/bit_shifting.zig"); |
| 21 | 19 | _ = @import("behavior/bitcast.zig"); |
| 22 | 20 | _ = @import("behavior/bitreverse.zig"); |
| 23 | _ = @import("behavior/bool.zig"); | |
| 24 | 21 | _ = @import("behavior/bugs/1025.zig"); |
| 25 | 22 | _ = @import("behavior/bugs/1076.zig"); |
| 26 | 23 | _ = @import("behavior/bugs/1111.zig"); |