handle_type.cpp 1.1 KB

123456789101112131415161718192021222324252627
  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/lower/function_context.h"
  5. #include "toolchain/sem_ir/typed_insts.h"
  6. namespace Carbon::Lower {
  7. // For instructions that are always of type `type`, produce the trivial runtime
  8. // representation of type `type`.
  9. #define CARBON_SEM_IR_INST_KIND_TYPE_NEVER(...)
  10. #define CARBON_SEM_IR_INST_KIND_TYPE_MAYBE(...)
  11. #define CARBON_SEM_IR_INST_KIND_CONSTANT_ALWAYS(...)
  12. #define CARBON_SEM_IR_INST_KIND(Name) \
  13. auto Handle##Name(FunctionContext& context, SemIR::InstId inst_id, \
  14. SemIR::Name /*inst*/) -> void { \
  15. context.SetLocal(inst_id, context.GetTypeAsValue()); \
  16. }
  17. #include "toolchain/sem_ir/inst_kind.def"
  18. auto HandleFacetTypeAccess(FunctionContext& context, SemIR::InstId inst_id,
  19. SemIR::FacetTypeAccess /*inst*/) -> void {
  20. context.SetLocal(inst_id, context.GetTypeAsValue());
  21. }
  22. } // namespace Carbon::Lower