diff --git a/lib/cretonne/src/entity_list.rs b/lib/cretonne/src/entity/list.rs similarity index 100% rename from lib/cretonne/src/entity_list.rs rename to lib/cretonne/src/entity/list.rs diff --git a/lib/cretonne/src/entity/mod.rs b/lib/cretonne/src/entity/mod.rs index 58f900abc4..9a9cc5d72c 100644 --- a/lib/cretonne/src/entity/mod.rs +++ b/lib/cretonne/src/entity/mod.rs @@ -6,12 +6,16 @@ //! Various data structures based on the entity references are defined in sub-modules. mod keys; +mod list; mod map; mod primary; +mod sparse; pub use self::keys::Keys; +pub use self::list::{EntityList, ListPool}; pub use self::map::EntityMap; pub use self::primary::PrimaryMap; +pub use self::sparse::{SparseSet, SparseMap, SparseMapValue}; /// A type wrapping a small integer index should implement `EntityRef` so it can be used as the key /// of an `EntityMap` or `SparseMap`. diff --git a/lib/cretonne/src/sparse_map.rs b/lib/cretonne/src/entity/sparse.rs similarity index 100% rename from lib/cretonne/src/sparse_map.rs rename to lib/cretonne/src/entity/sparse.rs diff --git a/lib/cretonne/src/ir/instructions.rs b/lib/cretonne/src/ir/instructions.rs index b7c5d898e5..2cd83cf67d 100644 --- a/lib/cretonne/src/ir/instructions.rs +++ b/lib/cretonne/src/ir/instructions.rs @@ -17,17 +17,17 @@ use ir::condcodes::*; use ir::types; use isa::RegUnit; -use entity_list; +use entity; use bitset::BitSet; use ref_slice::{ref_slice, ref_slice_mut}; /// Some instructions use an external list of argument values because there is not enough space in /// the 16-byte `InstructionData` struct. These value lists are stored in a memory pool in /// `dfg.value_lists`. -pub type ValueList = entity_list::EntityList; +pub type ValueList = entity::EntityList; /// Memory pool for holding value lists. See `ValueList`. -pub type ValueListPool = entity_list::ListPool; +pub type ValueListPool = entity::ListPool; // Include code generated by `lib/cretonne/meta/gen_instr.py`. This file contains: // diff --git a/lib/cretonne/src/lib.rs b/lib/cretonne/src/lib.rs index 6cb6687138..a63b00b3ae 100644 --- a/lib/cretonne/src/lib.rs +++ b/lib/cretonne/src/lib.rs @@ -18,7 +18,6 @@ pub mod entity; pub mod binemit; pub mod bitset; pub mod dominator_tree; -pub mod entity_list; pub mod flowgraph; pub mod ir; pub mod isa; @@ -27,7 +26,6 @@ pub mod packed_option; pub mod regalloc; pub mod result; pub mod settings; -pub mod sparse_map; pub mod verifier; mod abi; diff --git a/lib/cretonne/src/licm.rs b/lib/cretonne/src/licm.rs index 8ed88d47dd..5cd7b22280 100644 --- a/lib/cretonne/src/licm.rs +++ b/lib/cretonne/src/licm.rs @@ -4,7 +4,7 @@ use ir::{Function, Ebb, Inst, Value, Cursor, CursorBase, Type, InstBuilder, Layo use flowgraph::ControlFlowGraph; use std::collections::HashSet; use dominator_tree::DominatorTree; -use entity_list::{EntityList, ListPool}; +use entity::{EntityList, ListPool}; use loop_analysis::{Loop, LoopAnalysis}; /// Performs the LICM pass by detecting loops within the CFG and moving diff --git a/lib/cretonne/src/regalloc/live_value_tracker.rs b/lib/cretonne/src/regalloc/live_value_tracker.rs index bee25aa287..09c0dfea07 100644 --- a/lib/cretonne/src/regalloc/live_value_tracker.rs +++ b/lib/cretonne/src/regalloc/live_value_tracker.rs @@ -5,7 +5,7 @@ //! instruction, starting at the EBB header. use dominator_tree::DominatorTree; -use entity_list::{EntityList, ListPool}; +use entity::{EntityList, ListPool}; use ir::instructions::BranchInfo; use ir::{Inst, Ebb, Value, DataFlowGraph, Layout, ExpandedProgramPoint}; use partition_slice::partition_slice; diff --git a/lib/cretonne/src/regalloc/liveness.rs b/lib/cretonne/src/regalloc/liveness.rs index 973e278f62..124252b4fc 100644 --- a/lib/cretonne/src/regalloc/liveness.rs +++ b/lib/cretonne/src/regalloc/liveness.rs @@ -175,13 +175,13 @@ //! //! There is some room for improvement. +use entity::SparseMap; use flowgraph::ControlFlowGraph; use ir::dfg::ValueDef; use ir::{Function, Value, Inst, Ebb, Layout, ProgramPoint}; use isa::{TargetIsa, EncInfo}; use regalloc::affinity::Affinity; use regalloc::liverange::LiveRange; -use sparse_map::SparseMap; use std::mem; use std::ops::Index; diff --git a/lib/cretonne/src/regalloc/liverange.rs b/lib/cretonne/src/regalloc/liverange.rs index 6b5353910e..e7ba997f6e 100644 --- a/lib/cretonne/src/regalloc/liverange.rs +++ b/lib/cretonne/src/regalloc/liverange.rs @@ -107,10 +107,10 @@ //! of coalescing, so we would need to roll our own. //! -use std::cmp::Ordering; +use entity::SparseMapValue; use ir::{Inst, Ebb, Value, ProgramPoint, ExpandedProgramPoint, ProgramOrder}; use regalloc::affinity::Affinity; -use sparse_map::SparseMapValue; +use std::cmp::Ordering; /// Global live range of a single SSA value. /// diff --git a/lib/cretonne/src/regalloc/reload.rs b/lib/cretonne/src/regalloc/reload.rs index 837dbd40d0..81c6c3661b 100644 --- a/lib/cretonne/src/regalloc/reload.rs +++ b/lib/cretonne/src/regalloc/reload.rs @@ -11,6 +11,7 @@ use cursor::{Cursor, EncCursor}; use dominator_tree::DominatorTree; +use entity::{SparseMap, SparseMapValue}; use ir::{Ebb, Inst, Value, Function}; use ir::{InstBuilder, ArgumentType, ArgumentLoc}; use isa::RegClass; @@ -18,7 +19,6 @@ use isa::{TargetIsa, Encoding, EncInfo, RecipeConstraints, ConstraintKind}; use regalloc::affinity::Affinity; use regalloc::live_value_tracker::{LiveValue, LiveValueTracker}; use regalloc::liveness::Liveness; -use sparse_map::{SparseMap, SparseMapValue}; use topo_order::TopoOrder; /// Reusable data structures for the reload pass. diff --git a/lib/cretonne/src/regalloc/solver.rs b/lib/cretonne/src/regalloc/solver.rs index 4cec792afe..c443180be2 100644 --- a/lib/cretonne/src/regalloc/solver.rs +++ b/lib/cretonne/src/regalloc/solver.rs @@ -105,10 +105,10 @@ //! appropriate candidate among the set of live register values, add it as a variable and start //! over. +use entity::{SparseMap, SparseMapValue}; use ir::Value; use isa::{RegInfo, RegClass, RegUnit}; use regalloc::allocatable_set::RegSetIter; -use sparse_map::{SparseMap, SparseMapValue}; use std::fmt; use super::AllocatableSet; diff --git a/lib/cretonne/src/regalloc/virtregs.rs b/lib/cretonne/src/regalloc/virtregs.rs index 722de5a1f4..7c98fd83e0 100644 --- a/lib/cretonne/src/regalloc/virtregs.rs +++ b/lib/cretonne/src/regalloc/virtregs.rs @@ -11,7 +11,7 @@ //! If any values in a virtual register are spilled, they will use the same stack slot. This avoids //! memory-to-memory copies when a spilled value is passed as an EBB argument. -use entity_list::{EntityList, ListPool}; +use entity::{EntityList, ListPool}; use entity::{PrimaryMap, EntityMap, Keys}; use ir::Value; use packed_option::PackedOption; diff --git a/lib/cretonne/src/topo_order.rs b/lib/cretonne/src/topo_order.rs index 938e4a876a..0e9210e239 100644 --- a/lib/cretonne/src/topo_order.rs +++ b/lib/cretonne/src/topo_order.rs @@ -1,8 +1,8 @@ //! Topological order of EBBs, according to the dominator tree. +use entity::SparseSet; use dominator_tree::DominatorTree; use ir::{Ebb, Layout}; -use sparse_map::SparseSet; /// Present EBBs in a topological order such that all dominating EBBs are guaranteed to be visited /// before the current EBB. diff --git a/lib/cretonne/src/verifier/mod.rs b/lib/cretonne/src/verifier/mod.rs index 15b5219334..714ad2532d 100644 --- a/lib/cretonne/src/verifier/mod.rs +++ b/lib/cretonne/src/verifier/mod.rs @@ -58,6 +58,7 @@ use dbg::DisplayList; use dominator_tree::DominatorTree; +use entity::SparseSet; use flowgraph::ControlFlowGraph; use ir; use ir::entities::AnyEntity; @@ -65,7 +66,6 @@ use ir::instructions::{InstructionFormat, BranchInfo, ResolvedConstraint, CallIn use ir::{types, Function, ValueDef, Ebb, Inst, SigRef, FuncRef, ValueList, JumpTable, StackSlot, StackSlotKind, GlobalVar, Value, Type, Opcode, ValueLoc, ArgumentLoc}; use isa::TargetIsa; -use sparse_map::SparseSet; use std::error as std_error; use std::fmt::{self, Display, Formatter}; use std::result;