Use Self instead of repeating the type name.

This commit is contained in:
Dan Gohman
2017-11-08 10:40:47 -08:00
parent b7f979a8be
commit 3ab4349c1b
41 changed files with 105 additions and 105 deletions

View File

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

View File

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

View File

@@ -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(),
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -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(),
}

View File

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

View File

@@ -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(),
}

View File

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