Skip to content

Commit

Permalink
Re-export all TIR nodes at the top level
Browse files Browse the repository at this point in the history
  • Loading branch information
kontheocharis committed Sep 14, 2023
1 parent c1a002b commit 87abfdc
Show file tree
Hide file tree
Showing 67 changed files with 122 additions and 356 deletions.
7 changes: 2 additions & 5 deletions compiler/hash-ast-expand/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ use hash_target::HasTarget;
use hash_tir::{
intrinsics::definitions::Primitive,
tir::{
args::Arg,
lits::{CharLit, FloatLit, IntLit, Lit, StrLit},
node::{Node, NodeOrigin},
params::{utils::validate_and_reorder_args_against_params, ParamIndex},
terms::{Term, Ty, TyId},
validate_and_reorder_args_against_params, Arg, CharLit, FloatLit, IntLit, Lit, Node,
NodeOrigin, ParamIndex, StrLit, Term, Ty, TyId,
},
};

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::tir::{params::utils::ParamError, terms::TyId};
use hash_tir::tir::{ParamError, 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::tir::params::ParamIndex;
use hash_tir::tir::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::tir::params::ParamsId;
use hash_tir::tir::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::tir::terms::TyId;
use hash_tir::tir::TyId;

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

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

use super::range::{IntRange, SplitIntRange};
Expand Down
7 changes: 1 addition & 6 deletions compiler/hash-exhaustiveness/src/deconstruct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ use std::{
use hash_storage::store::{statics::StoreId, Store};
use hash_tir::{
intrinsics::utils::try_use_ty_as_array_ty,
tir::{
data::{CtorDefId, DataTy},
node::NodesId,
pats::PatId,
terms::{Ty, TyId},
},
tir::{CtorDefId, DataTy, NodesId, PatId, 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::tir::{lits::LitPat, node::HasAstNodeId, pats::PatId};
use hash_tir::tir::{HasAstNodeId, LitPat, PatId};
use hash_utils::{
itertools::Itertools,
pluralise,
Expand Down
6 changes: 1 addition & 5 deletions compiler/hash-exhaustiveness/src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
use hash_storage::store::{statics::StoreId, Store};
use hash_tir::{
intrinsics::utils::try_use_ty_as_array_ty,
tir::{
data::{CtorDefId, DataDefCtors, DataTy},
node::NodesId,
terms::{tuples::TupleTy, Ty, TyId},
},
tir::{CtorDefId, DataDefCtors, DataTy, NodesId, 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::tir::{pats::PatId, terms::TyId};
use hash_tir::tir::{PatId, TyId};
use hash_utils::derive_more::Deref;
use storage::{
DeconstructedCtorId, DeconstructedCtorStore, DeconstructedPatId, DeconstructedPatStore,
Expand Down
16 changes: 3 additions & 13 deletions compiler/hash-exhaustiveness/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,9 @@ use hash_tir::{
scopes::BindingPat,
term_as_variant,
tir::{
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,
},
ArrayCtorInfo, ArrayPat, CharLit, CtorDefId, CtorPat, DataTy, IfPat, IntLit, Lit, LitPat,
Node, NodeOrigin, NodesId, OrPat, ParamId, ParamsId, Pat, PatArg, PatArgsId, PatId,
PatOrCapture, RangePat, Spread, StrLit, SymbolId, TuplePat, TupleTy, Ty, TyId,
},
};
use hash_utils::{itertools::Itertools, smallvec::SmallVec};
Expand Down
5 changes: 1 addition & 4 deletions compiler/hash-exhaustiveness/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ use hash_reporting::diagnostic::Diagnostics;
use hash_storage::store::Store;
use hash_tir::{
intrinsics::utils::try_use_ty_as_int_ty,
tir::{
pats::{PatId, RangePat},
terms::TyId,
},
tir::{PatId, RangePat, TyId},
};

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion 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::tir::{pats::PatId, terms::TyId};
use hash_tir::tir::{PatId, TyId};
use hash_utils::{itertools::Itertools, stack::ensure_sufficient_stack};

use super::{
Expand Down
5 changes: 1 addition & 4 deletions compiler/hash-exhaustiveness/src/wildcard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use hash_storage::store::{statics::StoreId, SequenceStoreKey, Store, TrivialSequ
use hash_target::size::Size;
use hash_tir::{
intrinsics::utils::try_use_ty_as_int_ty,
tir::{
data::{DataDefCtors, DataTy, NumericCtorBits, PrimitiveCtorInfo},
terms::Ty,
},
tir::{DataDefCtors, DataTy, NumericCtorBits, PrimitiveCtorInfo, 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::tir::lits::Lit;
use hash_tir::tir::Lit;
use hash_utils::derive_more::Constructor;

use crate::{
Expand Down
5 changes: 1 addition & 4 deletions compiler/hash-ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ use hash_source::entry_point::EntryPointState;
use hash_storage::{store::SequenceStoreKey, stores};
use hash_tir::{
intrinsics::definitions::Intrinsic as TirIntrinsic,
tir::{
data::{DataDefId, DataTy},
terms::{fns::FnDefId, TyId},
},
tir::{DataDefId, DataTy, FnDefId, TyId},
};
use hash_utils::fxhash::FxHashMap;
use intrinsics::Intrinsics;
Expand Down
8 changes: 1 addition & 7 deletions compiler/hash-lower/src/build/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ use hash_storage::store::{statics::StoreId, TrivialSequenceStoreKey};
use hash_tir::{
context::{Context, ScopeKind},
scopes::{BlockStatement, BlockTerm},
tir::{
node::HasAstNodeId,
terms::{
control::{LoopTerm, MatchTerm},
Term, TermId,
},
},
tir::{HasAstNodeId, LoopTerm, MatchTerm, 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::tir::terms::{Term, Ty};
use hash_tir::tir::{Term, Ty};

/// A [Category] represents what category [ast::Expr]s belong to
/// when they are being lowered. Depending on the category, we
Expand Down
6 changes: 1 addition & 5 deletions compiler/hash-lower/src/build/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
use hash_ir::ir;
use hash_reporting::macros::panic_on_span;
use hash_storage::store::statics::StoreId;
use hash_tir::tir::{
lits::LitId,
node::HasAstNodeId,
terms::{Term, TermId},
};
use hash_tir::tir::{HasAstNodeId, LitId, Term, TermId};

use super::BodyBuilder;

Expand Down
20 changes: 5 additions & 15 deletions compiler/hash-lower/src/build/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,8 @@ use hash_tir::{
scopes::AssignTerm,
term_as_variant,
tir::{
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,
},
self, ArgsId, ArrayTerm, CallTerm, CtorTerm, LoopControlTerm, NodesId, ParamIndex, RefTerm,
ReturnTerm, Term, TermId, TupleTerm, Ty, UnsafeTerm,
},
};
use hash_utils::itertools::Itertools;
Expand Down Expand Up @@ -304,9 +294,9 @@ impl<'tcx> BodyBuilder<'tcx> {
// the type of the expression, and where the expression comes
// from.
let kind = match kind {
refs::RefKind::Local => RefKind::Normal,
refs::RefKind::Raw => RefKind::Raw,
refs::RefKind::Rc => RefKind::Rc,
tir::RefKind::Local => RefKind::Normal,
tir::RefKind::Raw => RefKind::Raw,
tir::RefKind::Rc => RefKind::Rc,
};

let place = unpack!(block = self.as_place(block, subject, mutability));
Expand Down
10 changes: 1 addition & 9 deletions compiler/hash-lower/src/build/matches/candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ use hash_tir::{
atom_info::ItemInAtomInfo,
scopes::BindingPat,
tir::{
args::PatArgsId,
data::CtorPat,
params::ParamIndex,
pats::{Pat, PatId, RangePat},
symbols::SymbolId,
terms::{
control::{IfPat, MatchCase},
tuples::TuplePat,
},
CtorPat, IfPat, MatchCase, ParamIndex, Pat, PatArgsId, PatId, RangePat, SymbolId, TuplePat,
},
};
use hash_utils::{
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::tir::pats::RangePat;
use hash_tir::tir::RangePat;

use crate::build::BodyBuilder;

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

use super::{candidate::Candidate, BlockAnd, BodyBuilder};
Expand Down
9 changes: 1 addition & 8 deletions compiler/hash-lower/src/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@ use hash_ir::{
use hash_storage::store::statics::StoreId;
use hash_tir::{
context::{Context, ScopeKind},
tir::{
node::NodesId,
pats::{Pat, PatId},
terms::{
control::{IfPat, MatchCasesId},
Term, TermId,
},
},
tir::{IfPat, MatchCasesId, NodesId, Pat, PatId, 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::tir::pats::{PatId, Spread};
use hash_tir::tir::{PatId, Spread};
use hash_utils::smallvec::SmallVec;

use super::candidate::{Candidate, MatchPair};
Expand Down
9 changes: 1 addition & 8 deletions compiler/hash-lower/src/build/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@ use hash_reporting::macros::panic_on_span;
use hash_storage::store::statics::StoreId;
use hash_tir::{
atom_info::ItemInAtomInfo,
tir::{
args::PatArgsId,
data::CtorPat,
node::NodesId,
params::ParamIndex,
pats::{Pat, PatId, RangePat, Spread},
terms::control::IfPat,
},
tir::{CtorPat, IfPat, NodesId, ParamIndex, Pat, PatArgsId, PatId, RangePat, Spread},
};
use hash_utils::indexmap::IndexMap;

Expand Down
9 changes: 1 addition & 8 deletions compiler/hash-lower/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@ use hash_storage::store::{statics::StoreId, SequenceStoreKey};
use hash_target::{HasTarget, Target};
use hash_tir::{
context::{Context, HasContext, ScopeKind},
tir::{
node::NodesId,
symbols::SymbolId,
terms::{
fns::{FnDef, FnDefId, FnTy},
TermId,
},
},
tir::{FnDef, FnDefId, FnTy, NodesId, SymbolId, TermId},
};
use hash_utils::{fxhash::FxHashMap, index_vec::IndexVec};

Expand Down
5 changes: 1 addition & 4 deletions compiler/hash-lower/src/build/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ use hash_ir::{
ty::{IrTyId, Mutability, VariantIdx},
};
use hash_storage::store::statics::StoreId;
use hash_tir::tir::{
params::ParamIndex,
terms::{access::AccessTerm, arrays::IndexTerm, refs::DerefTerm, Term, TermId, Ty},
};
use hash_tir::tir::{AccessTerm, DerefTerm, IndexTerm, ParamIndex, Term, TermId, Ty};

use super::{unpack, BlockAnd, BlockAndExtend, BodyBuilder};

Expand Down
5 changes: 1 addition & 4 deletions compiler/hash-lower/src/build/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ use hash_ir::{
use hash_source::constant::IntTy;
use hash_storage::store::statics::StoreId;
use hash_target::HasTarget;
use hash_tir::tir::{
node::HasAstNodeId,
terms::{Term, TermId, Ty},
};
use hash_tir::tir::{HasAstNodeId, Term, TermId, Ty};

use super::{
category::Category, ty::FnCallTermKind, unpack, BlockAnd, BlockAndExtend, BodyBuilder,
Expand Down
2 changes: 1 addition & 1 deletion compiler/hash-lower/src/build/temp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use hash_ir::{
ir::{BasicBlock, Local, LocalDecl, Place},
ty::{IrTyId, Mutability},
};
use hash_tir::tir::terms::TermId;
use hash_tir::tir::TermId;

use super::{BlockAnd, BodyBuilder};
use crate::build::{unpack, BlockAndExtend};
Expand Down
Loading

0 comments on commit 87abfdc

Please sign in to comment.