authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-03-14 22:17:19-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-03-15 01:04:21-04:00
log238615984064f52b6ff31b5750824a9c764fdb15
tree19cc9479a8c7c0274b69537ec30a045955f91199
parentd14a9e82feca6467176d188d2eccf6ff51606952

x86_64: use short union init


1 files changed, 12 insertions(+), 12 deletions(-)

src/arch/x86_64/CodeGen.zig+12-12
......@@ -1037,7 +1037,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
10371037fn processDeath(self: *Self, inst: Air.Inst.Index) void {
10381038 const air_tags = self.air.instructions.items(.tag);
10391039 if (air_tags[inst] == .constant) return; // Constants are immortal.
1040 log.debug("%{d} => {}", .{ inst, MCValue{ .dead = {} } });
1040 log.debug("%{d} => {}", .{ inst, MCValue.dead });
10411041 // When editing this function, note that the logic must synchronize with `reuseOperand`.
10421042 const prev_value = self.getResolvedInstValue(inst);
10431043 const branch = &self.branch_stack.items[self.branch_stack.items.len - 1];
......@@ -4729,7 +4729,7 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void {
47294729 // break instruction will choose a MCValue for the block result and overwrite
47304730 // this field. Following break instructions will use that MCValue to put their
47314731 // block results.
4732 .mcv = MCValue{ .none = {} },
4732 .mcv = .none,
47334733 });
47344734 defer self.blocks.getPtr(inst).?.relocs.deinit(self.gpa);
47354735
......@@ -5145,9 +5145,9 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
51455145 const reg_name = output[2 .. output.len - 1];
51465146 const reg = parseRegName(reg_name) orelse
51475147 return self.fail("unrecognized register: '{s}'", .{reg_name});
5148 break :result MCValue{ .register = reg };
5148 break :result .{ .register = reg };
51495149 } else {
5150 break :result MCValue{ .none = {} };
5150 break :result .none;
51515151 }
51525152 };
51535153
......@@ -6289,7 +6289,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {
62896289 if (ref_int < Air.Inst.Ref.typed_value_map.len) {
62906290 const tv = Air.Inst.Ref.typed_value_map[ref_int];
62916291 if (!tv.ty.hasRuntimeBitsIgnoreComptime() and !tv.ty.isError()) {
6292 return MCValue{ .none = {} };
6292 return .none;
62936293 }
62946294 return self.genTypedValue(tv);
62956295 }
......@@ -6297,7 +6297,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {
62976297 // If the type has no codegen bits, no need to store it.
62986298 const inst_ty = self.air.typeOf(inst);
62996299 if (!inst_ty.hasRuntimeBitsIgnoreComptime() and !inst_ty.isError())
6300 return MCValue{ .none = {} };
6300 return .none;
63016301
63026302 const inst_index = @intCast(Air.Inst.Index, ref_int - Air.Inst.Ref.typed_value_map.len);
63036303 switch (self.air.instructions.items(.tag)[inst_index]) {
......@@ -6406,7 +6406,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
64066406 switch (cc) {
64076407 .Naked => {
64086408 assert(result.args.len == 0);
6409 result.return_value = .{ .unreach = {} };
6409 result.return_value = .unreach;
64106410 result.stack_byte_count = 0;
64116411 result.stack_align = 1;
64126412 return result;
......@@ -6414,10 +6414,10 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
64146414 .C => {
64156415 // Return values
64166416 if (ret_ty.zigTypeTag() == .NoReturn) {
6417 result.return_value = .{ .unreach = {} };
6417 result.return_value = .unreach;
64186418 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime() and !ret_ty.isError()) {
64196419 // TODO: is this even possible for C calling convention?
6420 result.return_value = .{ .none = {} };
6420 result.return_value = .none;
64216421 } else {
64226422 const ret_ty_size = @intCast(u32, ret_ty.abiSize(self.target.*));
64236423 if (ret_ty_size == 0) {
......@@ -6489,9 +6489,9 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
64896489 .Unspecified => {
64906490 // Return values
64916491 if (ret_ty.zigTypeTag() == .NoReturn) {
6492 result.return_value = .{ .unreach = {} };
6492 result.return_value = .unreach;
64936493 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime() and !ret_ty.isError()) {
6494 result.return_value = .{ .none = {} };
6494 result.return_value = .none;
64956495 } else {
64966496 const ret_ty_size = @intCast(u32, ret_ty.abiSize(self.target.*));
64976497 if (ret_ty_size == 0) {
......@@ -6516,7 +6516,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
65166516
65176517 for (param_types, result.args) |ty, *arg| {
65186518 if (!ty.hasRuntimeBits()) {
6519 arg.* = .{ .none = {} };
6519 arg.* = .none;
65206520 continue;
65216521 }
65226522 const param_size = @intCast(u32, ty.abiSize(self.target.*));