mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Remove all remaining uses of TypeIds as instruction operands. (#5280)
In preparation for shifting from `TypeId`s potentially representing attached types to always representing unattached types, using [terminology suggested on Discord](https://discord.com/channels/655572317891461132/963846118964350976/1359286326779973712). This change causes us to track slightly more type spelling information through SemIR. One change that has significant impact on the SemIR output is that we now build a `struct_type` instruction in each class representing the types of the fields, including the spelling used for those types. This is now no longer always identical to the corresponding canonical `struct_type` for the object representation, so it's built separately and owned by the class. Also remove `TypeBlock` support entirely, as its only use was representing `TupleType`s, which now use an `InstBlock`.
This commit is contained in:
@@ -103,7 +103,7 @@ class DeductionWorklist {
|
||||
}
|
||||
for (auto [param, arg] :
|
||||
llvm::reverse(llvm::zip_equal(param_fields, arg_fields))) {
|
||||
Add(param.type_id, arg.type_id, needs_substitution);
|
||||
Add(param.type_inst_id, arg.type_inst_id, needs_substitution);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,12 +113,6 @@ class DeductionWorklist {
|
||||
context_->inst_blocks().Get(args), needs_substitution);
|
||||
}
|
||||
|
||||
auto AddAll(SemIR::TypeBlockId params, SemIR::TypeBlockId args,
|
||||
bool needs_substitution) -> void {
|
||||
AddAll(context_->type_blocks().Get(params),
|
||||
context_->type_blocks().Get(args), needs_substitution);
|
||||
}
|
||||
|
||||
// Adds a (param, arg) pair for an instruction argument, given its kind.
|
||||
auto AddInstArg(SemIR::Inst::ArgAndKind param, int32_t arg,
|
||||
bool needs_substitution) -> void {
|
||||
@@ -136,10 +130,6 @@ class DeductionWorklist {
|
||||
Add(inst_id, SemIR::InstId(arg), needs_substitution);
|
||||
break;
|
||||
}
|
||||
case CARBON_KIND(SemIR::TypeId type_id): {
|
||||
Add(type_id, SemIR::TypeId(arg), needs_substitution);
|
||||
break;
|
||||
}
|
||||
case CARBON_KIND(SemIR::StructTypeFieldsId fields_id): {
|
||||
AddAll(fields_id, SemIR::StructTypeFieldsId(arg), needs_substitution);
|
||||
break;
|
||||
@@ -148,10 +138,6 @@ class DeductionWorklist {
|
||||
AddAll(inst_block_id, SemIR::InstBlockId(arg), needs_substitution);
|
||||
break;
|
||||
}
|
||||
case CARBON_KIND(SemIR::TypeBlockId type_block_id): {
|
||||
AddAll(type_block_id, SemIR::TypeBlockId(arg), needs_substitution);
|
||||
break;
|
||||
}
|
||||
case CARBON_KIND(SemIR::SpecificId specific_id): {
|
||||
Add(specific_id, SemIR::SpecificId(arg), needs_substitution);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user