diff --git a/lib/cretonne/src/entity_ref.rs b/lib/cretonne/src/entity/mod.rs similarity index 91% rename from lib/cretonne/src/entity_ref.rs rename to lib/cretonne/src/entity/mod.rs index 9990b521f0..26c1e54353 100644 --- a/lib/cretonne/src/entity_ref.rs +++ b/lib/cretonne/src/entity/mod.rs @@ -2,6 +2,8 @@ //! //! This module defines an `EntityRef` trait that should be implemented by reference types wrapping //! a small integer index. +//! +//! Various data structures based on the entity references are defined in sub-modules. /// A type wrapping a small integer index should implement `EntityRef` so it can be used as the key /// of an `EntityMap` or `SparseMap`. @@ -19,7 +21,7 @@ pub trait EntityRef: Copy + Eq { macro_rules! entity_impl { // Basic traits. ($entity:ident) => { - impl $crate::entity_ref::EntityRef for $entity { + impl $crate::entity::EntityRef for $entity { fn new(index: usize) -> Self { assert!(index < (::std::u32::MAX as usize)); $entity(index as u32) diff --git a/lib/cretonne/src/entity_list.rs b/lib/cretonne/src/entity_list.rs index 4b535e3f56..3685f00eab 100644 --- a/lib/cretonne/src/entity_list.rs +++ b/lib/cretonne/src/entity_list.rs @@ -46,7 +46,7 @@ //! The index stored in an `EntityList` points to part 2, the list elements. The value 0 is //! reserved for the empty list which isn't allocated in the vector. -use entity_ref::EntityRef; +use entity::EntityRef; use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use std::mem; @@ -483,7 +483,7 @@ mod tests { use super::*; use super::{sclass_size, sclass_for_length}; use ir::Inst; - use entity_ref::EntityRef; + use entity::EntityRef; #[test] fn size_classes() { diff --git a/lib/cretonne/src/entity_map.rs b/lib/cretonne/src/entity_map.rs index be73b790e1..7afb863ed0 100644 --- a/lib/cretonne/src/entity_map.rs +++ b/lib/cretonne/src/entity_map.rs @@ -9,7 +9,7 @@ //! - A *secondary* `EntityMap` contains additional data about entities kept in a primary map. The //! values need to implement `Clone + Default` traits so the map can be grown with `ensure`. -use entity_ref::EntityRef; +use entity::EntityRef; use std::marker::PhantomData; use std::ops::{Index, IndexMut}; diff --git a/lib/cretonne/src/ir/jumptable.rs b/lib/cretonne/src/ir/jumptable.rs index aaaa694a50..c0f97afea3 100644 --- a/lib/cretonne/src/ir/jumptable.rs +++ b/lib/cretonne/src/ir/jumptable.rs @@ -122,7 +122,7 @@ impl Display for JumpTableData { mod tests { use super::JumpTableData; use ir::Ebb; - use entity_ref::EntityRef; + use entity::EntityRef; #[test] fn empty() { diff --git a/lib/cretonne/src/ir/layout.rs b/lib/cretonne/src/ir/layout.rs index 3f31d34f23..9e03daa8a9 100644 --- a/lib/cretonne/src/ir/layout.rs +++ b/lib/cretonne/src/ir/layout.rs @@ -1086,7 +1086,7 @@ impl<'c, 'fc: 'c, 'fd> InstInserterBase<'fd> for LayoutCursorInserter<'c, 'fc, ' #[cfg(test)] mod tests { use super::{Layout, Cursor, CursorBase, CursorPosition}; - use entity_ref::EntityRef; + use entity::EntityRef; use ir::{Ebb, Inst, ProgramOrder}; use std::cmp::Ordering; diff --git a/lib/cretonne/src/ir/progpoint.rs b/lib/cretonne/src/ir/progpoint.rs index 7adeb43c5c..7d6e9197bd 100644 --- a/lib/cretonne/src/ir/progpoint.rs +++ b/lib/cretonne/src/ir/progpoint.rs @@ -1,6 +1,6 @@ //! Program points. -use entity_ref::EntityRef; +use entity::EntityRef; use ir::{Ebb, Inst, ValueDef}; use std::fmt; use std::u32; @@ -135,7 +135,7 @@ pub trait ProgramOrder { #[cfg(test)] mod tests { use super::*; - use entity_ref::EntityRef; + use entity::EntityRef; use ir::{Inst, Ebb}; #[test] diff --git a/lib/cretonne/src/isa/registers.rs b/lib/cretonne/src/isa/registers.rs index 2823fbea37..eacce024fb 100644 --- a/lib/cretonne/src/isa/registers.rs +++ b/lib/cretonne/src/isa/registers.rs @@ -1,6 +1,6 @@ //! Data structures describing the registers in an ISA. -use entity_ref::EntityRef; +use entity::EntityRef; use std::fmt; /// Register units are the smallest units of register allocation. diff --git a/lib/cretonne/src/lib.rs b/lib/cretonne/src/lib.rs index b021bf55b2..324698c53c 100644 --- a/lib/cretonne/src/lib.rs +++ b/lib/cretonne/src/lib.rs @@ -13,7 +13,7 @@ pub const VERSION: &'static str = env!("CARGO_PKG_VERSION"); #[macro_use] pub mod dbg; #[macro_use] -pub mod entity_ref; +pub mod entity; pub mod binemit; pub mod bitset; diff --git a/lib/cretonne/src/regalloc/diversion.rs b/lib/cretonne/src/regalloc/diversion.rs index 4f17d3685d..bbc5c067ae 100644 --- a/lib/cretonne/src/regalloc/diversion.rs +++ b/lib/cretonne/src/regalloc/diversion.rs @@ -104,7 +104,7 @@ impl RegDiversions { mod tests { use super::*; use ir::Value; - use entity_ref::EntityRef; + use entity::EntityRef; #[test] fn inserts() { diff --git a/lib/cretonne/src/regalloc/liverange.rs b/lib/cretonne/src/regalloc/liverange.rs index 9174e0cdba..6b5353910e 100644 --- a/lib/cretonne/src/regalloc/liverange.rs +++ b/lib/cretonne/src/regalloc/liverange.rs @@ -435,7 +435,7 @@ impl SparseMapValue for LiveRange { mod tests { use super::LiveRange; use ir::{Inst, Ebb, Value}; - use entity_ref::EntityRef; + use entity::EntityRef; use ir::{ProgramOrder, ExpandedProgramPoint}; use std::cmp::Ordering; diff --git a/lib/cretonne/src/regalloc/solver.rs b/lib/cretonne/src/regalloc/solver.rs index ea028f551b..4cec792afe 100644 --- a/lib/cretonne/src/regalloc/solver.rs +++ b/lib/cretonne/src/regalloc/solver.rs @@ -702,7 +702,7 @@ impl Solver { #[cfg(test)] #[cfg(build_arm32)] mod tests { - use entity_ref::EntityRef; + use entity::EntityRef; use ir::Value; use isa::{TargetIsa, RegClass, RegUnit}; use regalloc::AllocatableSet; diff --git a/lib/cretonne/src/sparse_map.rs b/lib/cretonne/src/sparse_map.rs index c1a8bf5480..84c17f7b5f 100644 --- a/lib/cretonne/src/sparse_map.rs +++ b/lib/cretonne/src/sparse_map.rs @@ -36,7 +36,7 @@ //! contain their own key. use entity_map::EntityMap; -use entity_ref::EntityRef; +use entity::EntityRef; use std::mem; use std::slice; use std::u32; @@ -221,7 +221,7 @@ pub type SparseSet = SparseMap; #[cfg(test)] mod tests { use super::*; - use entity_ref::EntityRef; + use entity::EntityRef; use ir::Inst; // Mock key-value object for testing. diff --git a/lib/frontend/src/frontend.rs b/lib/frontend/src/frontend.rs index d81cee4bc7..935251e89e 100644 --- a/lib/frontend/src/frontend.rs +++ b/lib/frontend/src/frontend.rs @@ -7,7 +7,7 @@ use cretonne::ir::function::DisplayFunction; use cretonne::isa::TargetIsa; use ssa::{SSABuilder, SideEffects, Block}; use cretonne::entity_map::{EntityMap, PrimaryEntityData}; -use cretonne::entity_ref::EntityRef; +use cretonne::entity::EntityRef; use std::hash::Hash; /// Permanent structure used for translating into Cretonne IL. @@ -571,7 +571,7 @@ impl<'a, Variable> FunctionBuilder<'a, Variable> #[cfg(test)] mod tests { - use cretonne::entity_ref::EntityRef; + use cretonne::entity::EntityRef; use cretonne::ir::{FunctionName, Function, CallConv, Signature, ArgumentType, InstBuilder}; use cretonne::ir::types::*; use frontend::{ILBuilder, FunctionBuilder}; diff --git a/lib/frontend/src/lib.rs b/lib/frontend/src/lib.rs index 10a06b23cc..69723ae50c 100644 --- a/lib/frontend/src/lib.rs +++ b/lib/frontend/src/lib.rs @@ -35,7 +35,7 @@ //! extern crate cretonne; //! extern crate cton_frontend; //! -//! use cretonne::entity_ref::EntityRef; +//! use cretonne::entity::EntityRef; //! use cretonne::ir::{FunctionName, CallConv, Function, Signature, ArgumentType, InstBuilder}; //! use cretonne::ir::types::*; //! use cton_frontend::{ILBuilder, FunctionBuilder}; diff --git a/lib/frontend/src/ssa.rs b/lib/frontend/src/ssa.rs index fc5c85f1dd..bad49c6264 100644 --- a/lib/frontend/src/ssa.rs +++ b/lib/frontend/src/ssa.rs @@ -10,7 +10,7 @@ use cretonne::ir::{Ebb, Value, Inst, Type, DataFlowGraph, JumpTables, Layout, Cu use cretonne::ir::instructions::BranchInfo; use std::hash::Hash; use cretonne::entity_map::{EntityMap, PrimaryEntityData}; -use cretonne::entity_ref::EntityRef; +use cretonne::entity::EntityRef; use cretonne::packed_option::PackedOption; use cretonne::packed_option::ReservedValue; use std::u32; @@ -607,7 +607,7 @@ impl SSABuilder #[cfg(test)] mod tests { - use cretonne::entity_ref::EntityRef; + use cretonne::entity::EntityRef; use cretonne::ir::{Function, InstBuilder, Cursor, CursorBase, Inst, JumpTableData}; use cretonne::ir::types::*; use cretonne::verify_function; diff --git a/lib/reader/src/sourcemap.rs b/lib/reader/src/sourcemap.rs index b085a78c1b..cfd7e85cec 100644 --- a/lib/reader/src/sourcemap.rs +++ b/lib/reader/src/sourcemap.rs @@ -7,7 +7,7 @@ //! The `SourceMap` struct defined in this module makes the same mapping available to parser //! clients. -use cretonne::entity_ref::EntityRef; +use cretonne::entity::EntityRef; use cretonne::ir::entities::AnyEntity; use cretonne::ir::{StackSlot, GlobalVar, JumpTable, Ebb, Value, SigRef, FuncRef}; use error::{Result, Location};