mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:20:10 +01:00
This is accomplished by tracking an extra bit on the ID we store in the constant values table, and propagating that from subexpressions to the enclosing expression. This extra bit is not yet computed correctly for types; that will be addressed in later PRs. --------- Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
25 lines
799 B
C++
25 lines
799 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_TOOLCHAIN_CHECK_EVAL_H_
|
|
#define CARBON_TOOLCHAIN_CHECK_EVAL_H_
|
|
|
|
#include "toolchain/check/context.h"
|
|
#include "toolchain/sem_ir/ids.h"
|
|
#include "toolchain/sem_ir/inst.h"
|
|
|
|
namespace Carbon::Check {
|
|
|
|
// Determines the phase of the instruction `inst`, and returns its constant
|
|
// value if it has constant phase. If it has runtime phase, returns
|
|
// `SemIR::ConstantId::NotConstant`.
|
|
//
|
|
// TODO: Support symbolic phase.
|
|
auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst)
|
|
-> SemIR::ConstantId;
|
|
|
|
} // namespace Carbon::Check
|
|
|
|
#endif // CARBON_TOOLCHAIN_CHECK_EVAL_H_
|