Model the return slot as an output parameter (#4432)

Also fix `Param` insts to have meaningful names in pretty-printing, to
help clarify relationship with return slot.
This commit is contained in:
Geoff Romer
2024-10-23 16:53:34 +00:00
committed by GitHub
parent 5038218cea
commit 9266f867f9
463 changed files with 7401 additions and 4939 deletions
+4 -4
View File
@@ -1172,7 +1172,7 @@ static auto ConvertSelf(Context& context, SemIR::LocId call_loc_id,
auto ConvertCallArgs(Context& context, SemIR::LocId call_loc_id,
SemIR::InstId self_id,
llvm::ArrayRef<SemIR::InstId> arg_refs,
SemIR::InstId return_storage_id,
SemIR::InstId return_slot_arg_id,
const CalleeParamsInfo& callee,
SemIR::SpecificId callee_specific_id)
-> SemIR::InstBlockId {
@@ -1187,7 +1187,7 @@ auto ConvertCallArgs(Context& context, SemIR::LocId call_loc_id,
// Start building a block to hold the converted arguments.
llvm::SmallVector<SemIR::InstId> args;
args.reserve(implicit_param_patterns.size() + param_patterns.size() +
return_storage_id.is_valid());
return_slot_arg_id.is_valid());
// Check implicit parameters.
for (auto implicit_param_id : implicit_param_patterns) {
@@ -1241,8 +1241,8 @@ auto ConvertCallArgs(Context& context, SemIR::LocId call_loc_id,
}
// Track the return storage, if present.
if (return_storage_id.is_valid()) {
args.push_back(return_storage_id);
if (return_slot_arg_id.is_valid()) {
args.push_back(return_slot_arg_id);
}
return context.inst_blocks().AddOrEmpty(args);