aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-06-19 22:36:24 -0700
committerGitHub <noreply@github.com>2023-06-19 22:36:24 -0700
commita72d634b731952ee227d026c27e83c5702dcea4a (patch)
tree8bfc4c9afa75a27ebb1108924589a8e7d5cc89ed /src/codegen/spirv.zig
parentc6e2e1ae4b85fc36acc89c9a5e2673834146d628 (diff)
parenta4d1edac8d65e1aa4b565f6fb11ab78541d97efa (diff)
downloadzig-a72d634b731952ee227d026c27e83c5702dcea4a.tar.gz
zig-a72d634b731952ee227d026c27e83c5702dcea4a.zip
Merge pull request #16046 from BratishkaErik/issue-6128
Renaming `@xtoy` to `@YfromX`
Diffstat (limited to 'src/codegen/spirv.zig')
-rw-r--r--src/codegen/spirv.zig32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index dc1f23dad4..46ef5609db 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -387,7 +387,7 @@ pub const DeclGen = struct {
switch (repr) {
.indirect => {
const int_ty_ref = try self.intType(.unsigned, 1);
- return self.spv.constInt(int_ty_ref, @boolToInt(value));
+ return self.spv.constInt(int_ty_ref, @intFromBool(value));
},
.direct => {
const bool_ty_ref = try self.resolveType(Type.bool, .direct);
@@ -532,7 +532,7 @@ pub const DeclGen = struct {
}
fn addConstBool(self: *@This(), value: bool) !void {
- try self.addByte(@boolToInt(value)); // TODO: Keep in sync with something?
+ try self.addByte(@intFromBool(value)); // TODO: Keep in sync with something?
}
fn addInt(self: *@This(), ty: Type, val: Value) !void {
@@ -697,7 +697,7 @@ pub const DeclGen = struct {
try self.addUndef(padding);
},
.enum_tag => {
- const int_val = try val.enumToInt(ty, mod);
+ const int_val = try val.intFromEnum(ty, mod);
const int_ty = ty.intTagType(mod);
@@ -873,7 +873,7 @@ pub const DeclGen = struct {
assert(storage_class != .Generic and storage_class != .Function);
const var_id = self.spv.allocId();
- log.debug("lowerIndirectConstant: id = {}, index = {}, ty = {}, val = {}", .{ var_id.id, @enumToInt(spv_decl_index), ty.fmt(self.module), val.fmtDebug() });
+ log.debug("lowerIndirectConstant: id = {}, index = {}, ty = {}, val = {}", .{ var_id.id, @intFromEnum(spv_decl_index), ty.fmt(self.module), val.fmtDebug() });
const section = &self.spv.globals.section;
@@ -1010,7 +1010,7 @@ pub const DeclGen = struct {
false,
alignment,
);
- log.debug("indirect constant: index = {}", .{@enumToInt(spv_decl_index)});
+ log.debug("indirect constant: index = {}", .{@intFromEnum(spv_decl_index)});
try self.func.decl_deps.put(self.spv.gpa, spv_decl_index, {});
try self.func.body.emit(self.spv.gpa, .OpLoad, .{
@@ -1578,7 +1578,7 @@ pub const DeclGen = struct {
}
}
- fn boolToInt(self: *DeclGen, result_ty_ref: CacheRef, condition_id: IdRef) !IdRef {
+ fn intFromBool(self: *DeclGen, result_ty_ref: CacheRef, condition_id: IdRef) !IdRef {
const zero_id = try self.spv.constInt(result_ty_ref, 0);
const one_id = try self.spv.constInt(result_ty_ref, 1);
const result_id = self.spv.allocId();
@@ -1621,7 +1621,7 @@ pub const DeclGen = struct {
return switch (ty.zigTypeTag(mod)) {
.Bool => blk: {
const indirect_bool_ty_ref = try self.resolveType(ty, .indirect);
- break :blk self.boolToInt(indirect_bool_ty_ref, operand_id);
+ break :blk self.intFromBool(indirect_bool_ty_ref, operand_id);
},
else => operand_id,
};
@@ -1721,9 +1721,9 @@ pub const DeclGen = struct {
.bitcast => try self.airBitCast(inst),
.intcast, .trunc => try self.airIntCast(inst),
- .ptrtoint => try self.airPtrToInt(inst),
- .int_to_float => try self.airIntToFloat(inst),
- .float_to_int => try self.airFloatToInt(inst),
+ .int_from_ptr => try self.airIntFromPtr(inst),
+ .float_from_int => try self.airFloatFromInt(inst),
+ .int_from_float => try self.airIntFromFloat(inst),
.not => try self.airNot(inst),
.slice_ptr => try self.airSliceField(inst, 0),
@@ -2011,7 +2011,7 @@ pub const DeclGen = struct {
// Construct the struct that Zig wants as result.
// The value should already be the correct type.
- const ov_id = try self.boolToInt(ov_ty_ref, overflowed_id);
+ const ov_id = try self.intFromBool(ov_ty_ref, overflowed_id);
const result_ty_ref = try self.resolveType(result_ty, .direct);
return try self.constructStruct(result_ty_ref, &.{
value_id,
@@ -2329,7 +2329,7 @@ pub const DeclGen = struct {
return result_id;
}
- fn airPtrToInt(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
+ fn airIntFromPtr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
if (self.liveness.isUnused(inst)) return null;
const un_op = self.air.instructions.items(.data)[inst].un_op;
@@ -2345,7 +2345,7 @@ pub const DeclGen = struct {
return result_id;
}
- fn airIntToFloat(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
+ fn airFloatFromInt(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
if (self.liveness.isUnused(inst)) return null;
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
@@ -2371,7 +2371,7 @@ pub const DeclGen = struct {
return result_id;
}
- fn airFloatToInt(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
+ fn airIntFromFloat(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
if (self.liveness.isUnused(inst)) return null;
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
@@ -2515,7 +2515,7 @@ pub const DeclGen = struct {
if (layout.payload_size == 0) return union_handle;
const tag_ty = un_ty.unionTagTypeSafety().?;
- const tag_index = @boolToInt(layout.tag_align < layout.payload_align);
+ const tag_index = @intFromBool(layout.tag_align < layout.payload_align);
return try self.extractField(tag_ty, union_handle, tag_index);
}
@@ -3105,7 +3105,7 @@ pub const DeclGen = struct {
.Int => if (cond_ty.isSignedInt(mod)) @bitCast(u64, value.toSignedInt(mod)) else value.toUnsignedInt(mod),
.Enum => blk: {
// TODO: figure out of cond_ty is correct (something with enum literals)
- break :blk (try value.enumToInt(cond_ty, mod)).toUnsignedInt(mod); // TODO: composite integer constants
+ break :blk (try value.intFromEnum(cond_ty, mod)).toUnsignedInt(mod); // TODO: composite integer constants
},
else => unreachable,
};