Remove obsolete derivations of Hash.
This commit is contained in:
@@ -8,12 +8,11 @@ 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::{EntityRef, EntityMap, EntitySet};
|
use cretonne::entity::{EntityRef, EntityMap, EntitySet};
|
||||||
use std::hash::Hash;
|
|
||||||
|
|
||||||
/// Permanent structure used for translating into Cretonne IL.
|
/// Permanent structure used for translating into Cretonne IL.
|
||||||
pub struct ILBuilder<Variable>
|
pub struct ILBuilder<Variable>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
ssa: SSABuilder<Variable>,
|
ssa: SSABuilder<Variable>,
|
||||||
ebbs: EntityMap<Ebb, EbbData>,
|
ebbs: EntityMap<Ebb, EbbData>,
|
||||||
@@ -25,7 +24,7 @@ where
|
|||||||
/// Temporary object used to build a Cretonne IL `Function`.
|
/// Temporary object used to build a Cretonne IL `Function`.
|
||||||
pub struct FunctionBuilder<'a, Variable: 'a>
|
pub struct FunctionBuilder<'a, Variable: 'a>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
/// The function currently being built.
|
/// The function currently being built.
|
||||||
/// This field is public so the function can be re-borrowed.
|
/// This field is public so the function can be re-borrowed.
|
||||||
@@ -50,7 +49,7 @@ struct Position {
|
|||||||
|
|
||||||
impl<Variable> ILBuilder<Variable>
|
impl<Variable> ILBuilder<Variable>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
/// Creates a ILBuilder structure. The structure is automatically cleared each time it is
|
/// Creates a ILBuilder structure. The structure is automatically cleared each time it is
|
||||||
/// passed to a [`FunctionBuilder`](struct.FunctionBuilder.html) for creation.
|
/// passed to a [`FunctionBuilder`](struct.FunctionBuilder.html) for creation.
|
||||||
@@ -75,24 +74,26 @@ where
|
|||||||
/// one convenience method per Cretonne IL instruction.
|
/// one convenience method per Cretonne IL instruction.
|
||||||
pub struct FuncInstBuilder<'short, 'long: 'short, Variable: 'long>
|
pub struct FuncInstBuilder<'short, 'long: 'short, Variable: 'long>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
builder: &'short mut FunctionBuilder<'long, Variable>,
|
builder: &'short mut FunctionBuilder<'long, Variable>,
|
||||||
ebb: Ebb,
|
ebb: Ebb,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'short, 'long, Variable> FuncInstBuilder<'short, 'long, Variable>
|
impl<'short, 'long, Variable> FuncInstBuilder<'short, 'long, Variable>
|
||||||
where Variable: EntityRef + Hash + Default
|
where
|
||||||
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
fn new<'s, 'l>(builder: &'s mut FunctionBuilder<'l, Variable>,
|
fn new<'s, 'l>(
|
||||||
ebb: Ebb)
|
builder: &'s mut FunctionBuilder<'l, Variable>,
|
||||||
-> FuncInstBuilder<'s, 'l, Variable> {
|
ebb: Ebb,
|
||||||
|
) -> FuncInstBuilder<'s, 'l, Variable> {
|
||||||
FuncInstBuilder { builder, ebb }
|
FuncInstBuilder { builder, ebb }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'short, 'long, Variable> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long, Variable>
|
impl<'short, 'long, Variable> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long, Variable>
|
||||||
where Variable: EntityRef + Hash + Default
|
where Variable: EntityRef + Default
|
||||||
{
|
{
|
||||||
fn data_flow_graph(&self) -> &DataFlowGraph {
|
fn data_flow_graph(&self) -> &DataFlowGraph {
|
||||||
&self.builder.func.dfg
|
&self.builder.func.dfg
|
||||||
@@ -201,7 +202,7 @@ impl<'short, 'long, Variable> InstBuilderBase<'short> for FuncInstBuilder<'short
|
|||||||
/// return instruction with arguments that don't match the function's signature.
|
/// return instruction with arguments that don't match the function's signature.
|
||||||
impl<'a, Variable> FunctionBuilder<'a, Variable>
|
impl<'a, Variable> FunctionBuilder<'a, Variable>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
/// Creates a new FunctionBuilder structure that will operate on a `Function` using a
|
/// Creates a new FunctionBuilder structure that will operate on a `Function` using a
|
||||||
/// `IlBuilder`.
|
/// `IlBuilder`.
|
||||||
@@ -404,7 +405,7 @@ where
|
|||||||
/// in ways that can be unsafe if used incorrectly.
|
/// in ways that can be unsafe if used incorrectly.
|
||||||
impl<'a, Variable> FunctionBuilder<'a, Variable>
|
impl<'a, Variable> FunctionBuilder<'a, Variable>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
/// Retrieves all the arguments for an `Ebb` currently infered from the jump instructions
|
/// Retrieves all the arguments for an `Ebb` currently infered from the jump instructions
|
||||||
/// inserted that target it and the SSA construction.
|
/// inserted that target it and the SSA construction.
|
||||||
@@ -483,7 +484,7 @@ where
|
|||||||
|
|
||||||
impl<'a, Variable> Drop for FunctionBuilder<'a, Variable>
|
impl<'a, Variable> Drop for FunctionBuilder<'a, Variable>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
/// When a `FunctionBuilder` goes out of scope, it means that the function is fully built.
|
/// When a `FunctionBuilder` goes out of scope, it means that the function is fully built.
|
||||||
/// We then proceed to check if all the `Ebb`s are filled and sealed
|
/// We then proceed to check if all the `Ebb`s are filled and sealed
|
||||||
@@ -501,7 +502,7 @@ where
|
|||||||
// Helper functions
|
// Helper functions
|
||||||
impl<'a, Variable> FunctionBuilder<'a, Variable>
|
impl<'a, Variable> FunctionBuilder<'a, Variable>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
fn move_to_next_basic_block(&mut self) {
|
fn move_to_next_basic_block(&mut self) {
|
||||||
self.position.basic_block = self.builder.ssa.declare_ebb_body_block(
|
self.position.basic_block = self.builder.ssa.declare_ebb_body_block(
|
||||||
@@ -634,7 +635,7 @@ mod tests {
|
|||||||
use std::u32;
|
use std::u32;
|
||||||
|
|
||||||
// An opaque reference to variable.
|
// An opaque reference to variable.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Variable(u32);
|
pub struct Variable(u32);
|
||||||
impl EntityRef for Variable {
|
impl EntityRef for Variable {
|
||||||
fn new(index: usize) -> Self {
|
fn new(index: usize) -> Self {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
//! use std::u32;
|
//! use std::u32;
|
||||||
//!
|
//!
|
||||||
//! // An opaque reference to variable.
|
//! // An opaque reference to variable.
|
||||||
//! #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
//! #[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
//! pub struct Variable(u32);
|
//! pub struct Variable(u32);
|
||||||
//! impl EntityRef for Variable {
|
//! impl EntityRef for Variable {
|
||||||
//! fn new(index: usize) -> Self {
|
//! fn new(index: usize) -> Self {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
use cretonne::ir::{Ebb, Value, Inst, Type, DataFlowGraph, JumpTables, Layout, Cursor, CursorBase,
|
use cretonne::ir::{Ebb, Value, Inst, Type, DataFlowGraph, JumpTables, Layout, Cursor, CursorBase,
|
||||||
InstBuilder};
|
InstBuilder};
|
||||||
use cretonne::ir::instructions::BranchInfo;
|
use cretonne::ir::instructions::BranchInfo;
|
||||||
use std::hash::Hash;
|
|
||||||
use cretonne::entity::{EntityRef, PrimaryMap, EntityMap};
|
use cretonne::entity::{EntityRef, PrimaryMap, EntityMap};
|
||||||
use cretonne::packed_option::PackedOption;
|
use cretonne::packed_option::PackedOption;
|
||||||
use cretonne::packed_option::ReservedValue;
|
use cretonne::packed_option::ReservedValue;
|
||||||
@@ -200,7 +199,7 @@ enum UseVarCases {
|
|||||||
///
|
///
|
||||||
impl<Variable> SSABuilder<Variable>
|
impl<Variable> SSABuilder<Variable>
|
||||||
where
|
where
|
||||||
Variable: EntityRef + Hash + Default,
|
Variable: EntityRef + Default,
|
||||||
{
|
{
|
||||||
/// Declares a new definition of a variable in a given basic block.
|
/// Declares a new definition of a variable in a given basic block.
|
||||||
/// The SSA value is passed as an argument because it should be created with
|
/// The SSA value is passed as an argument because it should be created with
|
||||||
@@ -594,7 +593,7 @@ mod tests {
|
|||||||
use std::u32;
|
use std::u32;
|
||||||
|
|
||||||
/// An opaque reference to variable.
|
/// An opaque reference to variable.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Variable(u32);
|
pub struct Variable(u32);
|
||||||
impl EntityRef for Variable {
|
impl EntityRef for Variable {
|
||||||
fn new(index: usize) -> Self {
|
fn new(index: usize) -> Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user