diff --git a/src/compiler/rust/bitset.rs b/src/compiler/rust/bitset.rs index a6955e4d9c5..527c038efc6 100644 --- a/src/compiler/rust/bitset.rs +++ b/src/compiler/rust/bitset.rs @@ -52,7 +52,7 @@ impl BitSet { } } - pub fn get(&self, idx: usize) -> bool { + pub fn contains(&self, idx: usize) -> bool { let w = idx / 32; let b = idx % 32; if w < self.words.len() { @@ -406,8 +406,8 @@ mod tests { assert_eq!(to_vec(&set), &[0, 1, 73]); assert!(!set.is_empty()); - assert!(set.get(73)); - assert!(!set.get(197)); + assert!(set.contains(73)); + assert!(!set.contains(197)); assert!(set.remove(1)); assert!(!set.remove(7)); diff --git a/src/compiler/rust/cfg.rs b/src/compiler/rust/cfg.rs index d89e6dec277..109e7850e8a 100644 --- a/src/compiler/rust/cfg.rs +++ b/src/compiler/rust/cfg.rs @@ -39,7 +39,7 @@ fn graph_post_dfs( post_idx: &mut Vec, count: &mut usize, ) { - if seen.get(id) { + if seen.contains(id) { return; } seen.insert(id); @@ -184,8 +184,8 @@ fn loop_detect_dfs( post: &mut BitSet, loops: &mut BitSet, ) { - if pre.get(id) { - if !post.get(id) { + if pre.contains(id) { + if !post.contains(id) { loops.insert(id); } return; @@ -209,7 +209,7 @@ fn detect_loops(nodes: &mut Vec>) -> bool { let mut has_loop = false; nodes[0].lph = usize::MAX; for i in 1..nodes.len() { - if loops.get(i) { + if loops.contains(i) { // This is a loop header nodes[i].lph = i; has_loop = true; diff --git a/src/nouveau/compiler/nak/assign_regs.rs b/src/nouveau/compiler/nak/assign_regs.rs index 4f84bd165c2..1baffa3e13c 100644 --- a/src/nouveau/compiler/nak/assign_regs.rs +++ b/src/nouveau/compiler/nak/assign_regs.rs @@ -287,11 +287,11 @@ impl RegAllocator { } pub fn reg_is_used(&self, reg: u32) -> bool { - self.used.get(reg.try_into().unwrap()) + self.used.contains(reg.try_into().unwrap()) } pub fn reg_is_pinned(&self, reg: u32) -> bool { - self.pinned.get(reg.try_into().unwrap()) + self.pinned.contains(reg.try_into().unwrap()) } pub fn try_get_reg(&self, ssa: SSAValue) -> Option { @@ -356,7 +356,7 @@ impl RegAllocator { fn reg_range_is_unset(set: &BitSet, reg: u32, comps: u8) -> bool { for c in 0..u32::from(comps) { - if set.get((reg + c).try_into().unwrap()) { + if set.contains((reg + c).try_into().unwrap()) { return false; } } @@ -515,7 +515,7 @@ impl<'a> VecRegAllocator<'a> { } fn reg_is_pinned(&self, reg: u32) -> bool { - self.pinned.get(reg.try_into().unwrap()) + self.pinned.contains(reg.try_into().unwrap()) } fn reg_range_is_unpinned(&self, reg: u32, comps: u8) -> bool { diff --git a/src/nouveau/compiler/nak/liveness.rs b/src/nouveau/compiler/nak/liveness.rs index 31997825242..c46f91844f3 100644 --- a/src/nouveau/compiler/nak/liveness.rs +++ b/src/nouveau/compiler/nak/liveness.rs @@ -253,7 +253,7 @@ impl SimpleBlockLiveness { impl BlockLiveness for SimpleBlockLiveness { fn is_live_after_ip(&self, val: &SSAValue, ip: usize) -> bool { - if self.live_out.get(val.idx().try_into().unwrap()) { + if self.live_out.contains(val.idx().try_into().unwrap()) { true } else if let Some(last_use_ip) = self.last_use.get(&val.idx()) { *last_use_ip > ip @@ -263,11 +263,11 @@ impl BlockLiveness for SimpleBlockLiveness { } fn is_live_in(&self, val: &SSAValue) -> bool { - self.live_in.get(val.idx().try_into().unwrap()) + self.live_in.contains(val.idx().try_into().unwrap()) } fn is_live_out(&self, val: &SSAValue) -> bool { - self.live_out.get(val.idx().try_into().unwrap()) + self.live_out.contains(val.idx().try_into().unwrap()) } } diff --git a/src/nouveau/compiler/nak/opt_bar_prop.rs b/src/nouveau/compiler/nak/opt_bar_prop.rs index dbeab6e96c8..c97ab0884fe 100644 --- a/src/nouveau/compiler/nak/opt_bar_prop.rs +++ b/src/nouveau/compiler/nak/opt_bar_prop.rs @@ -92,11 +92,11 @@ impl BarPropPass { seen: &mut BitSet, phi: u32, ) -> bool { - if self.phi_is_not_bar.get(phi.try_into().unwrap()) { + if self.phi_is_not_bar.contains(phi.try_into().unwrap()) { return false; } - if seen.get(phi.try_into().unwrap()) { + if seen.contains(phi.try_into().unwrap()) { // If we've hit a cycle, that's not a fail return true; } @@ -129,7 +129,7 @@ impl BarPropPass { phi: u32, ssa: SSAValue, ) { - if !needs_bar.get(phi.try_into().unwrap()) { + if !needs_bar.contains(phi.try_into().unwrap()) { return; } @@ -154,7 +154,7 @@ impl BarPropPass { phi: u32, ssa: SSAValue, ) { - if self.phi_is_bar.get(phi.try_into().unwrap()) { + if self.phi_is_bar.contains(phi.try_into().unwrap()) { return; } @@ -203,7 +203,8 @@ impl BarPropPass { match &mut instr.op { Op::PhiSrcs(op) => { for (idx, src) in op.srcs.iter_mut() { - if self.phi_is_bar.get((*idx).try_into().unwrap()) { + if self.phi_is_bar.contains((*idx).try_into().unwrap()) + { // Barrier immediates don't exist let ssa = src.as_ssa().unwrap(); let bar = *self.map_bar(&ssa[0]).unwrap(); @@ -215,7 +216,8 @@ impl BarPropPass { Op::PhiDsts(op) => { let mut bmovs = Vec::new(); for (idx, dst) in op.dsts.iter_mut() { - if self.phi_is_bar.get((*idx).try_into().unwrap()) { + if self.phi_is_bar.contains((*idx).try_into().unwrap()) + { let ssa = dst.as_ssa().unwrap().clone(); let bar = *self.ssa_map.get(&ssa[0]).unwrap(); *dst = bar.into(); diff --git a/src/nouveau/compiler/nak/spill_values.rs b/src/nouveau/compiler/nak/spill_values.rs index aed1d67ba46..353365f31db 100644 --- a/src/nouveau/compiler/nak/spill_values.rs +++ b/src/nouveau/compiler/nak/spill_values.rs @@ -984,7 +984,7 @@ fn spill_values( continue; } - if spilled_phis.get((*idx).try_into().unwrap()) { + if spilled_phis.contains((*idx).try_into().unwrap()) { if !p_out.s.contains(ssa) { spills.push(*ssa); }