diff options
| author | Kevin Laeufer | 2020-07-28 09:40:35 -0700 |
|---|---|---|
| committer | Kevin Laeufer | 2020-07-29 15:26:30 -0700 |
| commit | 3b22cea87c9d5977c1f7a797091208034dbb8f2e (patch) | |
| tree | 4d8f2a8d5a75dc377b599c6f33d98cdfafe222af /src/main/scala/firrtl/transforms | |
| parent | ff509e6a917269f995e28f228a23a7fb6e947363 (diff) | |
[2.13] convert toSeq and toMap where necessary to compile
Diffstat (limited to 'src/main/scala/firrtl/transforms')
8 files changed, 16 insertions, 14 deletions
diff --git a/src/main/scala/firrtl/transforms/ConstantPropagation.scala b/src/main/scala/firrtl/transforms/ConstantPropagation.scala index 0ec4fe0b..c3c615e0 100644 --- a/src/main/scala/firrtl/transforms/ConstantPropagation.scala +++ b/src/main/scala/firrtl/transforms/ConstantPropagation.scala @@ -819,7 +819,7 @@ class ConstantPropagation extends Transform with DependencyAPIMigration with Res } // Map from module name to component names val dontTouchMap: Map[OfModule, Set[String]] = - dontTouches.groupBy(_._1).mapValues(_.map(_._2).toSet) + dontTouches.groupBy(_._1).mapValues(_.map(_._2).toSet).toMap state.copy(circuit = run(state.circuit, dontTouchMap)) } diff --git a/src/main/scala/firrtl/transforms/DeadCodeElimination.scala b/src/main/scala/firrtl/transforms/DeadCodeElimination.scala index 4182e496..f9e35818 100644 --- a/src/main/scala/firrtl/transforms/DeadCodeElimination.scala +++ b/src/main/scala/firrtl/transforms/DeadCodeElimination.scala @@ -94,7 +94,7 @@ class DeadCodeElimination extends Transform e } rec(expr) - refs + refs.toSeq } // Gets all dependencies and constructs LogicNodes from them diff --git a/src/main/scala/firrtl/transforms/Dedup.scala b/src/main/scala/firrtl/transforms/Dedup.scala index 03b5faa9..30558129 100644 --- a/src/main/scala/firrtl/transforms/Dedup.scala +++ b/src/main/scala/firrtl/transforms/Dedup.scala @@ -550,7 +550,7 @@ object DedupModules extends LazyLogging { } changeInternals(rename, retype, {i => i}, {(x, y) => x}, renameExps = false)(m) - refs + refs.toIndexedSeq } def computeRenameMap(originalNames: IndexedSeq[ReferenceTarget], @@ -578,6 +578,6 @@ object DedupModules extends LazyLogging { } onExp(root) - all + all.toSeq } } diff --git a/src/main/scala/firrtl/transforms/FlattenRegUpdate.scala b/src/main/scala/firrtl/transforms/FlattenRegUpdate.scala index 4bda25ce..b272f134 100644 --- a/src/main/scala/firrtl/transforms/FlattenRegUpdate.scala +++ b/src/main/scala/firrtl/transforms/FlattenRegUpdate.scala @@ -107,7 +107,7 @@ object FlattenRegUpdate { } val bodyx = onStmt(mod.body) - mod.copy(body = Block(bodyx +: regUpdates)) + mod.copy(body = Block(bodyx +: regUpdates.toSeq)) } } diff --git a/src/main/scala/firrtl/transforms/GroupComponents.scala b/src/main/scala/firrtl/transforms/GroupComponents.scala index 3b982fbf..166feba0 100644 --- a/src/main/scala/firrtl/transforms/GroupComponents.scala +++ b/src/main/scala/firrtl/transforms/GroupComponents.scala @@ -261,13 +261,13 @@ class GroupComponents extends Transform with DependencyAPIMigration { val topStmts = mutable.ArrayBuffer[Statement]() val group = byNode(r.name) groupStatements(group) += r mapExpr inGroupFixExps(group, topStmts) - Block(topStmts) + Block(topStmts.toSeq) case c: Connect if byNode(getWRef(c.loc).name) != "" => // Sink is in a group val topStmts = mutable.ArrayBuffer[Statement]() val group = byNode(getWRef(c.loc).name) groupStatements(group) += Connect(c.info, c.loc, inGroupFixExps(group, topStmts)(c.expr)) - Block(topStmts) + Block(topStmts.toSeq) case i: IsInvalid if byNode(getWRef(i.expr).name) != "" => // Sink is in group val group = byNode(getWRef(i.expr).name) @@ -289,7 +289,7 @@ class GroupComponents extends Transform with DependencyAPIMigration { // For all group labels (not including the original module label), return a new Module. val newModules = labelOrder.filter(_ != "") map { group => - Module(NoInfo, label2module(group), groupPorts(group).distinct, Block(groupStatements(group).distinct)) + Module(NoInfo, label2module(group), groupPorts(group).distinct.toSeq, Block(groupStatements(group).distinct.toSeq)) } Seq(m.copy(body = finalTopBody)) ++ newModules } diff --git a/src/main/scala/firrtl/transforms/InferResets.scala b/src/main/scala/firrtl/transforms/InferResets.scala index 1798e3d8..ebf1d67a 100644 --- a/src/main/scala/firrtl/transforms/InferResets.scala +++ b/src/main/scala/firrtl/transforms/InferResets.scala @@ -90,7 +90,7 @@ object InferResets { tokens.groupBy { case (TargetToken.Field(n) +: t, _) => n } .mapValues { ts => fromTokens(ts.map { case (_ +: t, tpe) => (t, tpe) }:_*) - } + }.toMap BundleTree(fields) } } @@ -281,7 +281,7 @@ class InferResets extends Transform with DependencyAPIMigration { private def makeDeclMap(map: Map[ReferenceTarget, Type]): Map[String, TypeTree] = map.groupBy(_._1.ref).mapValues { ts => TypeTree.fromTokens(ts.toSeq.map { case (target, tpe) => (target.component, tpe) }:_*) - } + }.toMap private def implPort(map: Map[String, TypeTree])(port: Port): Port = map.get(port.name) diff --git a/src/main/scala/firrtl/transforms/PropagatePresetAnnotations.scala b/src/main/scala/firrtl/transforms/PropagatePresetAnnotations.scala index 6bc948cd..4ed50046 100644 --- a/src/main/scala/firrtl/transforms/PropagatePresetAnnotations.scala +++ b/src/main/scala/firrtl/transforms/PropagatePresetAnnotations.scala @@ -80,7 +80,9 @@ class PropagatePresetAnnotations extends Transform with DependencyAPIMigration { // store async-reset trees val asyncCoMap = new TargetSetMap() // Annotations to be appended and returned as result of the transform - val annos = cs.annotations.to[mutable.ArrayBuffer] -- presetAnnos + val annos = (cs.annotations.toSet -- presetAnnos).to(mutable.ArrayBuffer) + // TODO: annotations should be filtered with a .partition instead of trying to do set operations + // to filter out the non-preset annotations val circuitTarget = CircuitTarget(cs.circuit.main) @@ -301,7 +303,7 @@ class PropagatePresetAnnotations extends Transform with DependencyAPIMigration { cs.circuit.foreachModule(processModule) // PHASE 1 : Initialize annotateAsyncSet(asyncToAnnotate) // PHASE 2 : Annotate - annos + annos.toSeq } /* diff --git a/src/main/scala/firrtl/transforms/RemoveWires.scala b/src/main/scala/firrtl/transforms/RemoveWires.scala index 0e70ec1f..f692e513 100644 --- a/src/main/scala/firrtl/transforms/RemoveWires.scala +++ b/src/main/scala/firrtl/transforms/RemoveWires.scala @@ -51,7 +51,7 @@ class RemoveWires extends Transform with DependencyAPIMigration { e } rec(expr) - refs + refs.toSeq } // Transform netlist into DefNodes @@ -142,7 +142,7 @@ class RemoveWires extends Transform with DependencyAPIMigration { onStmt(body) getOrderedNodes(netlist, regInfo) match { case Success(logic) => - Module(info, name, ports, Block(decls ++ logic ++ otherStmts)) + Module(info, name, ports, Block(List() ++ decls ++ logic ++ otherStmts)) // If we hit a CyclicException, just abort removing wires case Failure(c: CyclicException) => val problematicNode = c.node |
