Use Self instead of repeating the type name.
This commit is contained in:
@@ -37,8 +37,8 @@ impl AllocatableSet {
|
||||
///
|
||||
/// Note that this includes *all* registers. Query the `TargetIsa` object to get a set of
|
||||
/// allocatable registers where reserved registers have been filtered out.
|
||||
pub fn new() -> AllocatableSet {
|
||||
AllocatableSet { avail: [!0; 3] }
|
||||
pub fn new() -> Self {
|
||||
Self { avail: [!0; 3] }
|
||||
}
|
||||
|
||||
/// Returns `true` if the specified register is available.
|
||||
|
||||
@@ -74,8 +74,8 @@ impl Node {
|
||||
|
||||
impl DomForest {
|
||||
/// Create a new empty dominator forest.
|
||||
pub fn new() -> DomForest {
|
||||
DomForest {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
values: Vec::new(),
|
||||
stack: Vec::new(),
|
||||
}
|
||||
@@ -252,8 +252,8 @@ struct Context<'a> {
|
||||
|
||||
impl Coalescing {
|
||||
/// Create a new coalescing pass.
|
||||
pub fn new() -> Coalescing {
|
||||
Coalescing {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
forest: DomForest::new(),
|
||||
values: Vec::new(),
|
||||
split_values: Vec::new(),
|
||||
|
||||
@@ -101,8 +101,8 @@ struct Context<'a> {
|
||||
|
||||
impl Coloring {
|
||||
/// Allocate scratch space data structures for the coloring pass.
|
||||
pub fn new() -> Coloring {
|
||||
Coloring {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
divert: RegDiversions::new(),
|
||||
solver: Solver::new(),
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ impl Context {
|
||||
///
|
||||
/// This context should be reused for multiple functions in order to avoid repeated memory
|
||||
/// allocations.
|
||||
pub fn new() -> Context {
|
||||
Context {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
liveness: Liveness::new(),
|
||||
virtregs: VirtRegs::new(),
|
||||
coalescing: Coalescing::new(),
|
||||
|
||||
@@ -44,8 +44,8 @@ pub struct RegDiversions {
|
||||
|
||||
impl RegDiversions {
|
||||
/// Create a new empty diversion tracker.
|
||||
pub fn new() -> RegDiversions {
|
||||
RegDiversions { current: Vec::new() }
|
||||
pub fn new() -> Self {
|
||||
Self { current: Vec::new() }
|
||||
}
|
||||
|
||||
/// Clear the tracker, preparing for a new EBB.
|
||||
|
||||
@@ -65,8 +65,8 @@ struct LiveValueVec {
|
||||
}
|
||||
|
||||
impl LiveValueVec {
|
||||
fn new() -> LiveValueVec {
|
||||
LiveValueVec {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
values: Vec::new(),
|
||||
live_prefix: None,
|
||||
}
|
||||
@@ -124,8 +124,8 @@ impl LiveValueVec {
|
||||
|
||||
impl LiveValueTracker {
|
||||
/// Create a new blank tracker.
|
||||
pub fn new() -> LiveValueTracker {
|
||||
LiveValueTracker {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
live: LiveValueVec::new(),
|
||||
idom_sets: HashMap::new(),
|
||||
idom_pool: ListPool::new(),
|
||||
|
||||
@@ -299,8 +299,8 @@ impl Liveness {
|
||||
///
|
||||
/// The memory allocated for this analysis can be reused for multiple functions. Use the
|
||||
/// `compute` method to actually runs the analysis for a function.
|
||||
pub fn new() -> Liveness {
|
||||
Liveness {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
ranges: LiveRangeSet::new(),
|
||||
worklist: Vec::new(),
|
||||
ebb_params: Vec::new(),
|
||||
|
||||
@@ -46,8 +46,8 @@ struct Context<'a> {
|
||||
|
||||
impl Reload {
|
||||
/// Create a new blank reload pass.
|
||||
pub fn new() -> Reload {
|
||||
Reload {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
candidates: Vec::new(),
|
||||
reloads: SparseMap::new(),
|
||||
}
|
||||
|
||||
@@ -502,8 +502,8 @@ pub struct Solver {
|
||||
/// Interface for programming the constraints into the solver.
|
||||
impl Solver {
|
||||
/// Create a new empty solver.
|
||||
pub fn new() -> Solver {
|
||||
Solver {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
assignments: SparseMap::new(),
|
||||
vars: Vec::new(),
|
||||
inputs_done: false,
|
||||
|
||||
@@ -63,8 +63,8 @@ struct Context<'a> {
|
||||
|
||||
impl Spilling {
|
||||
/// Create a new spilling data structure.
|
||||
pub fn new() -> Spilling {
|
||||
Spilling {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
spills: Vec::new(),
|
||||
reg_uses: Vec::new(),
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ pub struct VirtRegs {
|
||||
#[allow(dead_code)]
|
||||
impl VirtRegs {
|
||||
/// Create a new virtual register collection.
|
||||
pub fn new() -> VirtRegs {
|
||||
VirtRegs {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
pool: ListPool::new(),
|
||||
vregs: PrimaryMap::new(),
|
||||
value_vregs: EntityMap::new(),
|
||||
|
||||
Reference in New Issue
Block a user