CrossRefIRId -> ImportIRId (#3662)

One more (hopefully last) rename on the Import instruction renaming.

I was kind of tempted to rename to just "IRId", since the IRs aren't all
imports. However, this felt easier to read, and a better choice than
CrossRef because it's more consistent with the other ways imports exist
in code. (even if IRs aren't all imports, most use-cases are derived
from imports)

Note though that import_irs may include IRs not just from direct
imports. Beyond the builtin IR, I'm thinking that for indirect imports,
or the prelude, we may end up adding them. e.g., so that constants can
be generated for indirect imports and still correspond to a directly
known IR, and for a given IR that's indirectly imported multiple times
to be deduplicated locally. I'm not there yet, I'm just mentioning this
to help give background for naming thoughts.
This commit is contained in:
Jon Ross-Perkins
2024-01-29 23:05:47 +00:00
committed by GitHub
parent bf02d1f4b0
commit 7f11012f58
15 changed files with 48 additions and 50 deletions
+3 -3
View File
@@ -85,7 +85,7 @@ static auto CacheCopiedNamespace(
static auto CopySingleNameScopeFromImportIR(
Context& context,
llvm::DenseMap<SemIR::NameScopeId, SemIR::NameScopeId>& copied_namespaces,
SemIR::CrossRefIRId ir_id, SemIR::InstId import_inst_id,
SemIR::ImportIRId ir_id, SemIR::InstId import_inst_id,
SemIR::NameScopeId import_scope_id, SemIR::NameScopeId enclosing_scope_id,
SemIR::NameId name_id, SemIR::TypeId namespace_type_id)
-> SemIR::NameScopeId {
@@ -132,7 +132,7 @@ static auto CopySingleNameScopeFromImportIR(
// import_enclosing_scope_id.
static auto CopyEnclosingNameScopesFromImportIR(
Context& context, SemIR::TypeId namespace_type_id,
const SemIR::File& import_sem_ir, SemIR::CrossRefIRId ir_id,
const SemIR::File& import_sem_ir, SemIR::ImportIRId ir_id,
SemIR::NameScopeId import_enclosing_scope_id,
llvm::DenseMap<SemIR::NameScopeId, SemIR::NameScopeId>& copied_namespaces)
-> SemIR::NameScopeId {
@@ -181,7 +181,7 @@ static auto CopyEnclosingNameScopesFromImportIR(
auto Import(Context& context, SemIR::TypeId namespace_type_id,
const SemIR::File& import_sem_ir) -> void {
auto ir_id = context.cross_ref_irs().Add(&import_sem_ir);
auto ir_id = context.import_irs().Add(&import_sem_ir);
for (const auto import_inst_id :
import_sem_ir.inst_blocks().Get(SemIR::InstBlockId::Exports)) {