eval.h 799 B

123456789101112131415161718192021222324
  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. //
  14. // TODO: Support symbolic phase.
  15. auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst)
  16. -> SemIR::ConstantId;
  17. } // namespace Carbon::Check
  18. #endif // CARBON_TOOLCHAIN_CHECK_EVAL_H_