file.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "toolchain/sem_ir/file.h"
  5. #include "common/check.h"
  6. #include "llvm/ADT/STLExtras.h"
  7. #include "llvm/ADT/SmallVector.h"
  8. #include "toolchain/base/value_store.h"
  9. #include "toolchain/base/yaml.h"
  10. #include "toolchain/sem_ir/builtin_kind.h"
  11. #include "toolchain/sem_ir/ids.h"
  12. #include "toolchain/sem_ir/inst.h"
  13. #include "toolchain/sem_ir/inst_kind.h"
  14. #include "toolchain/sem_ir/typed_insts.h"
  15. namespace Carbon::SemIR {
  16. auto Function::GetParamFromParamRefId(const File& sem_ir, InstId param_ref_id)
  17. -> std::pair<InstId, Param> {
  18. auto ref = sem_ir.insts().Get(param_ref_id);
  19. if (auto addr_pattern = ref.TryAs<SemIR::AddrPattern>()) {
  20. param_ref_id = addr_pattern->inner_id;
  21. ref = sem_ir.insts().Get(param_ref_id);
  22. }
  23. if (auto bind_name = ref.TryAs<SemIR::AnyBindName>()) {
  24. param_ref_id = bind_name->value_id;
  25. ref = sem_ir.insts().Get(param_ref_id);
  26. }
  27. return {param_ref_id, ref.As<SemIR::Param>()};
  28. }
  29. auto ValueRepr::Print(llvm::raw_ostream& out) const -> void {
  30. out << "{kind: ";
  31. switch (kind) {
  32. case Unknown:
  33. out << "unknown";
  34. break;
  35. case None:
  36. out << "none";
  37. break;
  38. case Copy:
  39. out << "copy";
  40. break;
  41. case Pointer:
  42. out << "pointer";
  43. break;
  44. case Custom:
  45. out << "custom";
  46. break;
  47. }
  48. out << ", type: " << type_id << "}";
  49. }
  50. auto TypeInfo::Print(llvm::raw_ostream& out) const -> void {
  51. out << "{constant: " << constant_id << ", value_rep: " << value_repr << "}";
  52. }
  53. File::File(SharedValueStores& value_stores)
  54. : value_stores_(&value_stores),
  55. filename_("<builtins>"),
  56. type_blocks_(allocator_),
  57. inst_blocks_(allocator_),
  58. constants_(*this, allocator_) {
  59. auto builtins_id = import_irs_.Add(this);
  60. CARBON_CHECK(builtins_id == ImportIRId::Builtins)
  61. << "Builtins must be the first IR, even if self-referential";
  62. insts_.Reserve(BuiltinKind::ValidCount);
  63. // Error uses a self-referential type so that it's not accidentally treated as
  64. // a normal type. Every other builtin is a type, including the
  65. // self-referential TypeType.
  66. #define CARBON_SEM_IR_BUILTIN_KIND(Name, ...) \
  67. insts_.AddInNoBlock( \
  68. {Builtin{BuiltinKind::Name == BuiltinKind::Error ? TypeId::Error \
  69. : TypeId::TypeType, \
  70. BuiltinKind::Name}});
  71. #include "toolchain/sem_ir/builtin_kind.def"
  72. for (auto [i, inst] : llvm::enumerate(insts_.array_ref())) {
  73. auto builtin_id = SemIR::InstId(i);
  74. constant_values_.Set(builtin_id,
  75. SemIR::ConstantId::ForTemplateConstant(builtin_id));
  76. }
  77. CARBON_CHECK(insts_.size() == BuiltinKind::ValidCount)
  78. << "Builtins should produce " << BuiltinKind::ValidCount
  79. << " insts, actual: " << insts_.size();
  80. }
  81. File::File(SharedValueStores& value_stores, std::string filename,
  82. const File* builtins)
  83. : value_stores_(&value_stores),
  84. filename_(std::move(filename)),
  85. type_blocks_(allocator_),
  86. inst_blocks_(allocator_),
  87. constants_(*this, allocator_) {
  88. CARBON_CHECK(builtins != nullptr);
  89. auto builtins_id = import_irs_.Add(builtins);
  90. CARBON_CHECK(builtins_id == ImportIRId::Builtins)
  91. << "Builtins must be the first IR";
  92. // Copy builtins over.
  93. insts_.Reserve(BuiltinKind::ValidCount);
  94. for (auto [i, inst] : llvm::enumerate(builtins->insts_.array_ref())) {
  95. // We can reuse the type IDs from the builtins IR because they're
  96. // special-cased values.
  97. auto type_id = inst.type_id();
  98. auto builtin_id = SemIR::InstId(i);
  99. insts_.AddInNoBlock(
  100. {ImportRefUsed{type_id, ImportIRId::Builtins, builtin_id}});
  101. constant_values_.Set(builtin_id,
  102. SemIR::ConstantId::ForTemplateConstant(builtin_id));
  103. }
  104. }
  105. auto File::Verify() const -> ErrorOr<Success> {
  106. // Invariants don't necessarily hold for invalid IR.
  107. if (has_errors_) {
  108. return Success();
  109. }
  110. // Check that every code block has a terminator sequence that appears at the
  111. // end of the block.
  112. for (const Function& function : functions_.array_ref()) {
  113. for (InstBlockId block_id : function.body_block_ids) {
  114. TerminatorKind prior_kind = TerminatorKind::NotTerminator;
  115. for (InstId inst_id : inst_blocks().Get(block_id)) {
  116. TerminatorKind inst_kind =
  117. insts().Get(inst_id).kind().terminator_kind();
  118. if (prior_kind == TerminatorKind::Terminator) {
  119. return Error(llvm::formatv("Inst {0} in block {1} follows terminator",
  120. inst_id, block_id));
  121. }
  122. if (prior_kind > inst_kind) {
  123. return Error(
  124. llvm::formatv("Non-terminator inst {0} in block {1} follows "
  125. "terminator sequence",
  126. inst_id, block_id));
  127. }
  128. prior_kind = inst_kind;
  129. }
  130. if (prior_kind != TerminatorKind::Terminator) {
  131. return Error(llvm::formatv("No terminator in block {0}", block_id));
  132. }
  133. }
  134. }
  135. // TODO: Check that an instruction only references other instructions that are
  136. // either global or that dominate it.
  137. return Success();
  138. }
  139. auto File::OutputYaml(bool include_builtins) const -> Yaml::OutputMapping {
  140. return Yaml::OutputMapping([this,
  141. include_builtins](Yaml::OutputMapping::Map map) {
  142. map.Add("filename", filename_);
  143. map.Add(
  144. "sem_ir", Yaml::OutputMapping([&](Yaml::OutputMapping::Map map) {
  145. map.Add("import_irs_size", Yaml::OutputScalar(import_irs_.size()));
  146. map.Add("name_scopes", name_scopes_.OutputYaml());
  147. map.Add("bind_names", bind_names_.OutputYaml());
  148. map.Add("functions", functions_.OutputYaml());
  149. map.Add("classes", classes_.OutputYaml());
  150. map.Add("types", types_.OutputYaml());
  151. map.Add("type_blocks", type_blocks_.OutputYaml());
  152. map.Add("insts",
  153. Yaml::OutputMapping([&](Yaml::OutputMapping::Map map) {
  154. int start = include_builtins ? 0 : BuiltinKind::ValidCount;
  155. for (int i : llvm::seq(start, insts_.size())) {
  156. auto id = InstId(i);
  157. map.Add(PrintToString(id),
  158. Yaml::OutputScalar(insts_.Get(id)));
  159. }
  160. }));
  161. map.Add("constant_values",
  162. Yaml::OutputMapping([&](Yaml::OutputMapping::Map map) {
  163. int start = include_builtins ? 0 : BuiltinKind::ValidCount;
  164. for (int i : llvm::seq(start, insts_.size())) {
  165. auto id = InstId(i);
  166. auto value = constant_values_.Get(id);
  167. if (value.is_constant()) {
  168. map.Add(PrintToString(id), Yaml::OutputScalar(value));
  169. }
  170. }
  171. }));
  172. map.Add("inst_blocks", inst_blocks_.OutputYaml());
  173. }));
  174. });
  175. }
  176. // Map an instruction kind representing a type into an integer describing the
  177. // precedence of that type's syntax. Higher numbers correspond to higher
  178. // precedence.
  179. static auto GetTypePrecedence(InstKind kind) -> int {
  180. switch (kind) {
  181. case ArrayType::Kind:
  182. case BindSymbolicName::Kind:
  183. case Builtin::Kind:
  184. case ClassType::Kind:
  185. case ImportRefUsed::Kind:
  186. case InterfaceType::Kind:
  187. case NameRef::Kind:
  188. case StructType::Kind:
  189. case TupleType::Kind:
  190. case UnboundElementType::Kind:
  191. return 0;
  192. case ConstType::Kind:
  193. return -1;
  194. case PointerType::Kind:
  195. return -2;
  196. case AddrOf::Kind:
  197. case AddrPattern::Kind:
  198. case ArrayIndex::Kind:
  199. case ArrayInit::Kind:
  200. case Assign::Kind:
  201. case BaseDecl::Kind:
  202. case BindName::Kind:
  203. case BindValue::Kind:
  204. case BlockArg::Kind:
  205. case BoolLiteral::Kind:
  206. case BoundMethod::Kind:
  207. case Branch::Kind:
  208. case BranchIf::Kind:
  209. case BranchWithArg::Kind:
  210. case Call::Kind:
  211. case ClassDecl::Kind:
  212. case ClassElementAccess::Kind:
  213. case ClassInit::Kind:
  214. case Converted::Kind:
  215. case Deref::Kind:
  216. case FieldDecl::Kind:
  217. case FunctionDecl::Kind:
  218. case Import::Kind:
  219. case ImportRefUnused::Kind:
  220. case InitializeFrom::Kind:
  221. case InterfaceDecl::Kind:
  222. case IntLiteral::Kind:
  223. case Namespace::Kind:
  224. case Param::Kind:
  225. case RealLiteral::Kind:
  226. case Return::Kind:
  227. case ReturnExpr::Kind:
  228. case SpliceBlock::Kind:
  229. case StringLiteral::Kind:
  230. case StructAccess::Kind:
  231. case StructTypeField::Kind:
  232. case StructLiteral::Kind:
  233. case StructInit::Kind:
  234. case StructValue::Kind:
  235. case Temporary::Kind:
  236. case TemporaryStorage::Kind:
  237. case TupleAccess::Kind:
  238. case TupleIndex::Kind:
  239. case TupleLiteral::Kind:
  240. case TupleInit::Kind:
  241. case TupleValue::Kind:
  242. case UnaryOperatorNot::Kind:
  243. case ValueAsRef::Kind:
  244. case ValueOfInitializer::Kind:
  245. case VarStorage::Kind:
  246. CARBON_FATAL() << "GetTypePrecedence for non-type inst kind " << kind;
  247. }
  248. }
  249. auto File::StringifyType(TypeId type_id) const -> std::string {
  250. return StringifyTypeExpr(types().GetInstId(type_id));
  251. }
  252. auto File::StringifyTypeExpr(InstId outer_inst_id) const -> std::string {
  253. std::string str;
  254. llvm::raw_string_ostream out(str);
  255. struct Step {
  256. // The instruction to print.
  257. InstId inst_id;
  258. // The index into inst_id to print. Not used by all types.
  259. int index = 0;
  260. auto Next() const -> Step {
  261. return {.inst_id = inst_id, .index = index + 1};
  262. }
  263. };
  264. llvm::SmallVector<Step> steps = {{.inst_id = outer_inst_id}};
  265. while (!steps.empty()) {
  266. auto step = steps.pop_back_val();
  267. if (!step.inst_id.is_valid()) {
  268. out << "<invalid type>";
  269. continue;
  270. }
  271. // Builtins have designated labels.
  272. if (step.inst_id.is_builtin()) {
  273. out << step.inst_id.builtin_kind().label();
  274. continue;
  275. }
  276. auto inst = insts().Get(step.inst_id);
  277. switch (inst.kind()) {
  278. case ArrayType::Kind: {
  279. auto array = inst.As<ArrayType>();
  280. if (step.index == 0) {
  281. out << "[";
  282. steps.push_back(step.Next());
  283. steps.push_back(
  284. {.inst_id = types().GetInstId(array.element_type_id)});
  285. } else if (step.index == 1) {
  286. out << "; " << GetArrayBoundValue(array.bound_id) << "]";
  287. }
  288. break;
  289. }
  290. case BindSymbolicName::Kind: {
  291. auto name_id = inst.As<BindSymbolicName>().bind_name_id;
  292. out << names().GetFormatted(bind_names().Get(name_id).name_id);
  293. break;
  294. }
  295. case ClassType::Kind: {
  296. auto class_name_id =
  297. classes().Get(inst.As<ClassType>().class_id).name_id;
  298. out << names().GetFormatted(class_name_id);
  299. break;
  300. }
  301. case ConstType::Kind: {
  302. if (step.index == 0) {
  303. out << "const ";
  304. // Add parentheses if required.
  305. auto inner_type_inst_id =
  306. types().GetInstId(inst.As<ConstType>().inner_id);
  307. if (GetTypePrecedence(insts().Get(inner_type_inst_id).kind()) <
  308. GetTypePrecedence(inst.kind())) {
  309. out << "(";
  310. steps.push_back(step.Next());
  311. }
  312. steps.push_back({.inst_id = inner_type_inst_id});
  313. } else if (step.index == 1) {
  314. out << ")";
  315. }
  316. break;
  317. }
  318. case ImportRefUsed::Kind:
  319. out << "<TODO: ImportRefUsed " << step.inst_id << ">";
  320. break;
  321. case InterfaceType::Kind: {
  322. auto interface_name_id =
  323. interfaces().Get(inst.As<InterfaceType>().interface_id).name_id;
  324. out << names().GetFormatted(interface_name_id);
  325. break;
  326. }
  327. case NameRef::Kind: {
  328. out << names().GetFormatted(inst.As<NameRef>().name_id);
  329. break;
  330. }
  331. case PointerType::Kind: {
  332. if (step.index == 0) {
  333. steps.push_back(step.Next());
  334. steps.push_back({.inst_id = types().GetInstId(
  335. inst.As<PointerType>().pointee_id)});
  336. } else if (step.index == 1) {
  337. out << "*";
  338. }
  339. break;
  340. }
  341. case StructType::Kind: {
  342. auto refs = inst_blocks().Get(inst.As<StructType>().fields_id);
  343. if (refs.empty()) {
  344. out << "{}";
  345. break;
  346. } else if (step.index == 0) {
  347. out << "{";
  348. } else if (step.index < static_cast<int>(refs.size())) {
  349. out << ", ";
  350. } else {
  351. out << "}";
  352. break;
  353. }
  354. steps.push_back(step.Next());
  355. steps.push_back({.inst_id = refs[step.index]});
  356. break;
  357. }
  358. case StructTypeField::Kind: {
  359. auto field = inst.As<StructTypeField>();
  360. out << "." << names().GetFormatted(field.name_id) << ": ";
  361. steps.push_back({.inst_id = types().GetInstId(field.field_type_id)});
  362. break;
  363. }
  364. case TupleType::Kind: {
  365. auto refs = type_blocks().Get(inst.As<TupleType>().elements_id);
  366. if (refs.empty()) {
  367. out << "()";
  368. break;
  369. } else if (step.index == 0) {
  370. out << "(";
  371. } else if (step.index < static_cast<int>(refs.size())) {
  372. out << ", ";
  373. } else {
  374. // A tuple of one element has a comma to disambiguate from an
  375. // expression.
  376. if (step.index == 1) {
  377. out << ",";
  378. }
  379. out << ")";
  380. break;
  381. }
  382. steps.push_back(step.Next());
  383. steps.push_back({.inst_id = types().GetInstId(refs[step.index])});
  384. break;
  385. }
  386. case UnboundElementType::Kind: {
  387. if (step.index == 0) {
  388. out << "<unbound element of class ";
  389. steps.push_back(step.Next());
  390. steps.push_back({.inst_id = types().GetInstId(
  391. inst.As<UnboundElementType>().class_type_id)});
  392. } else {
  393. out << ">";
  394. }
  395. break;
  396. }
  397. case AddrOf::Kind:
  398. case AddrPattern::Kind:
  399. case ArrayIndex::Kind:
  400. case ArrayInit::Kind:
  401. case Assign::Kind:
  402. case BaseDecl::Kind:
  403. case BindName::Kind:
  404. case BindValue::Kind:
  405. case BlockArg::Kind:
  406. case BoolLiteral::Kind:
  407. case BoundMethod::Kind:
  408. case Branch::Kind:
  409. case BranchIf::Kind:
  410. case BranchWithArg::Kind:
  411. case Builtin::Kind:
  412. case Call::Kind:
  413. case ClassDecl::Kind:
  414. case ClassElementAccess::Kind:
  415. case ClassInit::Kind:
  416. case Converted::Kind:
  417. case Deref::Kind:
  418. case FieldDecl::Kind:
  419. case FunctionDecl::Kind:
  420. case Import::Kind:
  421. case ImportRefUnused::Kind:
  422. case InitializeFrom::Kind:
  423. case InterfaceDecl::Kind:
  424. case IntLiteral::Kind:
  425. case Namespace::Kind:
  426. case Param::Kind:
  427. case RealLiteral::Kind:
  428. case Return::Kind:
  429. case ReturnExpr::Kind:
  430. case SpliceBlock::Kind:
  431. case StringLiteral::Kind:
  432. case StructAccess::Kind:
  433. case StructLiteral::Kind:
  434. case StructInit::Kind:
  435. case StructValue::Kind:
  436. case Temporary::Kind:
  437. case TemporaryStorage::Kind:
  438. case TupleAccess::Kind:
  439. case TupleIndex::Kind:
  440. case TupleLiteral::Kind:
  441. case TupleInit::Kind:
  442. case TupleValue::Kind:
  443. case UnaryOperatorNot::Kind:
  444. case ValueAsRef::Kind:
  445. case ValueOfInitializer::Kind:
  446. case VarStorage::Kind:
  447. // We don't need to handle stringification for instructions that don't
  448. // show up in errors, but make it clear what's going on so that it's
  449. // clearer when stringification is needed.
  450. out << "<cannot stringify " << step.inst_id << ">";
  451. break;
  452. }
  453. }
  454. return str;
  455. }
  456. auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory {
  457. const File* ir = &file;
  458. // The overall expression category if the current instruction is a value
  459. // expression.
  460. ExprCategory value_category = ExprCategory::Value;
  461. while (true) {
  462. auto inst = ir->insts().Get(inst_id);
  463. switch (inst.kind()) {
  464. case Assign::Kind:
  465. case BaseDecl::Kind:
  466. case Branch::Kind:
  467. case BranchIf::Kind:
  468. case BranchWithArg::Kind:
  469. case ClassDecl::Kind:
  470. case FieldDecl::Kind:
  471. case FunctionDecl::Kind:
  472. case Import::Kind:
  473. case ImportRefUnused::Kind:
  474. case InterfaceDecl::Kind:
  475. case Namespace::Kind:
  476. case Return::Kind:
  477. case ReturnExpr::Kind:
  478. case StructTypeField::Kind:
  479. return ExprCategory::NotExpr;
  480. case ImportRefUsed::Kind: {
  481. auto import_ref = inst.As<ImportRefUsed>();
  482. ir = ir->import_irs().Get(import_ref.ir_id);
  483. inst_id = import_ref.inst_id;
  484. continue;
  485. }
  486. case NameRef::Kind: {
  487. inst_id = inst.As<NameRef>().value_id;
  488. continue;
  489. }
  490. case Converted::Kind: {
  491. inst_id = inst.As<Converted>().result_id;
  492. continue;
  493. }
  494. case AddrOf::Kind:
  495. case AddrPattern::Kind:
  496. case ArrayType::Kind:
  497. case BindSymbolicName::Kind:
  498. case BindValue::Kind:
  499. case BlockArg::Kind:
  500. case BoolLiteral::Kind:
  501. case BoundMethod::Kind:
  502. case ClassType::Kind:
  503. case ConstType::Kind:
  504. case InterfaceType::Kind:
  505. case IntLiteral::Kind:
  506. case Param::Kind:
  507. case PointerType::Kind:
  508. case RealLiteral::Kind:
  509. case StringLiteral::Kind:
  510. case StructValue::Kind:
  511. case StructType::Kind:
  512. case TupleValue::Kind:
  513. case TupleType::Kind:
  514. case UnaryOperatorNot::Kind:
  515. case UnboundElementType::Kind:
  516. case ValueOfInitializer::Kind:
  517. return value_category;
  518. case Builtin::Kind: {
  519. if (inst.As<Builtin>().builtin_kind == BuiltinKind::Error) {
  520. return ExprCategory::Error;
  521. }
  522. return value_category;
  523. }
  524. case BindName::Kind: {
  525. inst_id = inst.As<BindName>().value_id;
  526. continue;
  527. }
  528. case ArrayIndex::Kind: {
  529. inst_id = inst.As<ArrayIndex>().array_id;
  530. continue;
  531. }
  532. case ClassElementAccess::Kind: {
  533. inst_id = inst.As<ClassElementAccess>().base_id;
  534. // A value of class type is a pointer to an object representation.
  535. // Therefore, if the base is a value, the result is an ephemeral
  536. // reference.
  537. value_category = ExprCategory::EphemeralRef;
  538. continue;
  539. }
  540. case StructAccess::Kind: {
  541. inst_id = inst.As<StructAccess>().struct_id;
  542. continue;
  543. }
  544. case TupleAccess::Kind: {
  545. inst_id = inst.As<TupleAccess>().tuple_id;
  546. continue;
  547. }
  548. case TupleIndex::Kind: {
  549. inst_id = inst.As<TupleIndex>().tuple_id;
  550. continue;
  551. }
  552. case SpliceBlock::Kind: {
  553. inst_id = inst.As<SpliceBlock>().result_id;
  554. continue;
  555. }
  556. case StructLiteral::Kind:
  557. case TupleLiteral::Kind:
  558. return ExprCategory::Mixed;
  559. case ArrayInit::Kind:
  560. case Call::Kind:
  561. case InitializeFrom::Kind:
  562. case ClassInit::Kind:
  563. case StructInit::Kind:
  564. case TupleInit::Kind:
  565. return ExprCategory::Initializing;
  566. case Deref::Kind:
  567. case VarStorage::Kind:
  568. return ExprCategory::DurableRef;
  569. case Temporary::Kind:
  570. case TemporaryStorage::Kind:
  571. case ValueAsRef::Kind:
  572. return ExprCategory::EphemeralRef;
  573. }
  574. }
  575. }
  576. auto GetInitRepr(const File& file, TypeId type_id) -> InitRepr {
  577. auto value_rep = GetValueRepr(file, type_id);
  578. switch (value_rep.kind) {
  579. case ValueRepr::None:
  580. return {.kind = InitRepr::None};
  581. case ValueRepr::Copy:
  582. // TODO: Use in-place initialization for types that have non-trivial
  583. // destructive move.
  584. return {.kind = InitRepr::ByCopy};
  585. case ValueRepr::Pointer:
  586. case ValueRepr::Custom:
  587. return {.kind = InitRepr::InPlace};
  588. case ValueRepr::Unknown:
  589. CARBON_FATAL()
  590. << "Attempting to perform initialization of incomplete type";
  591. }
  592. }
  593. } // namespace Carbon::SemIR