From eba98085456c91b7c6c52a0cffd27cf0baf4c26b Mon Sep 17 00:00:00 2001 From: "Geoffrey.Coram" Date: Wed, 10 Jul 2024 12:41:14 -0400 Subject: [PATCH] Remove unused code and unused imports --- openvaf/hir/src/body.rs | 3 +-- openvaf/mir/src/dominators.rs | 10 ---------- openvaf/mir/src/write.rs | 15 --------------- openvaf/mir_opt/src/simplify_cfg.rs | 21 +-------------------- 4 files changed, 2 insertions(+), 47 deletions(-) mode change 100644 => 100755 openvaf/mir/src/dominators.rs mode change 100644 => 100755 openvaf/mir/src/write.rs mode change 100644 => 100755 openvaf/mir_opt/src/simplify_cfg.rs diff --git a/openvaf/hir/src/body.rs b/openvaf/hir/src/body.rs index 1c31a1a6..4437a6c8 100644 --- a/openvaf/hir/src/body.rs +++ b/openvaf/hir/src/body.rs @@ -6,8 +6,7 @@ use hir_ty::db::HirTyDB; use hir_ty::inference; use hir_ty::types::{Signature, Ty}; -pub use hir_def::expr::Event; -pub use hir_def::{expr::CaseCond, BuiltIn, Case, ExprId, Literal, ParamSysFun, StmtId, Type}; +pub use hir_def::{expr::Event, BuiltIn, Case, ExprId, Literal, ParamSysFun, StmtId, Type}; pub use syntax::ast::{BinaryOp, UnaryOp}; use crate::{Branch, CompilationDB, Node}; diff --git a/openvaf/mir/src/dominators.rs b/openvaf/mir/src/dominators.rs old mode 100644 new mode 100755 index dfcec313..224c848b --- a/openvaf/mir/src/dominators.rs +++ b/openvaf/mir/src/dominators.rs @@ -9,16 +9,6 @@ use bitset::SparseBitMatrix; use stdx::packed_option::PackedOption; use typed_index_collections::{TiSlice, TiVec}; -trait CfgREVERSE { - type Successors; - type Predecessors; - - fn successors(cfg: &ControlFlowGraph, bb: Block) -> Self::Successors; - fn predecessors(cfg: &ControlFlowGraph, bb: Block) -> Self::Successors; -} - -trait ToIter {} - #[derive(Debug, Clone, PartialEq, Eq)] struct DomTreeNode { /// Number of this node in a (reverse) post-order traversal of the CFG, starting from 1. diff --git a/openvaf/mir/src/write.rs b/openvaf/mir/src/write.rs old mode 100644 new mode 100755 index f394b6ef..d2b70925 --- a/openvaf/mir/src/write.rs +++ b/openvaf/mir/src/write.rs @@ -345,21 +345,6 @@ impl<'a> fmt::Display for DisplayValues<'a> { } } -struct DisplayValuesWithDelimiter<'a>(&'a [Value], char); - -impl<'a> fmt::Display for DisplayValuesWithDelimiter<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - for (i, val) in self.0.iter().enumerate() { - if i == 0 { - write!(f, "{}", val)?; - } else { - write!(f, "{}{}", self.1, val)?; - } - } - Ok(()) - } -} - /// A lasso resolver that always returns `""`. /// Mainly useful for debugging pub struct DummyResolver; diff --git a/openvaf/mir_opt/src/simplify_cfg.rs b/openvaf/mir_opt/src/simplify_cfg.rs old mode 100644 new mode 100755 index 13934cff..63669b3e --- a/openvaf/mir_opt/src/simplify_cfg.rs +++ b/openvaf/mir_opt/src/simplify_cfg.rs @@ -1,8 +1,7 @@ -use std::hash::{Hash, Hasher}; use std::iter::repeat; use bitset::BitSet; -use mir::{Block, ControlFlowGraph, Function, InstructionData, Value, ValueDef, FALSE, TRUE}; +use mir::{Block, ControlFlowGraph, Function, InstructionData, ValueDef, FALSE, TRUE}; #[cfg(test)] mod tests; @@ -634,21 +633,3 @@ impl<'a> SimplifyCfg<'a> { } } } - -#[derive(Clone)] -struct ResolvedPhi { - vals: I, -} -impl + Clone> Hash for ResolvedPhi { - fn hash(&self, state: &mut H) { - for val in self.vals.clone() { - val.hash(state) - } - } -} -impl + Clone> PartialEq for ResolvedPhi { - fn eq(&self, other: &Self) -> bool { - self.vals.clone().eq(other.vals.clone()) - } -} -impl + Clone> Eq for ResolvedPhi {}