Add typedefs for the common entity maps.
The various entity maps in a function end up being referenced in multiple places, so create typedefs for them.
This commit is contained in:
@@ -3,12 +3,11 @@
|
||||
//! The `Function` struct defined in this module owns all of its extended basic blocks and
|
||||
//! instructions.
|
||||
|
||||
use binemit::CodeOffset;
|
||||
use entity_map::{EntityMap, PrimaryEntityData};
|
||||
use ir::{FunctionName, Signature, Value, Inst, Ebb, StackSlots, JumpTable, JumpTableData,
|
||||
ValueLoc, DataFlowGraph, Layout};
|
||||
use isa::{TargetIsa, Encoding};
|
||||
use std::fmt::{self, Display, Debug, Formatter};
|
||||
use ir::{FunctionName, Signature, JumpTableData, DataFlowGraph, Layout};
|
||||
use ir::{JumpTables, InstEncodings, ValueLocations, StackSlots, EbbOffsets};
|
||||
use isa::TargetIsa;
|
||||
use std::fmt;
|
||||
use write::write_function;
|
||||
|
||||
/// A function.
|
||||
@@ -27,7 +26,7 @@ pub struct Function {
|
||||
pub stack_slots: StackSlots,
|
||||
|
||||
/// Jump tables used in this function.
|
||||
pub jump_tables: EntityMap<JumpTable, JumpTableData>,
|
||||
pub jump_tables: JumpTables,
|
||||
|
||||
/// Data flow graph containing the primary definition of all instructions, EBBs and values.
|
||||
pub dfg: DataFlowGraph,
|
||||
@@ -37,17 +36,17 @@ pub struct Function {
|
||||
|
||||
/// Encoding recipe and bits for the legal instructions.
|
||||
/// Illegal instructions have the `Encoding::default()` value.
|
||||
pub encodings: EntityMap<Inst, Encoding>,
|
||||
pub encodings: InstEncodings,
|
||||
|
||||
/// Location assigned to every value.
|
||||
pub locations: EntityMap<Value, ValueLoc>,
|
||||
pub locations: ValueLocations,
|
||||
|
||||
/// Code offsets of the EBB headers.
|
||||
///
|
||||
/// This information is only transiently available after the `binemit::relax_branches` function
|
||||
/// computes it, and it can easily be recomputed by calling that function. It is not included
|
||||
/// in the textual IL format.
|
||||
pub offsets: EntityMap<Ebb, CodeOffset>,
|
||||
pub offsets: EbbOffsets,
|
||||
}
|
||||
|
||||
impl PrimaryEntityData for JumpTableData {}
|
||||
@@ -82,20 +81,20 @@ impl Function {
|
||||
/// Wrapper type capable of displaying a `Function` with correct ISA annotations.
|
||||
pub struct DisplayFunction<'a>(&'a Function, Option<&'a TargetIsa>);
|
||||
|
||||
impl<'a> Display for DisplayFunction<'a> {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
impl<'a> fmt::Display for DisplayFunction<'a> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write_function(fmt, self.0, self.1)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Function {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
impl fmt::Display for Function {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write_function(fmt, self, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for Function {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
impl fmt::Debug for Function {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write_function(fmt, self, None)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user