| ... | @@ -611,7 +611,7 @@ pub const Function = struct { | ... | @@ -611,7 +611,7 @@ pub const Function = struct { |
| 611 | const a = try Assignment.start(f, writer, ctype); | 611 | const a = try Assignment.start(f, writer, ctype); |
| 612 | try f.writeCValue(writer, dst, .Other); | 612 | try f.writeCValue(writer, dst, .Other); |
| 613 | try a.assign(f, writer); | 613 | try a.assign(f, writer); |
| 614 | try f.writeCValue(writer, src, .Initializer); | 614 | try f.writeCValue(writer, src, .Other); |
| 615 | try a.end(f, writer); | 615 | try a.end(f, writer); |
| 616 | } | 616 | } |
| 617 | | 617 | |
| ... | @@ -2826,7 +2826,7 @@ pub fn genLazyFn(o: *Object, lazy_ctype_pool: *const CType.Pool, lazy_fn: LazyFn | ... | @@ -2826,7 +2826,7 @@ pub fn genLazyFn(o: *Object, lazy_ctype_pool: *const CType.Pool, lazy_fn: LazyFn |
| 2826 | }); | 2826 | }); |
| 2827 | try o.dg.renderTypeAndName(w, name_ty, .{ .identifier = "name" }, Const, .none, .complete); | 2827 | try o.dg.renderTypeAndName(w, name_ty, .{ .identifier = "name" }, Const, .none, .complete); |
| 2828 | try w.writeAll(" = "); | 2828 | try w.writeAll(" = "); |
| 2829 | try o.dg.renderValue(w, Value.fromInterned(name_val), .Initializer); | 2829 | try o.dg.renderValue(w, Value.fromInterned(name_val), .StaticInitializer); |
| 2830 | try w.writeAll(";\n return ("); | 2830 | try w.writeAll(";\n return ("); |
| 2831 | try o.dg.renderType(w, name_slice_ty); | 2831 | try o.dg.renderType(w, name_slice_ty); |
| 2832 | try w.print("){{{}, {}}};\n", .{ | 2832 | try w.print("){{{}, {}}};\n", .{ |
| ... | @@ -4044,7 +4044,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { | ... | @@ -4044,7 +4044,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 4044 | const new_local = try f.allocLocal(inst, src_ty); | 4044 | const new_local = try f.allocLocal(inst, src_ty); |
| 4045 | try f.writeCValue(writer, new_local, .Other); | 4045 | try f.writeCValue(writer, new_local, .Other); |
| 4046 | try writer.writeAll(" = "); | 4046 | try writer.writeAll(" = "); |
| 4047 | try f.writeCValue(writer, src_val, .Initializer); | 4047 | try f.writeCValue(writer, src_val, .Other); |
| 4048 | try writer.writeAll(";\n"); | 4048 | try writer.writeAll(";\n"); |
| 4049 | | 4049 | |
| 4050 | break :blk new_local; | 4050 | break :blk new_local; |
| ... | @@ -4515,7 +4515,7 @@ fn airSlice(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -4515,7 +4515,7 @@ fn airSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4515 | const a = try Assignment.start(f, writer, .usize); | 4515 | const a = try Assignment.start(f, writer, .usize); |
| 4516 | try f.writeCValueMember(writer, local, .{ .identifier = "len" }); | 4516 | try f.writeCValueMember(writer, local, .{ .identifier = "len" }); |
| 4517 | try a.assign(f, writer); | 4517 | try a.assign(f, writer); |
| 4518 | try f.writeCValue(writer, len, .Initializer); | 4518 | try f.writeCValue(writer, len, .Other); |
| 4519 | try a.end(f, writer); | 4519 | try a.end(f, writer); |
| 4520 | } | 4520 | } |
| 4521 | return local; | 4521 | return local; |
| ... | @@ -4933,7 +4933,7 @@ fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { | ... | @@ -4933,7 +4933,7 @@ fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { |
| 4933 | const cond_local = f.loop_switch_conds.get(br.block_inst).?; | 4933 | const cond_local = f.loop_switch_conds.get(br.block_inst).?; |
| 4934 | try f.writeCValue(writer, .{ .local = cond_local }, .Other); | 4934 | try f.writeCValue(writer, .{ .local = cond_local }, .Other); |
| 4935 | try writer.writeAll(" = "); | 4935 | try writer.writeAll(" = "); |
| 4936 | try f.writeCValue(writer, cond, .Initializer); | 4936 | try f.writeCValue(writer, cond, .Other); |
| 4937 | try writer.writeAll(";\n"); | 4937 | try writer.writeAll(";\n"); |
| 4938 | try writer.print("goto zig_switch_{d}_loop;", .{@intFromEnum(br.block_inst)}); | 4938 | try writer.print("goto zig_switch_{d}_loop;", .{@intFromEnum(br.block_inst)}); |
| 4939 | } | 4939 | } |
| ... | @@ -4978,14 +4978,8 @@ fn bitcast(f: *Function, dest_ty: Type, operand: CValue, operand_ty: Type) !CVal | ... | @@ -4978,14 +4978,8 @@ fn bitcast(f: *Function, dest_ty: Type, operand: CValue, operand_ty: Type) !CVal |
| 4978 | const operand_lval = if (operand == .constant) blk: { | 4978 | const operand_lval = if (operand == .constant) blk: { |
| 4979 | const operand_local = try f.allocLocal(null, operand_ty); | 4979 | const operand_local = try f.allocLocal(null, operand_ty); |
| 4980 | try f.writeCValue(writer, operand_local, .Other); | 4980 | try f.writeCValue(writer, operand_local, .Other); |
| 4981 | if (operand_ty.isAbiInt(zcu)) { | 4981 | try writer.writeAll(" = "); |
| 4982 | try writer.writeAll(" = "); | 4982 | try f.writeCValue(writer, operand, .Other); |
| 4983 | } else { | | |
| 4984 | try writer.writeAll(" = ("); | | |
| 4985 | try f.renderType(writer, operand_ty); | | |
| 4986 | try writer.writeByte(')'); | | |
| 4987 | } | | |
| 4988 | try f.writeCValue(writer, operand, .Initializer); | | |
| 4989 | try writer.writeAll(";\n"); | 4983 | try writer.writeAll(";\n"); |
| 4990 | break :blk operand_local; | 4984 | break :blk operand_local; |
| 4991 | } else operand; | 4985 | } else operand; |
| ... | @@ -5697,7 +5691,7 @@ fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5697,7 +5691,7 @@ fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5697 | const a = try Assignment.start(f, writer, opt_ctype); | 5691 | const a = try Assignment.start(f, writer, opt_ctype); |
| 5698 | try f.writeCValueDeref(writer, operand); | 5692 | try f.writeCValueDeref(writer, operand); |
| 5699 | try a.assign(f, writer); | 5693 | try a.assign(f, writer); |
| 5700 | try f.object.dg.renderValue(writer, Value.false, .Initializer); | 5694 | try f.object.dg.renderValue(writer, Value.false, .Other); |
| 5701 | try a.end(f, writer); | 5695 | try a.end(f, writer); |
| 5702 | return .none; | 5696 | return .none; |
| 5703 | }, | 5697 | }, |
| ... | @@ -5717,7 +5711,7 @@ fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5717,7 +5711,7 @@ fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5717 | const a = try Assignment.start(f, writer, opt_ctype); | 5711 | const a = try Assignment.start(f, writer, opt_ctype); |
| 5718 | try f.writeCValueDerefMember(writer, operand, .{ .identifier = "is_null" }); | 5712 | try f.writeCValueDerefMember(writer, operand, .{ .identifier = "is_null" }); |
| 5719 | try a.assign(f, writer); | 5713 | try a.assign(f, writer); |
| 5720 | try f.object.dg.renderValue(writer, Value.false, .Initializer); | 5714 | try f.object.dg.renderValue(writer, Value.false, .Other); |
| 5721 | try a.end(f, writer); | 5715 | try a.end(f, writer); |
| 5722 | } | 5716 | } |
| 5723 | if (f.liveness.isUnused(inst)) return .none; | 5717 | if (f.liveness.isUnused(inst)) return .none; |
| ... | @@ -5843,7 +5837,7 @@ fn airFieldParentPtr(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5843,7 +5837,7 @@ fn airFieldParentPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5843 | try writer.writeByte(')'); | 5837 | try writer.writeByte(')'); |
| 5844 | | 5838 | |
| 5845 | switch (fieldLocation(container_ptr_ty, field_ptr_ty, extra.field_index, pt)) { | 5839 | switch (fieldLocation(container_ptr_ty, field_ptr_ty, extra.field_index, pt)) { |
| 5846 | .begin => try f.writeCValue(writer, field_ptr_val, .Initializer), | 5840 | .begin => try f.writeCValue(writer, field_ptr_val, .Other), |
| 5847 | .field => |field| { | 5841 | .field => |field| { |
| 5848 | const u8_ptr_ty = try pt.adjustPtrTypeChild(field_ptr_ty, .u8); | 5842 | const u8_ptr_ty = try pt.adjustPtrTypeChild(field_ptr_ty, .u8); |
| 5849 | | 5843 | |
| ... | @@ -5897,7 +5891,7 @@ fn fieldPtr( | ... | @@ -5897,7 +5891,7 @@ fn fieldPtr( |
| 5897 | try writer.writeByte(')'); | 5891 | try writer.writeByte(')'); |
| 5898 | | 5892 | |
| 5899 | switch (fieldLocation(container_ptr_ty, field_ptr_ty, field_index, pt)) { | 5893 | switch (fieldLocation(container_ptr_ty, field_ptr_ty, field_index, pt)) { |
| 5900 | .begin => try f.writeCValue(writer, container_ptr_val, .Initializer), | 5894 | .begin => try f.writeCValue(writer, container_ptr_val, .Other), |
| 5901 | .field => |field| { | 5895 | .field => |field| { |
| 5902 | try writer.writeByte('&'); | 5896 | try writer.writeByte('&'); |
| 5903 | try f.writeCValueDerefMember(writer, container_ptr_val, field); | 5897 | try f.writeCValueDerefMember(writer, container_ptr_val, field); |
| ... | @@ -6020,7 +6014,7 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6020,7 +6014,7 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6020 | const operand_local = try f.allocLocal(inst, struct_ty); | 6014 | const operand_local = try f.allocLocal(inst, struct_ty); |
| 6021 | try f.writeCValue(writer, operand_local, .Other); | 6015 | try f.writeCValue(writer, operand_local, .Other); |
| 6022 | try writer.writeAll(" = "); | 6016 | try writer.writeAll(" = "); |
| 6023 | try f.writeCValue(writer, struct_byval, .Initializer); | 6017 | try f.writeCValue(writer, struct_byval, .Other); |
| 6024 | try writer.writeAll(";\n"); | 6018 | try writer.writeAll(";\n"); |
| 6025 | break :blk operand_local; | 6019 | break :blk operand_local; |
| 6026 | } else struct_byval; | 6020 | } else struct_byval; |
| ... | @@ -6118,7 +6112,7 @@ fn airUnwrapErrUnionPay(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValu | ... | @@ -6118,7 +6112,7 @@ fn airUnwrapErrUnionPay(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValu |
| 6118 | try writer.writeAll(" = ("); | 6112 | try writer.writeAll(" = ("); |
| 6119 | try f.renderType(writer, inst_ty); | 6113 | try f.renderType(writer, inst_ty); |
| 6120 | try writer.writeByte(')'); | 6114 | try writer.writeByte(')'); |
| 6121 | try f.writeCValue(writer, operand, .Initializer); | 6115 | try f.writeCValue(writer, operand, .Other); |
| 6122 | try writer.writeAll(";\n"); | 6116 | try writer.writeAll(";\n"); |
| 6123 | return local; | 6117 | return local; |
| 6124 | } | 6118 | } |
| ... | @@ -6163,7 +6157,7 @@ fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6163,7 +6157,7 @@ fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6163 | const a = try Assignment.start(f, writer, operand_ctype); | 6157 | const a = try Assignment.start(f, writer, operand_ctype); |
| 6164 | try f.writeCValueMember(writer, local, .{ .identifier = "payload" }); | 6158 | try f.writeCValueMember(writer, local, .{ .identifier = "payload" }); |
| 6165 | try a.assign(f, writer); | 6159 | try a.assign(f, writer); |
| 6166 | try f.writeCValue(writer, operand, .Initializer); | 6160 | try f.writeCValue(writer, operand, .Other); |
| 6167 | try a.end(f, writer); | 6161 | try a.end(f, writer); |
| 6168 | } | 6162 | } |
| 6169 | return local; | 6163 | return local; |
| ... | @@ -6364,7 +6358,7 @@ fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6364,7 +6358,7 @@ fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6364 | try f.writeCValueMember(writer, local, .{ .identifier = "ptr" }); | 6358 | try f.writeCValueMember(writer, local, .{ .identifier = "ptr" }); |
| 6365 | try a.assign(f, writer); | 6359 | try a.assign(f, writer); |
| 6366 | if (operand == .undef) { | 6360 | if (operand == .undef) { |
| 6367 | try f.writeCValue(writer, .{ .undef = inst_ty.slicePtrFieldType(zcu) }, .Initializer); | 6361 | try f.writeCValue(writer, .{ .undef = inst_ty.slicePtrFieldType(zcu) }, .Other); |
| 6368 | } else { | 6362 | } else { |
| 6369 | const ptr_ctype = try f.ctypeFromType(ptr_ty, .complete); | 6363 | const ptr_ctype = try f.ctypeFromType(ptr_ty, .complete); |
| 6370 | const ptr_child_ctype = ptr_ctype.info(ctype_pool).pointer.elem_ctype; | 6364 | const ptr_child_ctype = ptr_ctype.info(ctype_pool).pointer.elem_ctype; |
| ... | @@ -6381,7 +6375,7 @@ fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6381,7 +6375,7 @@ fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6381 | try writer.writeByte('&'); | 6375 | try writer.writeByte('&'); |
| 6382 | try f.writeCValueDeref(writer, operand); | 6376 | try f.writeCValueDeref(writer, operand); |
| 6383 | try writer.print("[{}]", .{try f.fmtIntLiteral(try pt.intValue(.usize, 0))}); | 6377 | try writer.print("[{}]", .{try f.fmtIntLiteral(try pt.intValue(.usize, 0))}); |
| 6384 | } else try f.writeCValue(writer, operand, .Initializer); | 6378 | } else try f.writeCValue(writer, operand, .Other); |
| 6385 | } | 6379 | } |
| 6386 | try a.end(f, writer); | 6380 | try a.end(f, writer); |
| 6387 | } | 6381 | } |
| ... | @@ -6911,7 +6905,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { | ... | @@ -6911,7 +6905,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 6911 | try writer.writeAll("for ("); | 6905 | try writer.writeAll("for ("); |
| 6912 | try f.writeCValue(writer, index, .Other); | 6906 | try f.writeCValue(writer, index, .Other); |
| 6913 | try writer.writeAll(" = "); | 6907 | try writer.writeAll(" = "); |
| 6914 | try f.object.dg.renderValue(writer, try pt.intValue(.usize, 0), .Initializer); | 6908 | try f.object.dg.renderValue(writer, try pt.intValue(.usize, 0), .Other); |
| 6915 | try writer.writeAll("; "); | 6909 | try writer.writeAll("; "); |
| 6916 | try f.writeCValue(writer, index, .Other); | 6910 | try f.writeCValue(writer, index, .Other); |
| 6917 | try writer.writeAll(" != "); | 6911 | try writer.writeAll(" != "); |
| ... | @@ -7281,7 +7275,7 @@ fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -7281,7 +7275,7 @@ fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7281 | .float => try pt.floatValue(scalar_ty, std.math.nan(f128)), | 7275 | .float => try pt.floatValue(scalar_ty, std.math.nan(f128)), |
| 7282 | else => unreachable, | 7276 | else => unreachable, |
| 7283 | }, | 7277 | }, |
| 7284 | }, .Initializer); | 7278 | }, .Other); |
| 7285 | try writer.writeAll(";\n"); | 7279 | try writer.writeAll(";\n"); |
| 7286 | | 7280 | |
| 7287 | const v = try Vectorize.start(f, inst, writer, operand_ty); | 7281 | const v = try Vectorize.start(f, inst, writer, operand_ty); |