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
@@ -94,10 +94,10 @@ fn TestOp(a: C) -> C {
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
// CHECK:STDOUT: %import_ref.1: type = import_ref ir3, inst+1, loc_18 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.2: <associated <function> in BitComplement> = import_ref ir3, inst+16, loc_50 [template = constants.%.8]
// CHECK:STDOUT: %import_ref.3 = import_ref ir3, inst+3, unloaded
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir3, inst+14, loc_19 [template = imports.%Op]
// CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.2: <associated <function> in BitComplement> = import_ref ir2, inst+16, loc_50 [template = constants.%.8]
// CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir2, inst+14, loc_19 [template = imports.%Op]
// CHECK:STDOUT: impl_decl @impl {
// CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C]
// CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, %Core [template = %Core]
@@ -111,8 +111,8 @@ fn TestOp(a: C) -> C {
// CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, %C.decl [template = constants.%C]
// CHECK:STDOUT: @TestOp.%return: ref C = var <return slot>
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.5: type = import_ref ir3, inst+1, loc_50 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.6 = import_ref ir3, inst+14, unloaded
// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+1, loc_50 [template = constants.%.2]
// CHECK:STDOUT: %import_ref.6 = import_ref ir2, inst+14, unloaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: interface @BitComplement {