mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 14:01:06 +01:00
@@ -46,7 +46,7 @@ cc_library(
|
||||
"context.h",
|
||||
"convert.h",
|
||||
"declaration_name_stack.h",
|
||||
"node_block_stack.h",
|
||||
"inst_block_stack.h",
|
||||
"pending_block.h",
|
||||
],
|
||||
deps = [
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#include "common/vlog.h"
|
||||
#include "llvm/ADT/Sequence.h"
|
||||
#include "toolchain/check/declaration_name_stack.h"
|
||||
#include "toolchain/check/node_block_stack.h"
|
||||
#include "toolchain/check/inst_block_stack.h"
|
||||
#include "toolchain/lex/tokenized_buffer.h"
|
||||
#include "toolchain/parse/node_kind.h"
|
||||
#include "toolchain/sem_ir/file.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "llvm/ADT/FoldingSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "toolchain/check/declaration_name_stack.h"
|
||||
#include "toolchain/check/node_block_stack.h"
|
||||
#include "toolchain/check/inst_block_stack.h"
|
||||
#include "toolchain/check/node_stack.h"
|
||||
#include "toolchain/parse/tree.h"
|
||||
#include "toolchain/sem_ir/file.h"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "toolchain/parse/node_kind.h"
|
||||
#include "toolchain/sem_ir/file.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "toolchain/check/convert.h"
|
||||
#include "toolchain/parse/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/convert.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "toolchain/check/inst_block_stack.h"
|
||||
|
||||
#include "common/vlog.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "toolchain/check/node_block_stack.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#ifndef CARBON_TOOLCHAIN_CHECK_NODE_BLOCK_STACK_H_
|
||||
#define CARBON_TOOLCHAIN_CHECK_NODE_BLOCK_STACK_H_
|
||||
#ifndef CARBON_TOOLCHAIN_CHECK_INST_BLOCK_STACK_H_
|
||||
#define CARBON_TOOLCHAIN_CHECK_INST_BLOCK_STACK_H_
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "toolchain/sem_ir/file.h"
|
||||
@@ -119,4 +119,4 @@ class InstBlockStack {
|
||||
|
||||
} // namespace Carbon::Check
|
||||
|
||||
#endif // CARBON_TOOLCHAIN_CHECK_NODE_BLOCK_STACK_H_
|
||||
#endif // CARBON_TOOLCHAIN_CHECK_INST_BLOCK_STACK_H_
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
// AUTOUPDATE
|
||||
|
||||
// CHECK:STDOUT: ---
|
||||
// CHECK:STDOUT: filename: builtin_nodes.carbon
|
||||
// CHECK:STDOUT: filename: builtin_insts.carbon
|
||||
// CHECK:STDOUT: sem_ir:
|
||||
// CHECK:STDOUT: cross_reference_irs_size: 1
|
||||
// CHECK:STDOUT: functions: {}
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "toolchain/sem_ir/entry_point.h"
|
||||
#include "toolchain/sem_ir/file.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
namespace Carbon::Lower {
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ auto FunctionContext::LowerBlock(SemIR::InstBlockId block_id) -> void {
|
||||
case SemIR::Name::Kind: \
|
||||
Handle##Name(*this, inst_id, inst.As<SemIR::Name>()); \
|
||||
break;
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ class FunctionContext {
|
||||
auto Handle##Name(FunctionContext& context, SemIR::InstId inst_id, \
|
||||
SemIR::Name inst) \
|
||||
->void;
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
|
||||
} // namespace Carbon::Lower
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "llvm/ADT/Sequence.h"
|
||||
#include "toolchain/lower/function_context.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
namespace Carbon::Lower {
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ cc_library(
|
||||
|
||||
cc_library(
|
||||
name = "inst_kind",
|
||||
srcs = ["node_kind.cpp"],
|
||||
srcs = ["inst_kind.cpp"],
|
||||
hdrs = [
|
||||
"node_kind.h",
|
||||
"inst_kind.h",
|
||||
"typed_insts.h",
|
||||
],
|
||||
textual_hdrs = ["node_kind.def"],
|
||||
textual_hdrs = ["inst_kind.def"],
|
||||
deps = [
|
||||
"//common:enum_base",
|
||||
"//toolchain/parse:tree",
|
||||
@@ -112,7 +112,7 @@ cc_library(
|
||||
cc_test(
|
||||
name = "typed_insts_test",
|
||||
size = "small",
|
||||
srcs = ["typed_nodes_test.cpp"],
|
||||
srcs = ["typed_insts_test.cpp"],
|
||||
deps = [
|
||||
":inst",
|
||||
":inst_kind",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "toolchain/base/yaml.h"
|
||||
#include "toolchain/sem_ir/builtin_kind.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
namespace Carbon::SemIR {
|
||||
|
||||
|
||||
@@ -630,7 +630,7 @@ class Formatter {
|
||||
case InstT::Kind: \
|
||||
FormatInstruction(inst_id, inst.As<InstT>()); \
|
||||
break;
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ auto Inst::Print(llvm::raw_ostream& out) const -> void {
|
||||
case Name::Kind: \
|
||||
print_args(TypedInstArgsInfo<Name>()); \
|
||||
break;
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
}
|
||||
if (type_id_.is_valid()) {
|
||||
out << ", type: " << type_id_;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "toolchain/base/index_base.h"
|
||||
#include "toolchain/parse/tree.h"
|
||||
#include "toolchain/sem_ir/builtin_kind.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
#include "toolchain/sem_ir/typed_insts.h"
|
||||
|
||||
namespace Carbon::SemIR {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
#include "toolchain/sem_ir/typed_insts.h"
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Carbon::SemIR {
|
||||
|
||||
CARBON_DEFINE_ENUM_CLASS_NAMES(InstKind) = {
|
||||
#define CARBON_SEM_IR_INST_KIND(Name) CARBON_ENUM_CLASS_NAME_STRING(Name)
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
};
|
||||
|
||||
auto InstKind::ir_name() const -> llvm::StringLiteral {
|
||||
@@ -21,7 +21,7 @@ auto InstKind::value_kind() const -> InstValueKind {
|
||||
static constexpr InstValueKind Table[] = {
|
||||
#define CARBON_SEM_IR_INST_KIND(Name) \
|
||||
HasTypeId<SemIR::Name> ? InstValueKind::Typed : InstValueKind::None,
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
};
|
||||
return Table[AsInt()];
|
||||
}
|
||||
@@ -33,7 +33,7 @@ auto InstKind::terminator_kind() const -> TerminatorKind {
|
||||
auto InstKind::definition() const -> const Definition& {
|
||||
static constexpr const Definition* Table[] = {
|
||||
#define CARBON_SEM_IR_INST_KIND(Name) &SemIR::Name::Kind,
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
};
|
||||
return *Table[AsInt()];
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#ifndef CARBON_TOOLCHAIN_SEM_IR_NODE_KIND_H_
|
||||
#define CARBON_TOOLCHAIN_SEM_IR_NODE_KIND_H_
|
||||
#ifndef CARBON_TOOLCHAIN_SEM_IR_INST_KIND_H_
|
||||
#define CARBON_TOOLCHAIN_SEM_IR_INST_KIND_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -40,13 +40,13 @@ enum class TerminatorKind : int8_t {
|
||||
|
||||
CARBON_DEFINE_RAW_ENUM_CLASS(InstKind, uint8_t) {
|
||||
#define CARBON_SEM_IR_INST_KIND(Name) CARBON_RAW_ENUM_ENUMERATOR(Name)
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
};
|
||||
|
||||
class InstKind : public CARBON_ENUM_BASE(InstKind) {
|
||||
public:
|
||||
#define CARBON_SEM_IR_INST_KIND(Name) CARBON_ENUM_CONSTANT_DECLARATION(Name)
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
|
||||
using EnumBase::Create;
|
||||
|
||||
@@ -82,7 +82,7 @@ class InstKind : public CARBON_ENUM_BASE(InstKind) {
|
||||
|
||||
#define CARBON_SEM_IR_INST_KIND(Name) \
|
||||
CARBON_ENUM_CONSTANT_DEFINITION(InstKind, Name)
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
|
||||
// We expect the instruction kind to fit compactly into 8 bits.
|
||||
static_assert(sizeof(InstKind) == 1, "Kind objects include padding!");
|
||||
@@ -128,4 +128,4 @@ constexpr auto InstKind::Define(llvm::StringLiteral ir_name,
|
||||
|
||||
} // namespace Carbon::SemIR
|
||||
|
||||
#endif // CARBON_TOOLCHAIN_SEM_IR_NODE_KIND_H_
|
||||
#endif // CARBON_TOOLCHAIN_SEM_IR_INST_KIND_H_
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "toolchain/parse/tree.h"
|
||||
#include "toolchain/sem_ir/builtin_kind.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
#include "toolchain/sem_ir/node_kind.h"
|
||||
#include "toolchain/sem_ir/inst_kind.h"
|
||||
|
||||
// Representations for specific kinds of instructions.
|
||||
//
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "toolchain/sem_ir/typed_insts.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
#include "toolchain/sem_ir/typed_insts.h"
|
||||
|
||||
namespace Carbon::SemIR {
|
||||
|
||||
@@ -28,7 +29,7 @@ namespace {
|
||||
// InstKind enumerator.
|
||||
#define CARBON_SEM_IR_INST_KIND(Name) \
|
||||
static_assert(Name::Kind == InstKind::Name);
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
|
||||
template <typename Ignored, typename... Types>
|
||||
using TypesExceptFirst = ::testing::Types<Types...>;
|
||||
@@ -38,7 +39,7 @@ using TypesExceptFirst = ::testing::Types<Types...>;
|
||||
// list.
|
||||
using TypedInstTypes = TypesExceptFirst<void
|
||||
#define CARBON_SEM_IR_INST_KIND(Name) , Name
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
#include "toolchain/sem_ir/inst_kind.def"
|
||||
>;
|
||||
|
||||
// Set up the test fixture.
|
||||
Reference in New Issue
Block a user