Resolve lints and format

This commit is contained in:
infogulch
2023-11-04 02:16:54 -05:00
parent dddffb01a6
commit 9444e62df9
58 changed files with 2521 additions and 2820 deletions

View File

@@ -74,10 +74,7 @@ impl PermVarAllocation {
#[inline]
pub(crate) fn pending(&self) -> bool {
match self {
&PermVarAllocation::Pending => true,
_ => false,
}
matches!(self, &PermVarAllocation::Pending)
}
}
@@ -96,9 +93,9 @@ pub enum VarAlloc {
impl VarAlloc {
#[inline]
pub(crate) fn as_reg_type(&self) -> RegType {
match self {
&VarAlloc::Temp { temp_reg, .. } => RegType::Temp(temp_reg),
&VarAlloc::Perm(r, _) => RegType::Perm(r),
match *self {
VarAlloc::Temp { temp_reg, .. } => RegType::Temp(temp_reg),
VarAlloc::Perm(r, _) => RegType::Perm(r),
}
}
@@ -129,7 +126,7 @@ impl TempVarData {
}
}
return false;
false
}
pub(crate) fn populate_conflict_set(&mut self) {
@@ -201,16 +198,13 @@ impl VariableRecords {
IndexMap::new();
for (var_gen_index, record) in self.0.iter_mut().enumerate() {
match &mut record.allocation {
VarAlloc::Temp { temp_var_data, .. } => {
let use_set = std::mem::replace(
&mut temp_var_data.use_set,
IndexSet::with_hasher(FxBuildHasher::default()),
);
if let VarAlloc::Temp { temp_var_data, .. } = &mut record.allocation {
let use_set = std::mem::replace(
&mut temp_var_data.use_set,
IndexSet::with_hasher(FxBuildHasher::default()),
);
use_sets.insert(var_gen_index, use_set);
}
_ => {}
use_sets.insert(var_gen_index, use_set);
}
}
@@ -219,19 +213,18 @@ impl VariableRecords {
for &(term_loc, reg) in &use_set {
if let GenContext::Last(cn_u) = term_loc {
for (var_gen_index, record) in self.0.iter_mut().enumerate() {
match &mut record.allocation {
VarAlloc::Temp {
term_loc,
temp_var_data,
..
} => {
if cn_u == term_loc.chunk_num() && u != var_gen_index {
if !temp_var_data.uses_reg(reg) {
temp_var_data.no_use_set.insert(reg);
}
}
if let VarAlloc::Temp {
term_loc,
temp_var_data,
..
} = &mut record.allocation
{
if cn_u == term_loc.chunk_num()
&& u != var_gen_index
&& !temp_var_data.uses_reg(reg)
{
temp_var_data.no_use_set.insert(reg);
}
_ => {}
}
}
}