Skip to content

Commit

Permalink
Removing TypeSystem.
Browse files Browse the repository at this point in the history
  • Loading branch information
asoffer committed Mar 16, 2024
1 parent 745b771 commit 91c7ae6
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 246 deletions.
5 changes: 0 additions & 5 deletions common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ struct PointerType : Type {

private:
friend Type;
friend struct TypeSystem;
friend PointerType Ptr(Type t);

explicit PointerType() = default;
Expand All @@ -131,7 +130,6 @@ struct BufferPointerType : Type {

private:
friend Type;
friend struct TypeSystem;
friend BufferPointerType BufPtr(Type t);

explicit BufferPointerType() = default;
Expand All @@ -151,7 +149,6 @@ struct SliceType : Type {

private:
friend Type;
friend struct TypeSystem;
friend SliceType Slice(Type t);

explicit SliceType() = default;
Expand Down Expand Up @@ -222,7 +219,6 @@ struct ParametersType : Type {
private:
friend Type;
friend struct FunctionType;
friend struct TypeSystem;
friend ParametersType Parameters(std::span<Parameter const>);
explicit constexpr ParametersType(uint32_t n)
: Type(Type::Kind::Parameters, n) {}
Expand Down Expand Up @@ -266,7 +262,6 @@ struct FunctionType : Type {

private:
friend Type;
friend struct TypeSystem;
friend FunctionType Function(ParametersType, std::span<Type const>,
Evaluation);

Expand Down
6 changes: 1 addition & 5 deletions ir/deserialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ struct ModuleDeserializer : R {
type::Type t;
co_await nth::io::deserialize(d, t);
std::vector<jasmin::Value> values;
t = d.reindexing_(t);
switch (t.kind()) {
case type::Type::Kind::Primitive: {
auto p = t.AsPrimitive();
Expand Down Expand Up @@ -197,13 +196,11 @@ struct ModuleDeserializer : R {
StringLiteral name;
type::Type t;
co_await nth::io::deserialize(d, name, t);
f = ForeignFunction(name, d.reindexing_(t).AsFunction());
f = ForeignFunction(name, t.AsFunction());
co_return Result::success();
}

friend Result NthDeserialize(ModuleDeserializer& d, Module& m) {
d.reindexing_.clear();

co_await nth::io::deserialize(d, GlobalConstantTable());
co_await nth::io::deserialize(d, d.context_.foreign);
co_await nth::io::deserialize(d, m.program());
Expand All @@ -217,7 +214,6 @@ struct ModuleDeserializer : R {
return context_.registry;
}
private:
type::TypeSystem::ReindexTable reindexing_;
SharedContext& context_;

Result read_as_string(std::string& content) {
Expand Down
2 changes: 1 addition & 1 deletion ir/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "absl/container/flat_hash_map.h"
#include "common/identifier.h"
#include "common/module_id.h"
#include "common/type.h"
#include "ir/dependent_modules.h"
#include "ir/lexical_scope.h"
#include "ir/local_storage.h"
Expand All @@ -20,7 +21,6 @@
#include "parse/declaration.h"
#include "parse/node_index.h"
#include "parse/tree.h"
#include "type/type.h"

namespace ic {

Expand Down
2 changes: 1 addition & 1 deletion ir/ir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "common/module_id.h"
#include "common/resources.h"
#include "common/string.h"
#include "common/type.h"
#include "ir/lexical_scope.h"
#include "ir/type_stack.h"
#include "jasmin/core/function.h"
Expand All @@ -19,7 +20,6 @@
#include "parse/node_index.h"
#include "parse/tree.h"
#include "type/cast.h"
#include "type/type.h"

namespace ic {
namespace {
Expand Down
1 change: 0 additions & 1 deletion ir/lexical_scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "nth/debug/debug.h"
#include "nth/utility/iterator_range.h"
#include "parse/node_index.h"
#include "type/type.h"

namespace ic {

Expand Down
2 changes: 1 addition & 1 deletion ir/local_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#define ICARUS_IR_LOCAL_STORAGE_H

#include "absl/container/flat_hash_map.h"
#include "common/type.h"
#include "nth/container/interval.h"
#include "nth/debug/debug.h"
#include "parse/node_index.h"
#include "type/byte_width.h"
#include "type/type.h"

namespace ic {

Expand Down
1 change: 0 additions & 1 deletion ir/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "ir/function.h"
#include "ir/scope.h"
#include "jasmin/core/value.h"
#include "type/type.h"

namespace ic {

Expand Down
3 changes: 2 additions & 1 deletion ir/type_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <span>
#include <vector>

#include "type/type.h"
#include "common/type.h"
#include "type/basic.h"

namespace ic {

Expand Down
2 changes: 1 addition & 1 deletion toolchain/builtin/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "common/any_value.h"
#include "common/identifier.h"
#include "common/pattern.h"
#include "type/type.h"
#include "common/type.h"

namespace ic::builtin {
namespace {
Expand Down
29 changes: 2 additions & 27 deletions type/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ cc_library(

cc_library(
name = "type",
hdrs = ["type.h"],
srcs = ["type.cc"],
deps = [
":type_system",
":dependent",
":type_contour",
"//common:constants",
"@nth_cc//nth/container:flyweight_set",
"@nth_cc//nth/debug",
Expand All @@ -201,28 +201,3 @@ cc_test(
"@nth_cc//nth/test:main",
]
)

cc_library(
name = "type_system",
hdrs = ["type_system.h"],
srcs = ["type_system.cc"],
deps = [
":alignment",
":basic",
":byte_width",
":dependent",
":function",
":opaque",
":parameters",
":pattern",
":pointer",
":primitive",
":refinement",
":type_contour",
"//common/language:type_kind",
"//common:pattern",
"@nth_cc//nth/container:flyweight_set",
"@nth_cc//nth/debug",
"@nth_cc//nth/utility:no_destructor",
],
)
2 changes: 1 addition & 1 deletion type/cast.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef ICARUS_TYPE_CAST_H
#define ICARUS_TYPE_CAST_H

#include "type/type.h"
#include "common/any_value.h"
#include "common/type.h"

namespace ic::type {

Expand Down
3 changes: 2 additions & 1 deletion type/dependent_test.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#include "type/dependent.h"

#include "common/any_value.h"
#include "common/type.h"
#include "jasmin/instructions/arithmetic.h"
#include "jasmin/instructions/common.h"
#include "nth/test/test.h"
#include "type/basic.h"
#include "type/function.h"
#include "type/parameters.h"
#include "type/primitive.h"
#include "type/type.h"

namespace ic::type {
namespace {
Expand Down
6 changes: 3 additions & 3 deletions type/type.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "type/type.h"
#include "common/type.h"

#include <cstring>
#include <utility>
Expand All @@ -9,12 +9,12 @@
#include "common/pattern.h"
#include "nth/debug/debug.h"
#include "nth/utility/no_destructor.h"
#include "type/dependent.h"
#include "type/type_contour.h"

namespace ic::type {
namespace {

nth::NoDestructor<TypeSystem> type_system;

uint64_t opaque_count = 0;

} // namespace
Expand Down
11 changes: 0 additions & 11 deletions type/type.h

This file was deleted.

32 changes: 0 additions & 32 deletions type/type_system.cc

This file was deleted.

57 changes: 0 additions & 57 deletions type/type_system.h

This file was deleted.

Loading

0 comments on commit 91c7ae6

Please sign in to comment.