Refactor ReturnTypeInfo and InitRepr. (#4169)

Rename `ReturnInfo` to `ReturnTypeInfo`. Move it and `InitRepr` into
`type_info.h` alongside `ValueRepr`. Replace `ReturnSlot` with
`InitRepr`, and extend `InitRepr` to be able to represent the
incomplete-type case instead of CHECK-failing. Remove `has_return_slot`
from `InitRepr` and instead only provide that as part of
`ReturnTypeInfo`.
This commit is contained in:
Richard Smith
2024-07-25 21:41:33 +00:00
committed by GitHub
parent 2ef1d1f8b9
commit 37a8bfa488
19 changed files with 194 additions and 194 deletions
+3 -2
View File
@@ -312,14 +312,15 @@ auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,
std::vector<llvm::Value*> args;
if (SemIR::GetInitRepr(context.sem_ir(), inst.type_id).has_return_slot()) {
if (SemIR::ReturnTypeInfo::ForType(context.sem_ir(), inst.type_id)
.has_return_slot()) {
args.push_back(context.GetValue(arg_ids.back()));
arg_ids = arg_ids.drop_back();
}
for (auto arg_id : arg_ids) {
auto arg_type_id = context.sem_ir().insts().Get(arg_id).type_id();
if (SemIR::GetValueRepr(context.sem_ir(), arg_type_id).kind !=
if (SemIR::ValueRepr::ForType(context.sem_ir(), arg_type_id).kind !=
SemIR::ValueRepr::None) {
args.push_back(context.GetValue(arg_id));
}