diff options
| author | Jack | 2016-05-09 23:33:36 -0700 |
|---|---|---|
| committer | Jack Koenig | 2016-06-10 16:32:50 -0700 |
| commit | 26e33c343332c2f65bb45bc17b40a9cb7d22e2fd (patch) | |
| tree | a02cead24db710db2f1832d0e3389ad256085600 /src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala | |
| parent | 1eb8be78938721dd0d609f684c159bc1d1ddcfd6 (diff) | |
API Cleanup - Statement
trait Stmt -> abstract class Statement (to match Expression)
abbrev. exp -> expr
BulkConnect -> PartialConnect
camelCase things that were snake_case
case class Empty() -> case object EmptyStmt
Change >120 character Statements to multiline
Diffstat (limited to 'src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala')
| -rw-r--r-- | src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala b/src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala index 35bd86ce..f58572b1 100644 --- a/src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala +++ b/src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala @@ -36,12 +36,12 @@ import annotation.tailrec object CommonSubexpressionElimination extends Pass { def name = "Common Subexpression Elimination" - private def cseOnce(s: Stmt): (Stmt, Long) = { + private def cseOnce(s: Statement): (Statement, Long) = { var nEliminated = 0L val expressions = collection.mutable.HashMap[MemoizedHash[Expression], String]() val nodes = collection.mutable.HashMap[String, Expression]() - def recordNodes(s: Stmt): Stmt = s match { + def recordNodes(s: Statement): Statement = s match { case x: DefNode => nodes(x.name) = x.value expressions.getOrElseUpdate(x.value, x.name) @@ -62,14 +62,14 @@ object CommonSubexpressionElimination extends Pass { case _ => e map eliminateNodeRef } - def eliminateNodeRefs(s: Stmt): Stmt = s map eliminateNodeRefs map eliminateNodeRef + def eliminateNodeRefs(s: Statement): Statement = s map eliminateNodeRefs map eliminateNodeRef recordNodes(s) (eliminateNodeRefs(s), nEliminated) } @tailrec - private def cse(s: Stmt): Stmt = { + private def cse(s: Statement): Statement = { val (res, n) = cseOnce(s) if (n > 0) cse(res) else res } |
