Rename the entity_ref module to 'entity'.

This is in preparation for moving a number of data structures into
sub-modules of the 'entity' module:

- EntityList
- EntityMap
- SparseMap
This commit is contained in:
Jakob Stoklund Olesen
2017-08-18 14:37:03 -07:00
parent c7b9bc1abf
commit 8599372098
16 changed files with 23 additions and 21 deletions

View File

@@ -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)

View File

@@ -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() {

View File

@@ -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};

View File

@@ -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() {

View File

@@ -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;

View File

@@ -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]

View File

@@ -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.

View File

@@ -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;

View File

@@ -104,7 +104,7 @@ impl RegDiversions {
mod tests {
use super::*;
use ir::Value;
use entity_ref::EntityRef;
use entity::EntityRef;
#[test]
fn inserts() {

View File

@@ -435,7 +435,7 @@ impl SparseMapValue<Value> 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;

View File

@@ -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;

View File

@@ -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<T> = SparseMap<T, T>;
#[cfg(test)]
mod tests {
use super::*;
use entity_ref::EntityRef;
use entity::EntityRef;
use ir::Inst;
// Mock key-value object for testing.

View File

@@ -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};

View File

@@ -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};

View File

@@ -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<Variable> SSABuilder<Variable>
#[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;

View File

@@ -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};