Преглед изворни кода

Rename sem_ir files node->inst, follow up to #3355 (#3361)

josh11b пре 2 година
родитељ
комит
737162cc8f

+ 1 - 1
toolchain/check/BUILD

@@ -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 = [

+ 2 - 2
toolchain/check/context.cpp

@@ -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 {
 

+ 1 - 1
toolchain/check/context.h

@@ -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"

+ 1 - 1
toolchain/check/convert.cpp

@@ -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 {
 

+ 1 - 1
toolchain/check/handle_array.cpp

@@ -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 {
 

+ 1 - 1
toolchain/check/handle_index.cpp

@@ -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 - 1
toolchain/check/inst_block_stack.cpp

@@ -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 {

+ 3 - 3
toolchain/check/node_block_stack.h → toolchain/check/inst_block_stack.h

@@ -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
toolchain/check/testdata/basics/builtin_nodes.carbon → toolchain/check/testdata/basics/builtin_insts.carbon

@@ -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:       {}

+ 1 - 1
toolchain/lower/file_context.cpp

@@ -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 {
 

+ 1 - 1
toolchain/lower/function_context.cpp

@@ -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"
     }
   }
 }

+ 1 - 1
toolchain/lower/function_context.h

@@ -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
 

+ 1 - 1
toolchain/lower/handle.cpp

@@ -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 {
 

+ 4 - 4
toolchain/sem_ir/BUILD

@@ -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",

+ 1 - 1
toolchain/sem_ir/file.cpp

@@ -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 {
 

+ 1 - 1
toolchain/sem_ir/formatter.cpp

@@ -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"
     }
   }
 

+ 1 - 1
toolchain/sem_ir/inst.cpp

@@ -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_;

+ 1 - 1
toolchain/sem_ir/inst.h

@@ -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 {

+ 4 - 4
toolchain/sem_ir/node_kind.cpp → toolchain/sem_ir/inst_kind.cpp

@@ -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()];
 }

+ 0 - 0
toolchain/sem_ir/node_kind.def → toolchain/sem_ir/inst_kind.def


+ 6 - 6
toolchain/sem_ir/node_kind.h → toolchain/sem_ir/inst_kind.h

@@ -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_

+ 1 - 1
toolchain/sem_ir/typed_insts.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.
 //

+ 4 - 3
toolchain/sem_ir/typed_nodes_test.cpp → toolchain/sem_ir/typed_insts_test.cpp

@@ -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.