From bffc340e347563adfaa70e695cf339752a6b1da4 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 9 Jun 2020 13:18:53 -0700 Subject: Speed up ExpandWhens for very large designs (#1666) Use WrappedExpression instead of MemoizedHash. The benefit of memoizing the hash pales in comparison to the cost of hashing deeply nested Types in the AST. Co-authored-by: Schuyler Eldridge --- src/main/scala/firrtl/passes/ExpandWhens.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/scala/firrtl/passes/ExpandWhens.scala b/src/main/scala/firrtl/passes/ExpandWhens.scala index f84309d0..32fec4ed 100644 --- a/src/main/scala/firrtl/passes/ExpandWhens.scala +++ b/src/main/scala/firrtl/passes/ExpandWhens.scala @@ -53,8 +53,11 @@ object ExpandWhens extends Pass { } /** Maps an expression to a declared node name. Used to memoize predicates */ + @deprecated("This will be removed in FIRRTL 1.4.0", "FIRRTL 1.3.2") type NodeMap = mutable.HashMap[MemoizedHash[Expression], String] + private type NodeLookup = mutable.HashMap[WrappedExpression, String] + /** Maps a reference to whatever connects to it. Used to resolve last connect semantics */ type Netlist = mutable.LinkedHashMap[WrappedExpression, Expression] @@ -88,10 +91,10 @@ object ExpandWhens extends Pass { val simlist = new Simlist // Memoizes if an expression contains any WVoids inserted in this pass - val memoizedVoid = new mutable.HashSet[MemoizedHash[Expression]] += WVoid + val memoizedVoid = new mutable.HashSet[WrappedExpression] += WVoid // Memoizes the node that holds a particular expression, if any - val nodes = new NodeMap + val nodes = new NodeLookup // Seq of attaches in order lazy val attaches = mutable.ArrayBuffer.empty[Attach] -- cgit v1.2.3