authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-08-06 01:17:47-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-08-08 21:32:50-04:00
logf938404a45d347fe448351c70cc34db98700e068
treead2547066a9f8c8957e44133f58aa4a85710642f
parentd34201c8491007c5a24b4175a5170a5b6cc3d55e

Builder: fix attribute spacing


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

src/codegen/llvm/Builder.zig+15-15
...@@ -1151,13 +1151,13 @@ pub const Attribute = union(Kind) {...@@ -1151,13 +1151,13 @@ pub const Attribute = union(Kind) {
1151 .sret,1151 .sret,
1152 .elementtype,1152 .elementtype,
1153 => |ty| try writer.print(" {s}({%})", .{ @tagName(attribute), ty.fmt(data.builder) }),1153 => |ty| try writer.print(" {s}({%})", .{ @tagName(attribute), ty.fmt(data.builder) }),
1154 .@"align" => |alignment| try writer.print("{}", .{alignment}),1154 .@"align" => |alignment| try writer.print("{ }", .{alignment}),
1155 .dereferenceable,1155 .dereferenceable,
1156 .dereferenceable_or_null,1156 .dereferenceable_or_null,
1157 => |size| try writer.print(" {s}({d})", .{ @tagName(attribute), size }),1157 => |size| try writer.print(" {s}({d})", .{ @tagName(attribute), size }),
1158 .nofpclass => |fpclass| {1158 .nofpclass => |fpclass| {
1159 const Int = @typeInfo(FpClass).Struct.backing_integer.?;1159 const Int = @typeInfo(FpClass).Struct.backing_integer.?;
1160 try writer.print("{s}(", .{@tagName(attribute)});1160 try writer.print(" {s}(", .{@tagName(attribute)});
1161 var any = false;1161 var any = false;
1162 var remaining: Int = @bitCast(fpclass);1162 var remaining: Int = @bitCast(fpclass);
1163 inline for (@typeInfo(FpClass).Struct.decls) |decl| {1163 inline for (@typeInfo(FpClass).Struct.decls) |decl| {
...@@ -1175,13 +1175,13 @@ pub const Attribute = union(Kind) {...@@ -1175,13 +1175,13 @@ pub const Attribute = union(Kind) {
1175 },1175 },
1176 .alignstack => |alignment| try writer.print(1176 .alignstack => |alignment| try writer.print(
1177 if (comptime std.mem.indexOfScalar(u8, fmt_str, '#') != null)1177 if (comptime std.mem.indexOfScalar(u8, fmt_str, '#') != null)
1178 "{s}={d}"1178 " {s}={d}"
1179 else1179 else
1180 "{s}({d})",1180 " {s}({d})",
1181 .{ @tagName(attribute), alignment.toByteUnits() orelse return },1181 .{ @tagName(attribute), alignment.toByteUnits() orelse return },
1182 ),1182 ),
1183 .allockind => |allockind| {1183 .allockind => |allockind| {
1184 try writer.print("{s}(\"", .{@tagName(attribute)});1184 try writer.print(" {s}(\"", .{@tagName(attribute)});
1185 var any = false;1185 var any = false;
1186 inline for (@typeInfo(AllocKind).Struct.fields) |field| {1186 inline for (@typeInfo(AllocKind).Struct.fields) |field| {
1187 if (comptime std.mem.eql(u8, field.name, "_")) continue;1187 if (comptime std.mem.eql(u8, field.name, "_")) continue;
...@@ -1196,22 +1196,22 @@ pub const Attribute = union(Kind) {...@@ -1196,22 +1196,22 @@ pub const Attribute = union(Kind) {
1196 try writer.writeAll("\")");1196 try writer.writeAll("\")");
1197 },1197 },
1198 .allocsize => |allocsize| {1198 .allocsize => |allocsize| {
1199 try writer.print("{s}({d}", .{ @tagName(attribute), allocsize.elem_size });1199 try writer.print(" {s}({d}", .{ @tagName(attribute), allocsize.elem_size });
1200 if (allocsize.num_elems != AllocSize.none)1200 if (allocsize.num_elems != AllocSize.none)
1201 try writer.print(",{d}", .{allocsize.num_elems});1201 try writer.print(",{d}", .{allocsize.num_elems});
1202 try writer.writeByte(')');1202 try writer.writeByte(')');
1203 },1203 },
1204 .memory => |memory| try writer.print("{s}({s}, argmem: {s}, inaccessiblemem: {s})", .{1204 .memory => |memory| try writer.print(" {s}({s}, argmem: {s}, inaccessiblemem: {s})", .{
1205 @tagName(attribute),1205 @tagName(attribute),
1206 @tagName(memory.other),1206 @tagName(memory.other),
1207 @tagName(memory.argmem),1207 @tagName(memory.argmem),
1208 @tagName(memory.inaccessiblemem),1208 @tagName(memory.inaccessiblemem),
1209 }),1209 }),
1210 .uwtable => |uwtable| if (uwtable != .none) {1210 .uwtable => |uwtable| if (uwtable != .none) {
1211 try writer.writeAll(@tagName(attribute));1211 try writer.print(" {s}", .{@tagName(attribute)});
1212 if (uwtable != UwTable.default) try writer.print("({s})", .{@tagName(uwtable)});1212 if (uwtable != UwTable.default) try writer.print("({s})", .{@tagName(uwtable)});
1213 },1213 },
1214 .vscale_range => |vscale_range| try writer.print("{s}({d},{d})", .{1214 .vscale_range => |vscale_range| try writer.print(" {s}({d},{d})", .{
1215 @tagName(attribute),1215 @tagName(attribute),
1216 vscale_range.min.toByteUnits().?,1216 vscale_range.min.toByteUnits().?,
1217 vscale_range.max.toByteUnits() orelse 0,1217 vscale_range.max.toByteUnits() orelse 0,
...@@ -1867,7 +1867,7 @@ pub const AddrSpace = enum(u24) {...@@ -1867,7 +1867,7 @@ pub const AddrSpace = enum(u24) {
1867 _: std.fmt.FormatOptions,1867 _: std.fmt.FormatOptions,
1868 writer: anytype,1868 writer: anytype,
1869 ) @TypeOf(writer).Error!void {1869 ) @TypeOf(writer).Error!void {
1870 if (self != .default) try writer.print("{s} addrspace({d})", .{ prefix, @intFromEnum(self) });1870 if (self != .default) try writer.print("{s}addrspace({d})", .{ prefix, @intFromEnum(self) });
1871 }1871 }
1872};1872};
18731873
...@@ -1908,7 +1908,7 @@ pub const Alignment = enum(u6) {...@@ -1908,7 +1908,7 @@ pub const Alignment = enum(u6) {
1908 _: std.fmt.FormatOptions,1908 _: std.fmt.FormatOptions,
1909 writer: anytype,1909 writer: anytype,
1910 ) @TypeOf(writer).Error!void {1910 ) @TypeOf(writer).Error!void {
1911 try writer.print("{s} align {d}", .{ prefix, self.toByteUnits() orelse return });1911 try writer.print("{s}align {d}", .{ prefix, self.toByteUnits() orelse return });
1912 }1912 }
1913};1913};
19141914
...@@ -7413,7 +7413,7 @@ pub fn printUnbuffered(...@@ -7413,7 +7413,7 @@ pub fn printUnbuffered(
7413 if (variable.global.getReplacement(self) != .none) continue;7413 if (variable.global.getReplacement(self) != .none) continue;
7414 const global = variable.global.ptrConst(self);7414 const global = variable.global.ptrConst(self);
7415 try writer.print(7415 try writer.print(
7416 \\{} ={}{}{}{}{}{}{}{} {s} {%}{ }{,}7416 \\{} ={}{}{}{}{}{}{}{} {s} {%}{ }{, }
7417 \\7417 \\
7418 , .{7418 , .{
7419 variable.global.fmt(self),7419 variable.global.fmt(self),
...@@ -7612,7 +7612,7 @@ pub fn printUnbuffered(...@@ -7612,7 +7612,7 @@ pub fn printUnbuffered(
7612 => |tag| {7612 => |tag| {
7613 const extra =7613 const extra =
7614 function.extraData(Function.Instruction.Alloca, instruction.data);7614 function.extraData(Function.Instruction.Alloca, instruction.data);
7615 try writer.print(" %{} = {s} {%}{,%}{,}{,}\n", .{7615 try writer.print(" %{} = {s} {%}{,%}{, }{, }\n", .{
7616 instruction_index.name(&function).fmt(self),7616 instruction_index.name(&function).fmt(self),
7617 @tagName(tag),7617 @tagName(tag),
7618 extra.type.fmt(self),7618 extra.type.fmt(self),
...@@ -7840,7 +7840,7 @@ pub fn printUnbuffered(...@@ -7840,7 +7840,7 @@ pub fn printUnbuffered(
7840 => |tag| {7840 => |tag| {
7841 const extra =7841 const extra =
7842 function.extraData(Function.Instruction.Load, instruction.data);7842 function.extraData(Function.Instruction.Load, instruction.data);
7843 try writer.print(" %{} = {s} {%}, {%}{}{}{,}\n", .{7843 try writer.print(" %{} = {s} {%}, {%}{}{}{, }\n", .{
7844 instruction_index.name(&function).fmt(self),7844 instruction_index.name(&function).fmt(self),
7845 @tagName(tag),7845 @tagName(tag),
7846 extra.type.fmt(self),7846 extra.type.fmt(self),
...@@ -7908,7 +7908,7 @@ pub fn printUnbuffered(...@@ -7908,7 +7908,7 @@ pub fn printUnbuffered(
7908 => |tag| {7908 => |tag| {
7909 const extra =7909 const extra =
7910 function.extraData(Function.Instruction.Store, instruction.data);7910 function.extraData(Function.Instruction.Store, instruction.data);
7911 try writer.print(" {s} {%}, {%}{}{}{,}\n", .{7911 try writer.print(" {s} {%}, {%}{}{}{, }\n", .{
7912 @tagName(tag),7912 @tagName(tag),
7913 extra.val.fmt(function_index, self),7913 extra.val.fmt(function_index, self),
7914 extra.ptr.fmt(function_index, self),7914 extra.ptr.fmt(function_index, self),