eval.h 1.1 KB

1234567891011121314151617181920212223242526272829
  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. #ifndef CARBON_TOOLCHAIN_CHECK_EVAL_H_
  5. #define CARBON_TOOLCHAIN_CHECK_EVAL_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/sem_ir/ids.h"
  8. #include "toolchain/sem_ir/inst.h"
  9. namespace Carbon::Check {
  10. // Determines the phase of the instruction `inst`, and returns its constant
  11. // value if it has constant phase. If it has runtime phase, returns
  12. // `SemIR::ConstantId::NotConstant`.
  13. auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst)
  14. -> SemIR::ConstantId;
  15. // Evaluates the eval block for a region of a specific. Produces a block
  16. // containing the evaluated constant values of the instructions in the eval
  17. // block.
  18. auto TryEvalBlockForSpecific(Context& context, SemIR::SpecificId specific_id,
  19. SemIR::GenericInstIndex::Region region)
  20. -> SemIR::InstBlockId;
  21. } // namespace Carbon::Check
  22. #endif // CARBON_TOOLCHAIN_CHECK_EVAL_H_