Split a cross-file Lower::Context out of Lower::FileContext. (#5583)

In preparation for lowering information from multiple `SemIR::File`s
into a single `llvm::Module`. The primary purpose of this is to support
lowering a local specific for an imported generic function, where the
instructions for the generic function are in a different file than the
instructions for the specific. See #5475 for a draft PR implementing
that functionality on top of this.

The per-`llvm::Module` state now lives in `Lower::Context`, and
`Lower::FileContext` tracks only the per-`SemIR::File` information.
`Lower::Context` should not mention any `SemIR` IDs that are
file-specific. For now, the C++ lowering and the specific coalescing
logic are kept per-file for simplicity.
This commit is contained in:
Richard Smith
2025-06-02 18:02:32 +00:00
committed by GitHub
parent 0fd129ec95
commit e91840e1b6
9 changed files with 309 additions and 172 deletions
+2 -2
View File
@@ -713,8 +713,8 @@ auto CompilationUnit::RunLower() -> void {
subtrees = cache_->tree_and_subtrees_getters();
}
module_ = Lower::LowerToLLVM(*llvm_context_, driver_env_->fs, subtrees,
input_filename_, *sem_ir_, sem_ir_->cpp_ast(),
&inst_namer, vlog_stream_);
input_filename_, *sem_ir_, &inst_namer,
vlog_stream_);
});
if (vlog_stream_) {
CARBON_VLOG("*** llvm::Module ***\n");