mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 21:28:10 +00:00
Place the computation of the destination of an initialization into the return slot. (#3252)
Fix a bug where we would perform the computation of the return location in SemIR after we have already used it in some cases, leading to assertion failures during lowering. Instead, accumulate a sequence of instructions to compute the return location in a temporary block, and overwrite the return slot with those instructions when we perform initialization. StubReference is replaced by a more general SpliceBlock node, that takes a code block and a result value, executes the instructions in the block, and produces the result. This is used in the uncommon case where more than one instruction is required to compute the return slot, which can happen if we need to first emit a temporary and then index into it, or if we need to perform multiple levels of indexing before we reach an entity to initialize.
This commit is contained in:
1 parent
58c106010c
commit
491fa1bdd5
42 files changed
+670
-339
No files matched your search
@@ -53,6 +53,12 @@ auto NodeBlockStack::Pop() -> SemIR::NodeBlockId {
|
||||
return back.id;
|
||||
}
|
||||
|
||||
auto NodeBlockStack::PopAndDiscard() -> void {
|
||||
CARBON_CHECK(!empty()) << "no current block";
|
||||
--size_;
|
||||
CARBON_VLOG() << name_ << " PopAndDiscard " << size_ << "\n";
|
||||
}
|
||||
|
||||
auto NodeBlockStack::PrintForStackDump(llvm::raw_ostream& output) const
|
||||
-> void {
|
||||
output << name_ << ":\n";
|
||||
|
||||
Reference in new issue
Block a user