aboutsummaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorTristan Ross <tristan.ross@midstall.com>2024-02-18 18:28:39 -0800
committerTristan Ross <tristan.ross@midstall.com>2024-03-11 07:09:07 -0700
commit099f3c4039d5702b073639ef8b55881973b71c80 (patch)
tree2be1bb7abc86fb4c9148b82314718eac6a01e895 /src/arch
parentd0c06ca7127110a8afeb0ef524a197049892db21 (diff)
downloadzig-099f3c4039d5702b073639ef8b55881973b71c80.tar.gz
zig-099f3c4039d5702b073639ef8b55881973b71c80.zip
std.builtin: make container layout fields lowercase
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/aarch64/abi.zig4
-rw-r--r--src/arch/arm/abi.zig4
-rw-r--r--src/arch/riscv64/abi.zig4
-rw-r--r--src/arch/wasm/CodeGen.zig14
-rw-r--r--src/arch/wasm/abi.zig6
-rw-r--r--src/arch/x86_64/CodeGen.zig6
-rw-r--r--src/arch/x86_64/abi.zig6
7 files changed, 22 insertions, 22 deletions
diff --git a/src/arch/aarch64/abi.zig b/src/arch/aarch64/abi.zig
index d85f67aaa9..5bc452a493 100644
--- a/src/arch/aarch64/abi.zig
+++ b/src/arch/aarch64/abi.zig
@@ -21,7 +21,7 @@ pub fn classifyType(ty: Type, mod: *Module) Class {
var maybe_float_bits: ?u16 = null;
switch (ty.zigTypeTag(mod)) {
.Struct => {
- if (ty.containerLayout(mod) == .Packed) return .byval;
+ if (ty.containerLayout(mod) == .@"packed") return .byval;
const float_count = countFloats(ty, mod, &maybe_float_bits);
if (float_count <= sret_float_count) return .{ .float_array = float_count };
@@ -31,7 +31,7 @@ pub fn classifyType(ty: Type, mod: *Module) Class {
return .integer;
},
.Union => {
- if (ty.containerLayout(mod) == .Packed) return .byval;
+ if (ty.containerLayout(mod) == .@"packed") return .byval;
const float_count = countFloats(ty, mod, &maybe_float_bits);
if (float_count <= sret_float_count) return .{ .float_array = float_count };
diff --git a/src/arch/arm/abi.zig b/src/arch/arm/abi.zig
index ffb5c7ae3a..a6581c8dd8 100644
--- a/src/arch/arm/abi.zig
+++ b/src/arch/arm/abi.zig
@@ -33,7 +33,7 @@ pub fn classifyType(ty: Type, mod: *Module, ctx: Context) Class {
switch (ty.zigTypeTag(mod)) {
.Struct => {
const bit_size = ty.bitSize(mod);
- if (ty.containerLayout(mod) == .Packed) {
+ if (ty.containerLayout(mod) == .@"packed") {
if (bit_size > 64) return .memory;
return .byval;
}
@@ -56,7 +56,7 @@ pub fn classifyType(ty: Type, mod: *Module, ctx: Context) Class {
.Union => {
const bit_size = ty.bitSize(mod);
const union_obj = mod.typeToUnion(ty).?;
- if (union_obj.getLayout(ip) == .Packed) {
+ if (union_obj.getLayout(ip) == .@"packed") {
if (bit_size > 64) return .memory;
return .byval;
}
diff --git a/src/arch/riscv64/abi.zig b/src/arch/riscv64/abi.zig
index da74734de4..be3ac590a2 100644
--- a/src/arch/riscv64/abi.zig
+++ b/src/arch/riscv64/abi.zig
@@ -15,7 +15,7 @@ pub fn classifyType(ty: Type, mod: *Module) Class {
switch (ty.zigTypeTag(mod)) {
.Struct => {
const bit_size = ty.bitSize(mod);
- if (ty.containerLayout(mod) == .Packed) {
+ if (ty.containerLayout(mod) == .@"packed") {
if (bit_size > max_byval_size) return .memory;
return .byval;
}
@@ -44,7 +44,7 @@ pub fn classifyType(ty: Type, mod: *Module) Class {
},
.Union => {
const bit_size = ty.bitSize(mod);
- if (ty.containerLayout(mod) == .Packed) {
+ if (ty.containerLayout(mod) == .@"packed") {
if (bit_size > max_byval_size) return .memory;
return .byval;
}
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index e940e37619..a2bcb1cf6a 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -1018,7 +1018,7 @@ fn typeToValtype(ty: Type, mod: *Module) wasm.Valtype {
.unrolled => wasm.Valtype.i32,
},
.Union => switch (ty.containerLayout(mod)) {
- .Packed => {
+ .@"packed" => {
const int_ty = mod.intType(.unsigned, @as(u16, @intCast(ty.bitSize(mod)))) catch @panic("out of memory");
return typeToValtype(int_ty, mod);
},
@@ -1737,7 +1737,7 @@ fn isByRef(ty: Type, mod: *Module) bool {
=> return ty.hasRuntimeBitsIgnoreComptime(mod),
.Union => {
if (mod.typeToUnion(ty)) |union_obj| {
- if (union_obj.getLayout(ip) == .Packed) {
+ if (union_obj.getLayout(ip) == .@"packed") {
return ty.abiSize(mod) > 8;
}
}
@@ -3097,7 +3097,7 @@ fn lowerParentPtr(func: *CodeGen, ptr_val: Value, offset: u32) InnerError!WValue
break :blk parent_ty.structFieldOffset(field_index, mod);
},
.Union => switch (parent_ty.containerLayout(mod)) {
- .Packed => 0,
+ .@"packed" => 0,
else => blk: {
const layout: Module.UnionLayout = parent_ty.unionGetLayout(mod);
if (layout.payload_size == 0) break :blk 0;
@@ -3358,7 +3358,7 @@ fn lowerConstant(func: *CodeGen, val: Value, ty: Type) InnerError!WValue {
const struct_type = ip.loadStructType(ty.toIntern());
// non-packed structs are not handled in this function because they
// are by-ref types.
- assert(struct_type.layout == .Packed);
+ assert(struct_type.layout == .@"packed");
var buf: [8]u8 = .{0} ** 8; // zero the buffer so we do not read 0xaa as integer
val.writeToPackedMemory(ty, mod, &buf, 0) catch unreachable;
const backing_int_ty = Type.fromInterned(struct_type.backingIntType(ip).*);
@@ -3890,7 +3890,7 @@ fn structFieldPtr(
const struct_ptr_ty_info = struct_ptr_ty.ptrInfo(mod);
const offset = switch (struct_ty.containerLayout(mod)) {
- .Packed => switch (struct_ty.zigTypeTag(mod)) {
+ .@"packed" => switch (struct_ty.zigTypeTag(mod)) {
.Struct => offset: {
if (result_ty.ptrInfo(mod).packed_offset.host_size != 0) {
break :offset @as(u32, 0);
@@ -3928,7 +3928,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
if (!field_ty.hasRuntimeBitsIgnoreComptime(mod)) return func.finishAir(inst, .none, &.{struct_field.struct_operand});
const result = switch (struct_ty.containerLayout(mod)) {
- .Packed => switch (struct_ty.zigTypeTag(mod)) {
+ .@"packed" => switch (struct_ty.zigTypeTag(mod)) {
.Struct => result: {
const packed_struct = mod.typeToPackedStruct(struct_ty).?;
const offset = mod.structPackedFieldBitOffset(packed_struct, field_index);
@@ -5321,7 +5321,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
break :result_value result;
},
.Struct => switch (result_ty.containerLayout(mod)) {
- .Packed => {
+ .@"packed" => {
if (isByRef(result_ty, mod)) {
return func.fail("TODO: airAggregateInit for packed structs larger than 64 bits", .{});
}
diff --git a/src/arch/wasm/abi.zig b/src/arch/wasm/abi.zig
index 9c3fd8260d..7ca0f9f245 100644
--- a/src/arch/wasm/abi.zig
+++ b/src/arch/wasm/abi.zig
@@ -29,7 +29,7 @@ pub fn classifyType(ty: Type, mod: *Module) [2]Class {
switch (ty.zigTypeTag(mod)) {
.Struct => {
const struct_type = mod.typeToStruct(ty).?;
- if (struct_type.layout == .Packed) {
+ if (struct_type.layout == .@"packed") {
if (ty.bitSize(mod) <= 64) return direct;
return .{ .direct, .direct };
}
@@ -70,7 +70,7 @@ pub fn classifyType(ty: Type, mod: *Module) [2]Class {
},
.Union => {
const union_obj = mod.typeToUnion(ty).?;
- if (union_obj.getLayout(ip) == .Packed) {
+ if (union_obj.getLayout(ip) == .@"packed") {
if (ty.bitSize(mod) <= 64) return direct;
return .{ .direct, .direct };
}
@@ -113,7 +113,7 @@ pub fn scalarType(ty: Type, mod: *Module) Type {
},
.Union => {
const union_obj = mod.typeToUnion(ty).?;
- if (union_obj.getLayout(ip) != .Packed) {
+ if (union_obj.getLayout(ip) != .@"packed") {
const layout = mod.getUnionLayout(union_obj);
if (layout.payload_size == 0 and layout.tag_size != 0) {
return scalarType(ty.unionTagTypeSafety(mod).?, mod);
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index 397dd3ab5f..2d66daf83f 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -7962,8 +7962,8 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
const src_mcv = try self.resolveInst(operand);
const field_off: u32 = switch (container_ty.containerLayout(mod)) {
- .Auto, .Extern => @intCast(container_ty.structFieldOffset(index, mod) * 8),
- .Packed => if (mod.typeToStruct(container_ty)) |struct_type|
+ .auto, .@"extern" => @intCast(container_ty.structFieldOffset(index, mod) * 8),
+ .@"packed" => if (mod.typeToStruct(container_ty)) |struct_type|
mod.structPackedFieldBitOffset(struct_type, index)
else
0,
@@ -17979,7 +17979,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
switch (result_ty.zigTypeTag(mod)) {
.Struct => {
const frame_index = try self.allocFrameIndex(FrameAlloc.initSpill(result_ty, mod));
- if (result_ty.containerLayout(mod) == .Packed) {
+ if (result_ty.containerLayout(mod) == .@"packed") {
const struct_type = mod.typeToStruct(result_ty).?;
try self.genInlineMemset(
.{ .lea_frame = .{ .index = frame_index } },
diff --git a/src/arch/x86_64/abi.zig b/src/arch/x86_64/abi.zig
index 601fc1933e..f54a98e08f 100644
--- a/src/arch/x86_64/abi.zig
+++ b/src/arch/x86_64/abi.zig
@@ -42,7 +42,7 @@ pub fn classifyWindows(ty: Type, mod: *Module) Class {
1, 2, 4, 8 => return .integer,
else => switch (ty.zigTypeTag(mod)) {
.Int => return .win_i128,
- .Struct, .Union => if (ty.containerLayout(mod) == .Packed) {
+ .Struct, .Union => if (ty.containerLayout(mod) == .@"packed") {
return .win_i128;
} else {
return .memory;
@@ -238,7 +238,7 @@ pub fn classifySystemV(ty: Type, mod: *Module, ctx: Context) [8]Class {
// separately.".
const struct_type = mod.typeToStruct(ty).?;
const ty_size = ty.abiSize(mod);
- if (struct_type.layout == .Packed) {
+ if (struct_type.layout == .@"packed") {
assert(ty_size <= 16);
result[0] = .integer;
if (ty_size > 8) result[1] = .integer;
@@ -356,7 +356,7 @@ pub fn classifySystemV(ty: Type, mod: *Module, ctx: Context) [8]Class {
// separately.".
const union_obj = mod.typeToUnion(ty).?;
const ty_size = mod.unionAbiSize(union_obj);
- if (union_obj.getLayout(ip) == .Packed) {
+ if (union_obj.getLayout(ip) == .@"packed") {
assert(ty_size <= 16);
result[0] = .integer;
if (ty_size > 8) result[1] = .integer;