Model Core.Int as a class type (#4644)

Instead of treating `Core.Int` as the toolchain's builtin `IntType`,
model it as a class that adapts the builtin type. This aligns us better
with the intended language model, gives an associated library for
`impl`s involving `Core.Int` to live within, and opens the door adding
member functions to `Core.Int` if we decide that is desirable.
Remarkably it also seems to make the formatted SemIR a little smaller,
because a call to a generic class generates less IR than a call to a
function.
This commit is contained in:
Richard Smith
2024-12-16 22:19:23 +00:00
committed by GitHub
parent f922988c8c
commit a10c79569e
339 changed files with 7812 additions and 11595 deletions
+3 -3
View File
@@ -23,9 +23,9 @@ fn G() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @_CF.Main(ptr %arr, i32 %i) !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc12_15.4.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i, !dbg !7
// CHECK:STDOUT: %.loc12_15.5 = load i32, ptr %.loc12_15.4.array.index, align 4, !dbg !7
// CHECK:STDOUT: ret i32 %.loc12_15.5, !dbg !8
// CHECK:STDOUT: %.loc12_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i, !dbg !7
// CHECK:STDOUT: %.loc12_15.3 = load i32, ptr %.loc12_15.2.array.index, align 4, !dbg !7
// CHECK:STDOUT: ret i32 %.loc12_15.3, !dbg !8
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @_CG.Main() !dbg !9 {