Remove the builtin IR, and instead define builtin types locally. (#3910)

We don't need it any more, and removing it simplifies a few things:

- One fewer predefined `File` and reserved ID.
- We now have simply `Builtin` instructions for builtins, instead of
having an `ImportRef` that indirectly references a `Builtin`.
- `ConstantId`s now always refer directly to a local constant, instead
of sometimes referring to an `ImportRef` for a constant in the builtins
IR.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Richard Smith
2024-04-24 18:32:59 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 1349cc1e8e
commit 62fe0cd385
79 changed files with 600 additions and 671 deletions
+8 -8
View File
@@ -108,21 +108,21 @@ fn G(c: Impl.C) {
// CHECK:STDOUT: %Impl: <namespace> = namespace [template] {}
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
// CHECK:STDOUT: %import_ref.1 = import_ref ir2, inst+11, unloaded
// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+11, unloaded
// CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [template = constants.%.2] {}
// CHECK:STDOUT: %import_ref.2: <associated <function> in HasF> = import_ref ir2, inst+8, loc_20 [template = constants.%.6]
// CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+4, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir2, inst+6, unloaded
// CHECK:STDOUT: %import_ref.5: <witness> = import_ref ir2, inst+17, loc_22 [template = constants.%.7]
// CHECK:STDOUT: %import_ref.6: type = import_ref ir2, inst+10, loc_10 [template = constants.%C]
// CHECK:STDOUT: %import_ref.2: <associated <function> in HasF> = import_ref ir1, inst+8, loc_20 [template = constants.%.6]
// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+4, unloaded
// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+6, unloaded
// CHECK:STDOUT: %import_ref.5: <witness> = import_ref ir1, inst+17, loc_22 [template = constants.%.7]
// CHECK:STDOUT: %import_ref.6: type = import_ref ir1, inst+10, loc_10 [template = constants.%C]
// CHECK:STDOUT: %G: <function> = fn_decl @G [template] {
// CHECK:STDOUT: %Impl.ref: <namespace> = name_ref Impl, %Impl [template = %Impl]
// CHECK:STDOUT: %C.ref: type = name_ref C, %import_ref.6 [template = constants.%C]
// CHECK:STDOUT: %c.loc4_6.1: C = param c
// CHECK:STDOUT: @G.%c: C = bind_name c, %c.loc4_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.7: type = import_ref ir2, inst+2, loc_18 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+6, unloaded
// CHECK:STDOUT: %import_ref.7: type = import_ref ir1, inst+2, loc_18 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+6, unloaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: interface @HasF {