Switch types to a SemanticsTypeId. (#2854)

This switches types to using SemanticsTypeId instead of SemanticsNodeId, and lowering pre-builds its list of types. The empty tuple type is special-cased because we don't want to emit it unless it's in-use, but as the implicit return for functions, it's frequently used. Callables use invalid to indicate the implicit return, and that seems undesirable to change due to the size increase.
This commit is contained in:
Jon Ross-Perkins
2023-05-26 11:19:49 -07:00
committed by GitHub
parent a2156f5a4b
commit 1497e1333d
71 changed files with 645 additions and 523 deletions
@@ -19,9 +19,15 @@ auto SemanticsNodeStack::PushEntry(Entry entry, DebugLog debug_log) -> void {
case DebugLog::NodeId:
CARBON_VLOG() << entry.node_id;
break;
case DebugLog::NodeBlockId:
CARBON_VLOG() << entry.node_block_id;
break;
case DebugLog::NameId:
CARBON_VLOG() << entry.name_id;
break;
case DebugLog::TypeId:
CARBON_VLOG() << entry.type_id;
break;
}
CARBON_VLOG() << "\n";
CARBON_CHECK(stack_.size() < (1 << 20))
@@ -137,6 +143,13 @@ auto SemanticsNodeStack::PopForNodeBlockId(ParseNodeKind pop_parse_kind)
return back.node_block_id;
}
auto SemanticsNodeStack::PopForTypeId(ParseNodeKind pop_parse_kind)
-> SemanticsTypeId {
auto back = PopEntry(pop_parse_kind);
RequireValidId(back);
return back.type_id;
}
auto SemanticsNodeStack::PopForParseNodeAndNameId(ParseNodeKind pop_parse_kind)
-> std::pair<ParseTree::Node, SemanticsStringId> {
auto back = PopEntry(pop_parse_kind);