Files
carbon-lang/toolchain/lower/constant.h
T
79c0b65288 Separate constant emission from function emission. (#3916)
Make constant emission non-recursive, and stop building a bogus
FunctionContext to emit constants.

To support this, move `InstConstantKind` from the typed instruction
definition into the `.def` file, and add more macros to allow us to
generate case labels based on whether an instruction is a constant.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
2024-04-26 23:27:07 +00:00

23 lines
823 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_LOWER_CONSTANT_H_
#define CARBON_TOOLCHAIN_LOWER_CONSTANT_H_
#include "llvm/ADT/ArrayRef.h"
#include "toolchain/lower/file_context.h"
namespace Carbon::Lower {
// Forms LLVM constant values for all constants used in the file described by
// `file_context`. The indexes in the `constants` array corresponding to
// template constant instructions are populated with corresponding constant
// values.
auto LowerConstants(FileContext& file_context,
llvm::MutableArrayRef<llvm::Constant*> constants) -> void;
} // namespace Carbon::Lower
#endif // CARBON_TOOLCHAIN_LOWER_CONSTANT_H_