Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organise TIR into folders #977

Merged
merged 4 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions compiler/hash-ast-expand/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ use hash_storage::store::{
};
use hash_target::HasTarget;
use hash_tir::{
args::Arg,
intrinsics::definitions::Primitive,
lits::{CharLit, FloatLit, IntLit, Lit, StrLit},
node::{Node, NodeOrigin},
params::{utils::validate_and_reorder_args_against_params, ParamIndex},
terms::{Term, Ty, TyId},
nodes::{
args::Arg,
lits::{CharLit, FloatLit, IntLit, Lit, StrLit},
node::{Node, NodeOrigin},
params::{utils::validate_and_reorder_args_against_params, ParamIndex},
terms::{Term, Ty, TyId},
},
};

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-ast-expand/src/diagnostics/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use hash_reporting::{
reporter::{Reporter, Reports},
};
use hash_source::identifier::Identifier;
use hash_tir::{params::utils::ParamError, terms::TyId};
use hash_tir::nodes::{params::utils::ParamError, terms::TyId};
use hash_utils::derive_more::{Constructor, From};

#[derive(Constructor, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-attrs/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use hash_source::{
};
use hash_storage::store::{DefaultPartialStore, PartialStore};
use hash_target::{abi::Integer, data_layout::HasDataLayout, primitives::IntTy, size::Size};
use hash_tir::params::ParamIndex;
use hash_tir::nodes::params::ParamIndex;
use hash_utils::{derive_more::From, fxhash::FxHashMap, lazy_static::lazy_static};

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-attrs/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use hash_ast_utils::attr::AttrTarget;
use hash_source::identifier::Identifier;
use hash_tir::params::ParamsId;
use hash_tir::nodes::params::ParamsId;
use hash_utils::{
fxhash::FxHashMap,
index_vec::{define_index_type, IndexVec},
Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-exhaustiveness/src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! used within the exhaustiveness sub-system to represent these values within
//! a single data type.
use hash_source::constant::InternedInt;
use hash_tir::terms::TyId;
use hash_tir::nodes::terms::TyId;

#[derive(Debug, Clone, Copy)]
pub struct Constant {
Expand Down
5 changes: 2 additions & 3 deletions compiler/hash-exhaustiveness/src/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ use std::fmt::{self, Debug};

use hash_source::constant::InternedStr;
use hash_storage::store::{statics::StoreId, SequenceStoreKey, Store};
use hash_tir::{
use hash_tir::nodes::{
data::{CtorDefId, DataTy},
node::NodesId,
terms::Ty,
tuples::TupleTy,
terms::{tuples::TupleTy, Ty},
};
use hash_utils::smallvec::{smallvec, SmallVec};

Expand Down
10 changes: 6 additions & 4 deletions compiler/hash-exhaustiveness/src/deconstruct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ use std::{

use hash_storage::store::{statics::StoreId, Store};
use hash_tir::{
data::{CtorDefId, DataTy},
intrinsics::utils::try_use_ty_as_array_ty,
node::NodesId,
pats::PatId,
terms::{Ty, TyId},
nodes::{
data::{CtorDefId, DataTy},
node::NodesId,
pats::PatId,
terms::{Ty, TyId},
},
};
use hash_utils::{itertools::Itertools, smallvec::SmallVec};

Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-exhaustiveness/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use hash_reporting::{
reporter::Reporter,
};
use hash_source::location::Span;
use hash_tir::{lits::LitPat, node::HasAstNodeId, pats::PatId};
use hash_tir::nodes::{lits::LitPat, node::HasAstNodeId, pats::PatId};
use hash_utils::{
itertools::Itertools,
pluralise,
Expand Down
9 changes: 5 additions & 4 deletions compiler/hash-exhaustiveness/src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

use hash_storage::store::{statics::StoreId, Store};
use hash_tir::{
data::{CtorDefId, DataDefCtors, DataTy},
intrinsics::utils::try_use_ty_as_array_ty,
node::NodesId,
terms::{Ty, TyId},
tuples::TupleTy,
nodes::{
data::{CtorDefId, DataDefCtors, DataTy},
node::NodesId,
terms::{tuples::TupleTy, Ty, TyId},
},
};
use hash_utils::itertools::Itertools;

Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-exhaustiveness/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ use hash_reporting::diagnostic::Diagnostics;
use hash_source::location::Span;
use hash_storage::store::CloneStore;
use hash_target::HasTarget;
use hash_tir::{pats::PatId, terms::TyId};
use hash_tir::nodes::{pats::PatId, terms::TyId};
use hash_utils::derive_more::Deref;
use storage::{
DeconstructedCtorId, DeconstructedCtorStore, DeconstructedPatId, DeconstructedPatStore,
Expand Down
26 changes: 15 additions & 11 deletions compiler/hash-exhaustiveness/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@ use hash_storage::store::{
};
use hash_target::HasTarget;
use hash_tir::{
args::{PatArg, PatArgsId, PatOrCapture},
arrays::ArrayPat,
control::{IfPat, OrPat},
data::{ArrayCtorInfo, CtorDefId, CtorPat, DataTy},
intrinsics::utils::{
numeric_max_val_of_lit, numeric_min_val_of_lit, try_use_ty_as_array_ty,
try_use_ty_as_int_ty, try_use_ty_as_lit_ty, LitTy,
},
lits::{CharLit, IntLit, Lit, LitPat, StrLit},
node::{Node, NodeOrigin, NodesId},
params::{ParamId, ParamsId},
pats::{Pat, PatId, RangePat, Spread},
nodes::{
args::{PatArg, PatArgsId, PatOrCapture},
data::{ArrayCtorInfo, CtorDefId, CtorPat, DataTy},
lits::{CharLit, IntLit, Lit, LitPat, StrLit},
node::{Node, NodeOrigin, NodesId},
params::{ParamId, ParamsId},
pats::{Pat, PatId, RangePat, Spread},
symbols::SymbolId,
terms::{
arrays::ArrayPat,
control::{IfPat, OrPat},
tuples::{TuplePat, TupleTy},
Ty, TyId,
},
},
scopes::BindingPat,
symbols::SymbolId,
term_as_variant,
terms::{Ty, TyId},
tuples::{TuplePat, TupleTy},
};
use hash_utils::{itertools::Itertools, smallvec::SmallVec};

Expand Down
6 changes: 4 additions & 2 deletions compiler/hash-exhaustiveness/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ use hash_reporting::diagnostic::Diagnostics;
use hash_storage::store::Store;
use hash_tir::{
intrinsics::utils::try_use_ty_as_int_ty,
pats::{PatId, RangePat},
terms::TyId,
nodes::{
pats::{PatId, RangePat},
terms::TyId,
},
};

use crate::{
Expand Down
4 changes: 2 additions & 2 deletions compiler/hash-exhaustiveness/src/usefulness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use std::iter::once;

use hash_storage::store::Store;
use hash_tir::{pats::PatId, terms::TyId};
use hash_tir::nodes::{pats::PatId, terms::TyId};
use hash_utils::{itertools::Itertools, stack::ensure_sufficient_stack};

use super::{
Expand Down Expand Up @@ -113,7 +113,7 @@ pub(crate) struct MatchArm {
/// Whether the arm has an `if-guard`.
pub(crate) has_guard: bool,

/// The corresponding [hash_tir::pats::Pat] with this
/// The corresponding [hash_tir::nodes::pats::Pat] with this
/// match arm.
pub(crate) id: PatId,
}
Expand Down
6 changes: 4 additions & 2 deletions compiler/hash-exhaustiveness/src/wildcard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ use hash_ast::ast::RangeEnd;
use hash_storage::store::{statics::StoreId, SequenceStoreKey, Store, TrivialSequenceStoreKey};
use hash_target::size::Size;
use hash_tir::{
data::{DataDefCtors, DataTy, NumericCtorBits, PrimitiveCtorInfo},
intrinsics::utils::try_use_ty_as_int_ty,
terms::Ty,
nodes::{
data::{DataDefCtors, DataTy, NumericCtorBits, PrimitiveCtorInfo},
terms::Ty,
},
};
use hash_utils::smallvec::{smallvec, SmallVec};

Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-ir/src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use hash_storage::{static_single_store, store::statics::StoreId};
use hash_target::{
alignment::Alignment, data_layout::HasDataLayout, primitives::IntTy, size::Size,
};
use hash_tir::lits::Lit;
use hash_tir::nodes::lits::Lit;
use hash_utils::derive_more::Constructor;

use crate::{
Expand Down
7 changes: 4 additions & 3 deletions compiler/hash-ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ use constant::Allocations;
use hash_source::entry_point::EntryPointState;
use hash_storage::{store::SequenceStoreKey, stores};
use hash_tir::{
data::{DataDefId, DataTy},
fns::FnDefId,
intrinsics::definitions::Intrinsic as TirIntrinsic,
terms::TyId,
nodes::{
data::{DataDefId, DataTy},
terms::{fns::FnDefId, TyId},
},
};
use hash_utils::fxhash::FxHashMap;
use intrinsics::Intrinsics;
Expand Down
10 changes: 7 additions & 3 deletions compiler/hash-lower/src/build/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ use hash_ir::{
use hash_storage::store::{statics::StoreId, TrivialSequenceStoreKey};
use hash_tir::{
context::{Context, ScopeKind},
control::{LoopTerm, MatchTerm},
node::HasAstNodeId,
nodes::{
node::HasAstNodeId,
terms::{
control::{LoopTerm, MatchTerm},
Term, TermId,
},
},
scopes::{BlockStatement, BlockTerm},
terms::{Term, TermId},
};

use super::{BlockAnd, BlockAndExtend, BodyBuilder, LoopBlockInfo};
Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-lower/src/build/category.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Defines a category of AST expressions which can be used to determine how to
//! lower them throughout the lowering stage.

use hash_tir::terms::{Term, Ty};
use hash_tir::nodes::terms::{Term, Ty};

/// A [Category] represents what category [ast::Expr]s belong to
/// when they are being lowered. Depending on the category, we
Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-lower/src/build/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use hash_ir::ir;
use hash_reporting::macros::panic_on_span;
use hash_storage::store::statics::StoreId;
use hash_tir::{
use hash_tir::nodes::{
lits::LitId,
node::HasAstNodeId,
terms::{Term, TermId},
Expand Down
24 changes: 14 additions & 10 deletions compiler/hash-lower/src/build/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@ use hash_reporting::macros::panic_on_span;
use hash_source::identifier::Identifier;
use hash_storage::store::{statics::StoreId, SequenceStoreKey};
use hash_tir::{
args::ArgsId,
arrays::ArrayTerm,
atom_info::ItemInAtomInfo,
context::Context,
control::{LoopControlTerm, ReturnTerm},
data::CtorTerm,
fns::CallTerm,
node::NodesId,
params::ParamIndex,
refs::{self, RefTerm},
nodes::{
args::ArgsId,
data::CtorTerm,
node::NodesId,
params::ParamIndex,
terms::{
arrays::ArrayTerm,
control::{LoopControlTerm, ReturnTerm},
fns::CallTerm,
refs::{self, RefTerm},
tuples::TupleTerm,
Term, TermId, Ty, UnsafeTerm,
},
},
scopes::AssignTerm,
term_as_variant,
terms::{Term, TermId, Ty, UnsafeTerm},
tuples::TupleTerm,
};
use hash_utils::itertools::Itertools;

Expand Down
18 changes: 11 additions & 7 deletions compiler/hash-lower/src/build/matches/candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ use hash_ir::{
use hash_storage::store::{statics::StoreId, TrivialSequenceStoreKey};
use hash_target::{size::Size, HasTarget};
use hash_tir::{
args::PatArgsId,
atom_info::ItemInAtomInfo,
control::{IfPat, MatchCase},
data::CtorPat,
params::ParamIndex,
pats::{Pat, PatId, RangePat},
nodes::{
args::PatArgsId,
data::CtorPat,
params::ParamIndex,
pats::{Pat, PatId, RangePat},
symbols::SymbolId,
terms::{
control::{IfPat, MatchCase},
tuples::TuplePat,
},
},
scopes::BindingPat,
symbols::SymbolId,
tuples::TuplePat,
};
use hash_utils::{
itertools::Itertools,
Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-lower/src/build/matches/const_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use hash_ir_utils::const_utils::ConstUtils;
use hash_layout::compute::LayoutComputer;
use hash_storage::store::statics::StoreId;
use hash_target::{data_layout::HasDataLayout, primitives::FloatTy};
use hash_tir::pats::RangePat;
use hash_tir::nodes::pats::RangePat;

use crate::build::BodyBuilder;

Expand Down
20 changes: 12 additions & 8 deletions compiler/hash-lower/src/build/matches/declarations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ use hash_ir::{
use hash_reporting::macros::panic_on_span;
use hash_storage::store::{statics::StoreId, TrivialSequenceStoreKey};
use hash_tir::{
arrays::ArrayPat,
control::{IfPat, OrPat},
data::CtorPat,
node::NodesId,
pats::{Pat, PatId},
nodes::{
data::CtorPat,
node::NodesId,
pats::{Pat, PatId},
symbols::SymbolId,
terms::{
arrays::ArrayPat,
control::{IfPat, OrPat},
tuples::TuplePat,
TermId,
},
},
scopes::{BindingPat, Decl},
symbols::SymbolId,
terms::TermId,
tuples::TuplePat,
};

use super::{candidate::Candidate, BlockAnd, BodyBuilder};
Expand Down
12 changes: 8 additions & 4 deletions compiler/hash-lower/src/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ use hash_ir::{
use hash_storage::store::statics::StoreId;
use hash_tir::{
context::{Context, ScopeKind},
control::{IfPat, MatchCasesId},
node::NodesId,
pats::{Pat, PatId},
terms::{Term, TermId},
nodes::{
node::NodesId,
pats::{Pat, PatId},
terms::{
control::{IfPat, MatchCasesId},
Term, TermId,
},
},
};
use hash_utils::{itertools::Itertools, stack::ensure_sufficient_stack};

Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-lower/src/build/matches/optimise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use hash_ir::{
ty::{IrTy, IrTyId},
};
use hash_storage::store::statics::StoreId;
use hash_tir::pats::{PatId, Spread};
use hash_tir::nodes::pats::{PatId, Spread};
use hash_utils::smallvec::SmallVec;

use super::candidate::{Candidate, MatchPair};
Expand Down
Loading
Loading