diff options
| author | jackkoenig | 2016-09-06 13:51:37 -0700 |
|---|---|---|
| committer | Donggyu Kim | 2016-09-12 12:48:46 -0700 |
| commit | 4702bf9f257f954e19d1441b21e737f951ccfbcc (patch) | |
| tree | c9bc87f605d0352d5cca58b56e7eda501e200759 /src/main/scala/firrtl/passes | |
| parent | 00bef01b6df158939406f3e744cbdda544823ae5 (diff) | |
Rework map functions as class methods
Changed code from match statements in Mappers.scala to methods on the various
IR classes. This allows custom IR nodes to implement the mapper functions and
thus work (ie. not match error) when map is called on them.
This also should have a marginal performance increase because of use of virtual
function calls rather than match statements.
Diffstat (limited to 'src/main/scala/firrtl/passes')
| -rw-r--r-- | src/main/scala/firrtl/passes/Inline.scala | 8 | ||||
| -rw-r--r-- | src/main/scala/firrtl/passes/PadWidths.scala | 6 | ||||
| -rw-r--r-- | src/main/scala/firrtl/passes/RemoveEmpty.scala | 2 | ||||
| -rw-r--r-- | src/main/scala/firrtl/passes/RemoveValidIf.scala | 2 | ||||
| -rw-r--r-- | src/main/scala/firrtl/passes/SplitExpressions.scala | 7 |
5 files changed, 13 insertions, 12 deletions
diff --git a/src/main/scala/firrtl/passes/Inline.scala b/src/main/scala/firrtl/passes/Inline.scala index c4529bd9..43c0ef1e 100644 --- a/src/main/scala/firrtl/passes/Inline.scala +++ b/src/main/scala/firrtl/passes/Inline.scala @@ -1,12 +1,12 @@ package firrtl package passes -// Datastructures -import scala.collection.mutable - import firrtl.ir._ +import firrtl.Mappers._ import firrtl.Annotations._ -import firrtl.Mappers.{ExpMap, StmtMap} + +// Datastructures +import scala.collection.mutable // Tags an annotation to be consumed by this pass case class InlineAnnotation(target: Named, tID: TransID) extends Annotation with Loose with Unstable { diff --git a/src/main/scala/firrtl/passes/PadWidths.scala b/src/main/scala/firrtl/passes/PadWidths.scala index f2117761..4cdcae59 100644 --- a/src/main/scala/firrtl/passes/PadWidths.scala +++ b/src/main/scala/firrtl/passes/PadWidths.scala @@ -1,10 +1,10 @@ package firrtl package passes -import firrtl.Mappers.{ExpMap, StmtMap} -import firrtl.Utils.long_BANG -import firrtl.PrimOps._ import firrtl.ir._ +import firrtl.PrimOps._ +import firrtl.Mappers._ +import firrtl.Utils.long_BANG // Makes all implicit width extensions and truncations explicit object PadWidths extends Pass { diff --git a/src/main/scala/firrtl/passes/RemoveEmpty.scala b/src/main/scala/firrtl/passes/RemoveEmpty.scala index 7ba2ef09..225e2222 100644 --- a/src/main/scala/firrtl/passes/RemoveEmpty.scala +++ b/src/main/scala/firrtl/passes/RemoveEmpty.scala @@ -2,7 +2,7 @@ package firrtl package passes import scala.collection.mutable -import firrtl.Mappers.{ExpMap, StmtMap} +import firrtl.Mappers._ import firrtl.ir._ object RemoveEmpty extends Pass { diff --git a/src/main/scala/firrtl/passes/RemoveValidIf.scala b/src/main/scala/firrtl/passes/RemoveValidIf.scala index a534cc50..e0a4b621 100644 --- a/src/main/scala/firrtl/passes/RemoveValidIf.scala +++ b/src/main/scala/firrtl/passes/RemoveValidIf.scala @@ -1,6 +1,6 @@ package firrtl package passes -import firrtl.Mappers.{ExpMap, StmtMap} +import firrtl.Mappers._ import firrtl.ir._ // Removes ValidIf as an optimization diff --git a/src/main/scala/firrtl/passes/SplitExpressions.scala b/src/main/scala/firrtl/passes/SplitExpressions.scala index 90b92a35..31306046 100644 --- a/src/main/scala/firrtl/passes/SplitExpressions.scala +++ b/src/main/scala/firrtl/passes/SplitExpressions.scala @@ -1,11 +1,12 @@ package firrtl package passes -import firrtl.Mappers.{ExpMap, StmtMap} -import firrtl.Utils.{kind, gender, get_info} import firrtl.ir._ -import scala.collection.mutable +import firrtl.Mappers._ +import firrtl.Utils.{kind, gender, get_info} +// Datastructures +import scala.collection.mutable // Splits compound expressions into simple expressions // and named intermediate nodes |
