lang: rename signed integer types sN -> iN
Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
This commit is contained in:
@@ -948,7 +948,7 @@ pub const LLVMEmitter = struct {
|
||||
.string => |sid| self.emitConstStringGlobal(self.ir_mod.types.getString(sid)),
|
||||
.aggregate => |agg| self.emitConstAggregate(agg, llvm_ty, false),
|
||||
.vtable => c.LLVMConstNull(llvm_ty), // placeholder — initialized in initVtableGlobals after function declarations
|
||||
// A top-level null-pointer global (`p : *s64 = null;`) and a
|
||||
// A top-level null-pointer global (`p : *i64 = null;`) and a
|
||||
// zero-initialized global both emit as the all-zero constant
|
||||
// of the global's type.
|
||||
.null_val, .zeroinit => c.LLVMConstNull(llvm_ty),
|
||||
@@ -2164,7 +2164,7 @@ pub const LLVMEmitter = struct {
|
||||
if (kind == c.LLVMIntegerTypeKind) {
|
||||
const width = c.LLVMGetIntTypeWidth(ty);
|
||||
if (width < 64) {
|
||||
return c.LLVMBuildSExt(self.builder, val, self.cached_i64, "s64");
|
||||
return c.LLVMBuildSExt(self.builder, val, self.cached_i64, "i64");
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@@ -2198,11 +2198,11 @@ pub const LLVMEmitter = struct {
|
||||
const info = self.ir_mod.types.get(ty);
|
||||
return switch (info) {
|
||||
.signed => |w| switch (w) {
|
||||
8 => TypeId.s8.index(),
|
||||
16 => TypeId.s16.index(),
|
||||
32 => TypeId.s32.index(),
|
||||
64 => TypeId.s64.index(),
|
||||
else => if (w <= 32) TypeId.s32.index() else TypeId.s64.index(),
|
||||
8 => TypeId.i8.index(),
|
||||
16 => TypeId.i16.index(),
|
||||
32 => TypeId.i32.index(),
|
||||
64 => TypeId.i64.index(),
|
||||
else => if (w <= 32) TypeId.i32.index() else TypeId.i64.index(),
|
||||
},
|
||||
.unsigned => |w| switch (w) {
|
||||
8 => TypeId.u8.index(),
|
||||
@@ -2278,7 +2278,7 @@ pub const LLVMEmitter = struct {
|
||||
if (val_w == 1) {
|
||||
return c.LLVMBuildUIToFP(self.builder, val, param_ty, "ca.uitofp");
|
||||
}
|
||||
// Default to SIToFP since most sx integers are signed (s64).
|
||||
// Default to SIToFP since most sx integers are signed (i64).
|
||||
// Explicit unsigned conversions go through the IR widen/narrow path.
|
||||
return c.LLVMBuildSIToFP(self.builder, val, param_ty, "ca.sitofp");
|
||||
}
|
||||
@@ -2386,7 +2386,7 @@ pub const LLVMEmitter = struct {
|
||||
/// Resolve the IR type of a foreign-call argument ref. Every FFI arg ref is
|
||||
/// a real function param or block instruction result, so a `null` here is a
|
||||
/// codegen invariant violation, not a recoverable case: return the dedicated
|
||||
/// `.unresolved` sentinel — never `.void`/`.s64` — so the failure cannot be
|
||||
/// `.unresolved` sentinel — never `.void`/`.i64` — so the failure cannot be
|
||||
/// mistaken for a real type and trips `toLLVMType`'s hard tripwire at the call
|
||||
/// site instead of silently emitting a void-typed foreign argument.
|
||||
pub fn argIRTypeOrFail(self: *LLVMEmitter, arg_ref: Ref) TypeId {
|
||||
@@ -2397,7 +2397,7 @@ pub const LLVMEmitter = struct {
|
||||
/// argument: boxed inside an `Any` aggregate (extract the value field) vs a
|
||||
/// bare i64 `TypeId` index. The IR-type lookup is must-succeed, so it routes
|
||||
/// through `argIRTypeOrFail`; a failed lookup surfaces as `.unresolved` —
|
||||
/// never a silent `.s64` that would mis-classify a boxed arg as bare and read
|
||||
/// never a silent `.i64` that would mis-classify a boxed arg as bare and read
|
||||
/// the wrong value. The caller turns `.unresolved` into a hard tripwire.
|
||||
pub const ReflectArgRepr = enum { boxed, bare, unresolved };
|
||||
|
||||
@@ -2938,7 +2938,7 @@ pub fn isFloatOrVecFloat(ty: TypeId, types: *const TypeTable) bool {
|
||||
|
||||
pub fn isSignedType(ty: TypeId) bool {
|
||||
return switch (ty) {
|
||||
.s8, .s16, .s32, .s64, .isize => true,
|
||||
.i8, .i16, .i32, .i64, .isize => true,
|
||||
else => false,
|
||||
};
|
||||
}
|
||||
@@ -2953,10 +2953,10 @@ fn floatBits(ty: TypeId) u32 {
|
||||
|
||||
fn intBits(ty: TypeId) u32 {
|
||||
return switch (ty) {
|
||||
.s8, .u8 => 8,
|
||||
.s16, .u16 => 16,
|
||||
.s32, .u32 => 32,
|
||||
.s64, .u64 => 64,
|
||||
.i8, .u8 => 8,
|
||||
.i16, .u16 => 16,
|
||||
.i32, .u32 => 32,
|
||||
.i64, .u64 => 64,
|
||||
.bool => 1,
|
||||
.usize, .isize => 0, // target-dependent — caller must query pointer_size
|
||||
else => 64,
|
||||
|
||||
Reference in New Issue
Block a user