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:
@@ -26,17 +26,17 @@ test "print simple add function" {
|
||||
const name_entry = module.types.internString("entry");
|
||||
|
||||
const params = &[_]Function.Param{
|
||||
.{ .name = name_a, .ty = .s64 },
|
||||
.{ .name = name_b, .ty = .s64 },
|
||||
.{ .name = name_a, .ty = .i64 },
|
||||
.{ .name = name_b, .ty = .i64 },
|
||||
};
|
||||
_ = b.beginFunction(name_add, params, .s64);
|
||||
_ = b.beginFunction(name_add, params, .i64);
|
||||
const entry = b.appendBlock(name_entry, &.{});
|
||||
b.switchToBlock(entry);
|
||||
|
||||
const a_ref = b.constInt(10, .s64);
|
||||
const b_ref = b.constInt(20, .s64);
|
||||
const sum = b.add(a_ref, b_ref, .s64);
|
||||
b.ret(sum, .s64);
|
||||
const a_ref = b.constInt(10, .i64);
|
||||
const b_ref = b.constInt(20, .i64);
|
||||
const sum = b.add(a_ref, b_ref, .i64);
|
||||
b.ret(sum, .i64);
|
||||
b.finalize();
|
||||
|
||||
var aw = std.Io.Writer.Allocating.init(alloc);
|
||||
@@ -45,11 +45,11 @@ test "print simple add function" {
|
||||
defer result.deinit(alloc);
|
||||
|
||||
const output = result.items;
|
||||
try std.testing.expect(std.mem.indexOf(u8, output, "func @add(a: s64, b: s64) -> s64") != null);
|
||||
try std.testing.expect(std.mem.indexOf(u8, output, "func @add(a: i64, b: i64) -> i64") != null);
|
||||
try std.testing.expect(std.mem.indexOf(u8, output, "entry:") != null);
|
||||
try std.testing.expect(std.mem.indexOf(u8, output, "const 10 : s64") != null);
|
||||
try std.testing.expect(std.mem.indexOf(u8, output, "const 10 : i64") != null);
|
||||
// Params occupy value slots %0/%1, so the two consts are %2/%3 and their sum %4.
|
||||
try std.testing.expect(std.mem.indexOf(u8, output, "add %2, %3 : s64") != null);
|
||||
try std.testing.expect(std.mem.indexOf(u8, output, "add %2, %3 : i64") != null);
|
||||
try std.testing.expect(std.mem.indexOf(u8, output, "ret %4") != null);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ test "print conditional branch" {
|
||||
|
||||
var b = Builder.init(&module);
|
||||
|
||||
_ = b.beginFunction(module.types.internString("test"), &.{}, .s32);
|
||||
_ = b.beginFunction(module.types.internString("test"), &.{}, .i32);
|
||||
const entry = b.appendBlock(module.types.internString("entry"), &.{});
|
||||
const then_bb = b.appendBlock(module.types.internString("then"), &.{});
|
||||
const else_bb = b.appendBlock(module.types.internString("else"), &.{});
|
||||
@@ -70,12 +70,12 @@ test "print conditional branch" {
|
||||
b.condBr(cond, then_bb, &.{}, else_bb, &.{});
|
||||
|
||||
b.switchToBlock(then_bb);
|
||||
const v1 = b.constInt(1, .s32);
|
||||
b.ret(v1, .s32);
|
||||
const v1 = b.constInt(1, .i32);
|
||||
b.ret(v1, .i32);
|
||||
|
||||
b.switchToBlock(else_bb);
|
||||
const v2 = b.constInt(0, .s32);
|
||||
b.ret(v2, .s32);
|
||||
const v2 = b.constInt(0, .i32);
|
||||
b.ret(v2, .i32);
|
||||
b.finalize();
|
||||
|
||||
var aw = std.Io.Writer.Allocating.init(alloc);
|
||||
|
||||
Reference in New Issue
Block a user