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:
@@ -2,6 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! This module defines an `EntityRef` trait that should be implemented by reference types wrapping
|
//! This module defines an `EntityRef` trait that should be implemented by reference types wrapping
|
||||||
//! a small integer index.
|
//! 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
|
/// A type wrapping a small integer index should implement `EntityRef` so it can be used as the key
|
||||||
/// of an `EntityMap` or `SparseMap`.
|
/// of an `EntityMap` or `SparseMap`.
|
||||||
@@ -19,7 +21,7 @@ pub trait EntityRef: Copy + Eq {
|
|||||||
macro_rules! entity_impl {
|
macro_rules! entity_impl {
|
||||||
// Basic traits.
|
// Basic traits.
|
||||||
($entity:ident) => {
|
($entity:ident) => {
|
||||||
impl $crate::entity_ref::EntityRef for $entity {
|
impl $crate::entity::EntityRef for $entity {
|
||||||
fn new(index: usize) -> Self {
|
fn new(index: usize) -> Self {
|
||||||
assert!(index < (::std::u32::MAX as usize));
|
assert!(index < (::std::u32::MAX as usize));
|
||||||
$entity(index as u32)
|
$entity(index as u32)
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
//! The index stored in an `EntityList` points to part 2, the list elements. The value 0 is
|
//! 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.
|
//! 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::hash::{Hash, Hasher};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
@@ -483,7 +483,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use super::{sclass_size, sclass_for_length};
|
use super::{sclass_size, sclass_for_length};
|
||||||
use ir::Inst;
|
use ir::Inst;
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn size_classes() {
|
fn size_classes() {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
//! - A *secondary* `EntityMap` contains additional data about entities kept in a primary map. The
|
//! - 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`.
|
//! 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::marker::PhantomData;
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ impl Display for JumpTableData {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::JumpTableData;
|
use super::JumpTableData;
|
||||||
use ir::Ebb;
|
use ir::Ebb;
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty() {
|
fn empty() {
|
||||||
|
|||||||
@@ -1086,7 +1086,7 @@ impl<'c, 'fc: 'c, 'fd> InstInserterBase<'fd> for LayoutCursorInserter<'c, 'fc, '
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{Layout, Cursor, CursorBase, CursorPosition};
|
use super::{Layout, Cursor, CursorBase, CursorPosition};
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::{Ebb, Inst, ProgramOrder};
|
use ir::{Ebb, Inst, ProgramOrder};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Program points.
|
//! Program points.
|
||||||
|
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::{Ebb, Inst, ValueDef};
|
use ir::{Ebb, Inst, ValueDef};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
@@ -135,7 +135,7 @@ pub trait ProgramOrder {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::{Inst, Ebb};
|
use ir::{Inst, Ebb};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Data structures describing the registers in an ISA.
|
//! Data structures describing the registers in an ISA.
|
||||||
|
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// Register units are the smallest units of register allocation.
|
/// Register units are the smallest units of register allocation.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod dbg;
|
pub mod dbg;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod entity_ref;
|
pub mod entity;
|
||||||
|
|
||||||
pub mod binemit;
|
pub mod binemit;
|
||||||
pub mod bitset;
|
pub mod bitset;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ impl RegDiversions {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ir::Value;
|
use ir::Value;
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn inserts() {
|
fn inserts() {
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ impl SparseMapValue<Value> for LiveRange {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::LiveRange;
|
use super::LiveRange;
|
||||||
use ir::{Inst, Ebb, Value};
|
use ir::{Inst, Ebb, Value};
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::{ProgramOrder, ExpandedProgramPoint};
|
use ir::{ProgramOrder, ExpandedProgramPoint};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
|
|||||||
@@ -702,7 +702,7 @@ impl Solver {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[cfg(build_arm32)]
|
#[cfg(build_arm32)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::Value;
|
use ir::Value;
|
||||||
use isa::{TargetIsa, RegClass, RegUnit};
|
use isa::{TargetIsa, RegClass, RegUnit};
|
||||||
use regalloc::AllocatableSet;
|
use regalloc::AllocatableSet;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
//! contain their own key.
|
//! contain their own key.
|
||||||
|
|
||||||
use entity_map::EntityMap;
|
use entity_map::EntityMap;
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
@@ -221,7 +221,7 @@ pub type SparseSet<T> = SparseMap<T, T>;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use entity_ref::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::Inst;
|
use ir::Inst;
|
||||||
|
|
||||||
// Mock key-value object for testing.
|
// Mock key-value object for testing.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use cretonne::ir::function::DisplayFunction;
|
|||||||
use cretonne::isa::TargetIsa;
|
use cretonne::isa::TargetIsa;
|
||||||
use ssa::{SSABuilder, SideEffects, Block};
|
use ssa::{SSABuilder, SideEffects, Block};
|
||||||
use cretonne::entity_map::{EntityMap, PrimaryEntityData};
|
use cretonne::entity_map::{EntityMap, PrimaryEntityData};
|
||||||
use cretonne::entity_ref::EntityRef;
|
use cretonne::entity::EntityRef;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
/// Permanent structure used for translating into Cretonne IL.
|
/// Permanent structure used for translating into Cretonne IL.
|
||||||
@@ -571,7 +571,7 @@ impl<'a, Variable> FunctionBuilder<'a, Variable>
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use cretonne::entity_ref::EntityRef;
|
use cretonne::entity::EntityRef;
|
||||||
use cretonne::ir::{FunctionName, Function, CallConv, Signature, ArgumentType, InstBuilder};
|
use cretonne::ir::{FunctionName, Function, CallConv, Signature, ArgumentType, InstBuilder};
|
||||||
use cretonne::ir::types::*;
|
use cretonne::ir::types::*;
|
||||||
use frontend::{ILBuilder, FunctionBuilder};
|
use frontend::{ILBuilder, FunctionBuilder};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
//! extern crate cretonne;
|
//! extern crate cretonne;
|
||||||
//! extern crate cton_frontend;
|
//! 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::{FunctionName, CallConv, Function, Signature, ArgumentType, InstBuilder};
|
||||||
//! use cretonne::ir::types::*;
|
//! use cretonne::ir::types::*;
|
||||||
//! use cton_frontend::{ILBuilder, FunctionBuilder};
|
//! use cton_frontend::{ILBuilder, FunctionBuilder};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use cretonne::ir::{Ebb, Value, Inst, Type, DataFlowGraph, JumpTables, Layout, Cu
|
|||||||
use cretonne::ir::instructions::BranchInfo;
|
use cretonne::ir::instructions::BranchInfo;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use cretonne::entity_map::{EntityMap, PrimaryEntityData};
|
use cretonne::entity_map::{EntityMap, PrimaryEntityData};
|
||||||
use cretonne::entity_ref::EntityRef;
|
use cretonne::entity::EntityRef;
|
||||||
use cretonne::packed_option::PackedOption;
|
use cretonne::packed_option::PackedOption;
|
||||||
use cretonne::packed_option::ReservedValue;
|
use cretonne::packed_option::ReservedValue;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
@@ -607,7 +607,7 @@ impl<Variable> SSABuilder<Variable>
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use cretonne::entity_ref::EntityRef;
|
use cretonne::entity::EntityRef;
|
||||||
use cretonne::ir::{Function, InstBuilder, Cursor, CursorBase, Inst, JumpTableData};
|
use cretonne::ir::{Function, InstBuilder, Cursor, CursorBase, Inst, JumpTableData};
|
||||||
use cretonne::ir::types::*;
|
use cretonne::ir::types::*;
|
||||||
use cretonne::verify_function;
|
use cretonne::verify_function;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
//! The `SourceMap` struct defined in this module makes the same mapping available to parser
|
//! The `SourceMap` struct defined in this module makes the same mapping available to parser
|
||||||
//! clients.
|
//! clients.
|
||||||
|
|
||||||
use cretonne::entity_ref::EntityRef;
|
use cretonne::entity::EntityRef;
|
||||||
use cretonne::ir::entities::AnyEntity;
|
use cretonne::ir::entities::AnyEntity;
|
||||||
use cretonne::ir::{StackSlot, GlobalVar, JumpTable, Ebb, Value, SigRef, FuncRef};
|
use cretonne::ir::{StackSlot, GlobalVar, JumpTable, Ebb, Value, SigRef, FuncRef};
|
||||||
use error::{Result, Location};
|
use error::{Result, Location};
|
||||||
|
|||||||
Reference in New Issue
Block a user