diff options
| author | Schuyler Eldridge | 2020-06-19 01:11:15 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2020-06-22 19:00:20 -0400 |
| commit | d66ff2357e59113ecf48c7d257edff429c4266e0 (patch) | |
| tree | 30f5d068ea78caf172008f900e3d4fde7e20f6b0 /src/main/scala/firrtl/passes | |
| parent | 2d1e074a67483c136d5f0ed86e8ecf1b8505bc10 (diff) | |
Convert PreservesAll to explicit invalidates=false
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/main/scala/firrtl/passes')
29 files changed, 100 insertions, 63 deletions
diff --git a/src/main/scala/firrtl/passes/CInferMDir.scala b/src/main/scala/firrtl/passes/CInferMDir.scala index f12d073d..b4819751 100644 --- a/src/main/scala/firrtl/passes/CInferMDir.scala +++ b/src/main/scala/firrtl/passes/CInferMDir.scala @@ -5,13 +5,15 @@ package firrtl.passes import firrtl._ import firrtl.ir._ import firrtl.Mappers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency import Utils.throwInternalError -object CInferMDir extends Pass with PreservesAll[Transform] { +object CInferMDir extends Pass { override def prerequisites = firrtl.stage.Forms.ChirrtlForm :+ Dependency(CInferTypes) + override def invalidates(a: Transform) = false + type MPortDirMap = collection.mutable.LinkedHashMap[String, MPortDir] def infer_mdir_e(mports: MPortDirMap, dir: MPortDir)(e: Expression): Expression = e match { diff --git a/src/main/scala/firrtl/passes/CheckChirrtl.scala b/src/main/scala/firrtl/passes/CheckChirrtl.scala index 355f728e..579dba30 100644 --- a/src/main/scala/firrtl/passes/CheckChirrtl.scala +++ b/src/main/scala/firrtl/passes/CheckChirrtl.scala @@ -4,14 +4,16 @@ package firrtl.passes import firrtl.Transform import firrtl.ir._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency -object CheckChirrtl extends Pass with CheckHighFormLike with PreservesAll[Transform] { +object CheckChirrtl extends Pass with CheckHighFormLike { override val optionalPrerequisiteOf = firrtl.stage.Forms.ChirrtlForm ++ Seq( Dependency(CInferTypes), Dependency(CInferMDir), Dependency(RemoveCHIRRTL) ) + override def invalidates(a: Transform) = false + def errorOnChirrtl(info: Info, mname: String, s: Statement): Option[PassException] = None } diff --git a/src/main/scala/firrtl/passes/CheckFlows.scala b/src/main/scala/firrtl/passes/CheckFlows.scala index 3fdb3443..b4ce4d5f 100644 --- a/src/main/scala/firrtl/passes/CheckFlows.scala +++ b/src/main/scala/firrtl/passes/CheckFlows.scala @@ -6,9 +6,9 @@ import firrtl._ import firrtl.ir._ import firrtl.Utils._ import firrtl.traversals.Foreachers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency -object CheckFlows extends Pass with PreservesAll[Transform] { +object CheckFlows extends Pass { override def prerequisites = Dependency(passes.ResolveFlows) +: firrtl.stage.Forms.WorkingIR @@ -18,6 +18,8 @@ object CheckFlows extends Pass with PreservesAll[Transform] { Dependency[passes.InferWidths], Dependency[transforms.InferResets] ) + override def invalidates(a: Transform) = false + type FlowMap = collection.mutable.HashMap[String, Flow] implicit def toStr(g: Flow): String = g match { diff --git a/src/main/scala/firrtl/passes/CheckHighForm.scala b/src/main/scala/firrtl/passes/CheckHighForm.scala index 5ca5cd54..889cdae2 100644 --- a/src/main/scala/firrtl/passes/CheckHighForm.scala +++ b/src/main/scala/firrtl/passes/CheckHighForm.scala @@ -7,7 +7,7 @@ import firrtl.ir._ import firrtl.PrimOps._ import firrtl.Utils._ import firrtl.traversals.Foreachers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency trait CheckHighFormLike { this: Pass => type NameSet = collection.mutable.HashSet[String] @@ -280,7 +280,7 @@ trait CheckHighFormLike { this: Pass => } } -object CheckHighForm extends Pass with CheckHighFormLike with PreservesAll[Transform] { +object CheckHighForm extends Pass with CheckHighFormLike { override def prerequisites = firrtl.stage.Forms.WorkingIR @@ -292,6 +292,8 @@ object CheckHighForm extends Pass with CheckHighFormLike with PreservesAll[Trans Dependency[passes.InferWidths], Dependency[transforms.InferResets] ) + override def invalidates(a: Transform) = false + class IllegalChirrtlMemException(info: Info, mname: String, name: String) extends PassException( s"$info: [module $mname] Memory $name has not been properly lowered from Chirrtl IR.") diff --git a/src/main/scala/firrtl/passes/CheckInitialization.scala b/src/main/scala/firrtl/passes/CheckInitialization.scala index fe0ff450..1eb16a9b 100644 --- a/src/main/scala/firrtl/passes/CheckInitialization.scala +++ b/src/main/scala/firrtl/passes/CheckInitialization.scala @@ -6,7 +6,6 @@ import firrtl._ import firrtl.ir._ import firrtl.Utils._ import firrtl.traversals.Foreachers._ -import firrtl.options.PreservesAll import annotation.tailrec @@ -15,10 +14,12 @@ import annotation.tailrec * @note This pass looks for [[firrtl.WVoid]]s left behind by [[ExpandWhens]] * @note Assumes single connection (ie. no last connect semantics) */ -object CheckInitialization extends Pass with PreservesAll[Transform] { +object CheckInitialization extends Pass { override def prerequisites = firrtl.stage.Forms.Resolved + override def invalidates(a: Transform) = false + private case class VoidExpr(stmt: Statement, voidDeps: Seq[Expression]) class RefNotInitializedException(info: Info, mname: String, name: String, trace: Seq[Statement]) extends PassException( diff --git a/src/main/scala/firrtl/passes/CheckTypes.scala b/src/main/scala/firrtl/passes/CheckTypes.scala index 702e7355..5173b8c4 100644 --- a/src/main/scala/firrtl/passes/CheckTypes.scala +++ b/src/main/scala/firrtl/passes/CheckTypes.scala @@ -9,9 +9,9 @@ import firrtl.Utils._ import firrtl.traversals.Foreachers._ import firrtl.WrappedType._ import firrtl.constraint.{Constraint, IsKnown} -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency -object CheckTypes extends Pass with PreservesAll[Transform] { +object CheckTypes extends Pass { override def prerequisites = Dependency(InferTypes) +: firrtl.stage.Forms.WorkingIR @@ -22,6 +22,8 @@ object CheckTypes extends Pass with PreservesAll[Transform] { Dependency[passes.InferWidths], Dependency(passes.CheckWidths) ) + override def invalidates(a: Transform) = false + // Custom Exceptions class SubfieldNotInBundle(info: Info, mname: String, name: String) extends PassException( s"$info: [module $mname ] Subfield $name is not in bundle.") diff --git a/src/main/scala/firrtl/passes/CheckWidths.scala b/src/main/scala/firrtl/passes/CheckWidths.scala index 4f1930c1..382490e7 100644 --- a/src/main/scala/firrtl/passes/CheckWidths.scala +++ b/src/main/scala/firrtl/passes/CheckWidths.scala @@ -9,14 +9,16 @@ import firrtl.traversals.Foreachers._ import firrtl.Utils._ import firrtl.constraint.IsKnown import firrtl.annotations.{CircuitTarget, ModuleTarget, Target, TargetToken} -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency -object CheckWidths extends Pass with PreservesAll[Transform] { +object CheckWidths extends Pass { override def prerequisites = Dependency[passes.InferWidths] +: firrtl.stage.Forms.WorkingIR override def optionalPrerequisiteOf = Seq(Dependency[transforms.InferResets]) + override def invalidates(a: Transform) = false + /** The maximum allowed width for any circuit element */ val MaxWidth = 1000000 val DshlMaxWidth = getUIntWidth(MaxWidth) diff --git a/src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala b/src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala index 567cf5f1..544f90a6 100644 --- a/src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala +++ b/src/main/scala/firrtl/passes/CommonSubexpressionElimination.scala @@ -5,9 +5,9 @@ package firrtl.passes import firrtl._ import firrtl.ir._ import firrtl.Mappers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency -object CommonSubexpressionElimination extends Pass with PreservesAll[Transform] { +object CommonSubexpressionElimination extends Pass { override def prerequisites = firrtl.stage.Forms.LowForm ++ Seq( Dependency(firrtl.passes.RemoveValidIf), @@ -20,6 +20,8 @@ object CommonSubexpressionElimination extends Pass with PreservesAll[Transform] Seq( Dependency[SystemVerilogEmitter], Dependency[VerilogEmitter] ) + override def invalidates(a: Transform) = false + private def cse(s: Statement): Statement = { val expressions = collection.mutable.HashMap[MemoizedHash[Expression], String]() val nodes = collection.mutable.HashMap[String, Expression]() diff --git a/src/main/scala/firrtl/passes/ConvertFixedToSInt.scala b/src/main/scala/firrtl/passes/ConvertFixedToSInt.scala index 5b9cc70b..4a426209 100644 --- a/src/main/scala/firrtl/passes/ConvertFixedToSInt.scala +++ b/src/main/scala/firrtl/passes/ConvertFixedToSInt.scala @@ -8,11 +8,11 @@ import firrtl.ir._ import firrtl._ import firrtl.Mappers._ import firrtl.Utils.{sub_type, module_type, field_type, max, throwInternalError} -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency /** Replaces FixedType with SIntType, and correctly aligns all binary points */ -object ConvertFixedToSInt extends Pass with PreservesAll[Transform] { +object ConvertFixedToSInt extends Pass { override def prerequisites = Seq( Dependency(PullMuxes), @@ -22,6 +22,8 @@ object ConvertFixedToSInt extends Pass with PreservesAll[Transform] { Dependency[ExpandWhensAndCheck], Dependency[RemoveIntervals] ) ++ firrtl.stage.Forms.Deduped + override def invalidates(a: Transform) = false + def alignArg(e: Expression, point: BigInt): Expression = e.tpe match { case FixedType(IntWidth(w), IntWidth(p)) => // assert(point >= p) if((point - p) > 0) { diff --git a/src/main/scala/firrtl/passes/InferBinaryPoints.scala b/src/main/scala/firrtl/passes/InferBinaryPoints.scala index a3e832f0..4b62d5f7 100644 --- a/src/main/scala/firrtl/passes/InferBinaryPoints.scala +++ b/src/main/scala/firrtl/passes/InferBinaryPoints.scala @@ -8,9 +8,9 @@ import firrtl.Mappers._ import firrtl.annotations.{CircuitTarget, ModuleTarget, ReferenceTarget, Target} import firrtl.constraint.ConstraintSolver import firrtl.Transform -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency -class InferBinaryPoints extends Pass with PreservesAll[Transform] { +class InferBinaryPoints extends Pass { override def prerequisites = Seq( Dependency(ResolveKinds), @@ -20,6 +20,8 @@ class InferBinaryPoints extends Pass with PreservesAll[Transform] { override def optionalPrerequisiteOf = Seq.empty + override def invalidates(a: Transform) = false + private val constraintSolver = new ConstraintSolver() private def addTypeConstraints(r1: ReferenceTarget, r2: ReferenceTarget)(t1: Type, t2: Type): Unit = (t1,t2) match { diff --git a/src/main/scala/firrtl/passes/InferTypes.scala b/src/main/scala/firrtl/passes/InferTypes.scala index 4702a87f..5524e0ea 100644 --- a/src/main/scala/firrtl/passes/InferTypes.scala +++ b/src/main/scala/firrtl/passes/InferTypes.scala @@ -6,11 +6,12 @@ import firrtl._ import firrtl.ir._ import firrtl.Utils._ import firrtl.Mappers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency -object InferTypes extends Pass with PreservesAll[Transform] { +object InferTypes extends Pass { override def prerequisites = Dependency(ResolveKinds) +: firrtl.stage.Forms.WorkingIR + override def invalidates(a: Transform) = false @deprecated("This should never have been public", "1.3.2") type TypeMap = collection.mutable.LinkedHashMap[String, Type] @@ -91,9 +92,10 @@ object InferTypes extends Pass with PreservesAll[Transform] { } } -object CInferTypes extends Pass with PreservesAll[Transform] { +object CInferTypes extends Pass { override def prerequisites = firrtl.stage.Forms.ChirrtlForm + override def invalidates(a: Transform) = false @deprecated("This should never have been public", "1.3.2") type TypeMap = collection.mutable.LinkedHashMap[String, Type] diff --git a/src/main/scala/firrtl/passes/InferWidths.scala b/src/main/scala/firrtl/passes/InferWidths.scala index 3bee4515..4c4afca1 100644 --- a/src/main/scala/firrtl/passes/InferWidths.scala +++ b/src/main/scala/firrtl/passes/InferWidths.scala @@ -10,7 +10,7 @@ import firrtl._ import firrtl.annotations._ import firrtl.constraint.{ConstraintSolver, IsMax} import firrtl.ir._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency object InferWidths { def apply(): InferWidths = new InferWidths() @@ -62,8 +62,7 @@ case class WidthGeqConstraintAnnotation(loc: ReferenceTarget, exp: ReferenceTarg */ class InferWidths extends Transform with ResolvedAnnotationPaths - with DependencyAPIMigration - with PreservesAll[Transform] { + with DependencyAPIMigration { override def prerequisites = Seq( Dependency(passes.ResolveKinds), @@ -72,6 +71,7 @@ class InferWidths extends Transform Dependency(passes.ResolveFlows), Dependency[passes.InferBinaryPoints], Dependency[passes.TrimIntervals] ) ++ firrtl.stage.Forms.WorkingIR + override def invalidates(a: Transform) = false private val constraintSolver = new ConstraintSolver() diff --git a/src/main/scala/firrtl/passes/Legalize.scala b/src/main/scala/firrtl/passes/Legalize.scala index 7a59605a..8b7b733a 100644 --- a/src/main/scala/firrtl/passes/Legalize.scala +++ b/src/main/scala/firrtl/passes/Legalize.scala @@ -3,14 +3,14 @@ package firrtl.passes import firrtl.PrimOps._ import firrtl.Utils.{BoolType, error, zero} import firrtl.ir._ -import firrtl.options.{PreservesAll, Dependency} +import firrtl.options.Dependency import firrtl.transforms.ConstantPropagation import firrtl.{Transform, bitWidth} import firrtl.Mappers._ // Replace shr by amount >= arg width with 0 for UInts and MSB for SInts // TODO replace UInt with zero-width wire instead -object Legalize extends Pass with PreservesAll[Transform] { +object Legalize extends Pass { override def prerequisites = firrtl.stage.Forms.MidForm :+ Dependency(LowerTypes) @@ -18,6 +18,8 @@ object Legalize extends Pass with PreservesAll[Transform] { override def optionalPrerequisiteOf = Seq.empty + override def invalidates(a: Transform) = false + private def legalizeShiftRight(e: DoPrim): Expression = { require(e.op == Shr) e.args.head match { diff --git a/src/main/scala/firrtl/passes/PullMuxes.scala b/src/main/scala/firrtl/passes/PullMuxes.scala index 768b1cb9..b805b5fc 100644 --- a/src/main/scala/firrtl/passes/PullMuxes.scala +++ b/src/main/scala/firrtl/passes/PullMuxes.scala @@ -2,13 +2,14 @@ package firrtl.passes import firrtl.ir._ import firrtl.Mappers._ -import firrtl.options.PreservesAll import firrtl.{Transform, WSubAccess, WSubField, WSubIndex} -object PullMuxes extends Pass with PreservesAll[Transform] { +object PullMuxes extends Pass { override def prerequisites = firrtl.stage.Forms.Deduped + override def invalidates(a: Transform) = false + def run(c: Circuit): Circuit = { def pull_muxes_e(e: Expression): Expression = e map pull_muxes_e match { case ex: WSubField => ex.expr match { diff --git a/src/main/scala/firrtl/passes/RemoveCHIRRTL.scala b/src/main/scala/firrtl/passes/RemoveCHIRRTL.scala index 67181f2b..8ba783ca 100644 --- a/src/main/scala/firrtl/passes/RemoveCHIRRTL.scala +++ b/src/main/scala/firrtl/passes/RemoveCHIRRTL.scala @@ -8,18 +8,20 @@ import firrtl._ import firrtl.ir._ import firrtl.Utils._ import firrtl.Mappers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency case class MPort(name: String, clk: Expression) case class MPorts(readers: ArrayBuffer[MPort], writers: ArrayBuffer[MPort], readwriters: ArrayBuffer[MPort]) case class DataRef(exp: Expression, male: String, female: String, mask: String, rdwrite: Boolean) -object RemoveCHIRRTL extends Transform with DependencyAPIMigration with PreservesAll[Transform] { +object RemoveCHIRRTL extends Transform with DependencyAPIMigration { override def prerequisites = firrtl.stage.Forms.ChirrtlForm ++ Seq( Dependency(passes.CInferTypes), Dependency(passes.CInferMDir) ) + override def invalidates(a: Transform) = false + val ut = UnknownType type MPortMap = collection.mutable.LinkedHashMap[String, MPorts] type SeqMemSet = collection.mutable.HashSet[String] diff --git a/src/main/scala/firrtl/passes/RemoveEmpty.scala b/src/main/scala/firrtl/passes/RemoveEmpty.scala index 2407acb6..eabf667c 100644 --- a/src/main/scala/firrtl/passes/RemoveEmpty.scala +++ b/src/main/scala/firrtl/passes/RemoveEmpty.scala @@ -4,14 +4,14 @@ package firrtl package passes import firrtl.ir._ -import firrtl.options.PreservesAll import firrtl.stage.Forms -object RemoveEmpty extends Pass with DependencyAPIMigration with PreservesAll[Transform] { +object RemoveEmpty extends Pass with DependencyAPIMigration { override def prerequisites = Seq.empty override def optionalPrerequisites = Forms.LowFormOptimized override def optionalPrerequisiteOf = Forms.ChirrtlEmitters + override def invalidates(a: Transform) = false private def onModule(m: DefModule): DefModule = { m match { diff --git a/src/main/scala/firrtl/passes/ReplaceAccesses.scala b/src/main/scala/firrtl/passes/ReplaceAccesses.scala index 5edab1f0..e31d9410 100644 --- a/src/main/scala/firrtl/passes/ReplaceAccesses.scala +++ b/src/main/scala/firrtl/passes/ReplaceAccesses.scala @@ -6,15 +6,17 @@ import firrtl.Transform import firrtl.ir._ import firrtl.{WSubAccess, WSubIndex} import firrtl.Mappers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency /** Replaces constant [[firrtl.WSubAccess]] with [[firrtl.WSubIndex]] * TODO Fold in to High Firrtl Const Prop */ -object ReplaceAccesses extends Pass with PreservesAll[Transform] { +object ReplaceAccesses extends Pass { override def prerequisites = firrtl.stage.Forms.Deduped :+ Dependency(PullMuxes) + override def invalidates(a: Transform) = false + def run(c: Circuit): Circuit = { def onStmt(s: Statement): Statement = s map onStmt map onExp def onExp(e: Expression): Expression = e match { diff --git a/src/main/scala/firrtl/passes/ResolveFlows.scala b/src/main/scala/firrtl/passes/ResolveFlows.scala index aacbf27c..c3455327 100644 --- a/src/main/scala/firrtl/passes/ResolveFlows.scala +++ b/src/main/scala/firrtl/passes/ResolveFlows.scala @@ -5,15 +5,17 @@ package firrtl.passes import firrtl._ import firrtl.ir._ import firrtl.Mappers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency -object ResolveFlows extends Pass with PreservesAll[Transform] { +object ResolveFlows extends Pass { override def prerequisites = Seq( Dependency(passes.ResolveKinds), Dependency(passes.InferTypes), Dependency(passes.Uniquify) ) ++ firrtl.stage.Forms.WorkingIR + override def invalidates(a: Transform) = false + def resolve_e(g: Flow)(e: Expression): Expression = e match { case ex: WRef => ex copy (flow = g) case WSubField(exp, name, tpe, _) => WSubField( diff --git a/src/main/scala/firrtl/passes/ResolveKinds.scala b/src/main/scala/firrtl/passes/ResolveKinds.scala index 809ba2fc..67360b74 100644 --- a/src/main/scala/firrtl/passes/ResolveKinds.scala +++ b/src/main/scala/firrtl/passes/ResolveKinds.scala @@ -6,12 +6,13 @@ import firrtl._ import firrtl.ir._ import firrtl.Mappers._ import firrtl.traversals.Foreachers._ -import firrtl.options.PreservesAll -object ResolveKinds extends Pass with PreservesAll[Transform] { +object ResolveKinds extends Pass { override def prerequisites = firrtl.stage.Forms.WorkingIR + override def invalidates(a: Transform) = false + type KindMap = collection.mutable.HashMap[String, Kind] private def find_port(kinds: KindMap)(p: Port): Unit = { @@ -45,4 +46,3 @@ object ResolveKinds extends Pass with PreservesAll[Transform] { def run(c: Circuit): Circuit = c copy (modules = c.modules map resolve_kinds) } - diff --git a/src/main/scala/firrtl/passes/ToWorkingIR.scala b/src/main/scala/firrtl/passes/ToWorkingIR.scala index 7da94be8..c271302a 100644 --- a/src/main/scala/firrtl/passes/ToWorkingIR.scala +++ b/src/main/scala/firrtl/passes/ToWorkingIR.scala @@ -1,10 +1,10 @@ package firrtl.passes import firrtl.ir._ -import firrtl.options.PreservesAll import firrtl.Transform -object ToWorkingIR extends Pass with PreservesAll[Transform] { +object ToWorkingIR extends Pass { override def prerequisites = firrtl.stage.Forms.MinimalHighForm + override def invalidates(a: Transform) = false def run(c:Circuit): Circuit = c } diff --git a/src/main/scala/firrtl/passes/TrimIntervals.scala b/src/main/scala/firrtl/passes/TrimIntervals.scala index 50da2323..cb87e10e 100644 --- a/src/main/scala/firrtl/passes/TrimIntervals.scala +++ b/src/main/scala/firrtl/passes/TrimIntervals.scala @@ -6,7 +6,7 @@ import firrtl.PrimOps._ import firrtl.ir._ import firrtl.Mappers._ import firrtl.constraint.{IsFloor, IsKnown, IsMul} -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency import firrtl.Transform /** Replaces IntervalType with SIntType, three AST walks: @@ -20,7 +20,7 @@ import firrtl.Transform * c. replace with SIntType * 3) Run InferTypes */ -class TrimIntervals extends Pass with PreservesAll[Transform] { +class TrimIntervals extends Pass { override def prerequisites = Seq( Dependency(ResolveKinds), @@ -31,6 +31,8 @@ class TrimIntervals extends Pass with PreservesAll[Transform] { override def optionalPrerequisiteOf = Seq.empty + override def invalidates(a: Transform) = false + def run(c: Circuit): Circuit = { // Open -> closed val firstPass = InferTypes.run(c map replaceModuleInterval) diff --git a/src/main/scala/firrtl/passes/VerilogModulusCleanup.scala b/src/main/scala/firrtl/passes/VerilogModulusCleanup.scala index 6debaf93..36eff379 100644 --- a/src/main/scala/firrtl/passes/VerilogModulusCleanup.scala +++ b/src/main/scala/firrtl/passes/VerilogModulusCleanup.scala @@ -7,7 +7,7 @@ import firrtl.ir._ import firrtl.Mappers._ import firrtl.PrimOps.{Bits, Rem} import firrtl.Utils._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency import scala.collection.mutable @@ -24,7 +24,7 @@ import scala.collection.mutable * This is technically incorrect firrtl, but allows the verilog emitter * to emit correct verilog without needing to add temporary nodes */ -object VerilogModulusCleanup extends Pass with PreservesAll[Transform] { +object VerilogModulusCleanup extends Pass { override def prerequisites = firrtl.stage.Forms.LowFormMinimumOptimized ++ Seq( Dependency[firrtl.transforms.BlackBoxSourceHelper], @@ -39,6 +39,8 @@ object VerilogModulusCleanup extends Pass with PreservesAll[Transform] { override def optionalPrerequisiteOf = Seq.empty + override def invalidates(a: Transform) = false + private def onModule(m: Module): Module = { val namespace = Namespace(m) def onStmt(s: Statement): Statement = { diff --git a/src/main/scala/firrtl/passes/VerilogPrep.scala b/src/main/scala/firrtl/passes/VerilogPrep.scala index 9f5de84e..03d47cfc 100644 --- a/src/main/scala/firrtl/passes/VerilogPrep.scala +++ b/src/main/scala/firrtl/passes/VerilogPrep.scala @@ -3,7 +3,7 @@ package firrtl.passes import firrtl.Utils.{create_exps, flow, kind, toWrappedExpression} import firrtl.ir._ import firrtl.Mappers._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency import firrtl._ import scala.collection.mutable @@ -18,7 +18,7 @@ import scala.collection.mutable * * @note The result of this pass is NOT legal Firrtl */ -object VerilogPrep extends Pass with PreservesAll[Transform] { +object VerilogPrep extends Pass { override def prerequisites = firrtl.stage.Forms.LowFormMinimumOptimized ++ Seq( Dependency[firrtl.transforms.BlackBoxSourceHelper], @@ -35,6 +35,8 @@ object VerilogPrep extends Pass with PreservesAll[Transform] { override def optionalPrerequisiteOf = Seq.empty + override def invalidates(a: Transform) = false + type AttachSourceMap = Map[WrappedExpression, Expression] // Finds attaches with only a single source (Port or Wire) diff --git a/src/main/scala/firrtl/passes/ZeroLengthVecs.scala b/src/main/scala/firrtl/passes/ZeroLengthVecs.scala index 14fcd387..39c127de 100644 --- a/src/main/scala/firrtl/passes/ZeroLengthVecs.scala +++ b/src/main/scala/firrtl/passes/ZeroLengthVecs.scala @@ -6,7 +6,7 @@ import firrtl._ import firrtl.ir._ import firrtl.Mappers._ import firrtl.PrimOps._ -import firrtl.options.{Dependency, PreservesAll} +import firrtl.options.Dependency /** Handles dynamic accesses to zero-length vectors. * @@ -15,13 +15,15 @@ import firrtl.options.{Dependency, PreservesAll} * @note Removes attaches that become degenerate after zero-length-accessor removal * @note Replaces "source" references to elements of zero-length vectors with always-invalid validif */ -object ZeroLengthVecs extends Pass with PreservesAll[Transform] { +object ZeroLengthVecs extends Pass { override def prerequisites = Seq( Dependency(PullMuxes), Dependency(ResolveKinds), Dependency(InferTypes), Dependency(ExpandConnects) ) + override def invalidates(a: Transform) = false + // Pass in an expression, not just a type, since it's not possible to generate an expression of // interval type with the type alone unless you declare a component private def replaceWithDontCare(toReplace: Expression): Expression = { diff --git a/src/main/scala/firrtl/passes/memlib/DecorateMems.scala b/src/main/scala/firrtl/passes/memlib/DecorateMems.scala index 7d537387..14bd9e44 100644 --- a/src/main/scala/firrtl/passes/memlib/DecorateMems.scala +++ b/src/main/scala/firrtl/passes/memlib/DecorateMems.scala @@ -4,16 +4,14 @@ package firrtl package passes package memlib -import firrtl.options.PreservesAll import firrtl.stage.Forms -class CreateMemoryAnnotations(reader: Option[YamlFileReader]) extends Transform - with DependencyAPIMigration - with PreservesAll[Transform] { +class CreateMemoryAnnotations(reader: Option[YamlFileReader]) extends Transform with DependencyAPIMigration { override def prerequisites = Forms.MidForm override def optionalPrerequisites = Seq.empty override def optionalPrerequisiteOf = Forms.MidEmitters + override def invalidates(a: Transform) = false def execute(state: CircuitState): CircuitState = reader match { case None => state diff --git a/src/main/scala/firrtl/passes/memlib/InferReadWrite.scala b/src/main/scala/firrtl/passes/memlib/InferReadWrite.scala index ddcf9483..03c295ed 100644 --- a/src/main/scala/firrtl/passes/memlib/InferReadWrite.scala +++ b/src/main/scala/firrtl/passes/memlib/InferReadWrite.scala @@ -8,7 +8,7 @@ import firrtl.ir._ import firrtl.Mappers._ import firrtl.PrimOps._ import firrtl.Utils.{one, zero, BoolType} -import firrtl.options.{HasShellOptions, PreservesAll, ShellOption} +import firrtl.options.{HasShellOptions, ShellOption} import MemPortUtils.memPortField import firrtl.passes.memlib.AnalysisUtils.{Connects, getConnects, getOrigin} import WrappedExpression.weq @@ -146,13 +146,13 @@ object InferReadWritePass extends Pass { // To use this transform, circuit name should be annotated with its TransId. class InferReadWrite extends Transform with DependencyAPIMigration - with PreservesAll[Transform] with SeqTransformBased with HasShellOptions { override def prerequisites = Forms.MidForm override def optionalPrerequisites = Seq.empty override def optionalPrerequisiteOf = Forms.MidEmitters + override def invalidates(a: Transform) = false val options = Seq( new ShellOption[Unit]( diff --git a/src/main/scala/firrtl/passes/memlib/ReplaceMemMacros.scala b/src/main/scala/firrtl/passes/memlib/ReplaceMemMacros.scala index f14a793e..d432a360 100644 --- a/src/main/scala/firrtl/passes/memlib/ReplaceMemMacros.scala +++ b/src/main/scala/firrtl/passes/memlib/ReplaceMemMacros.scala @@ -10,7 +10,6 @@ import firrtl.Mappers._ import MemPortUtils.{MemPortMap, Modules} import MemTransformUtils._ import firrtl.annotations._ -import firrtl.options.PreservesAll import firrtl.stage.Forms import wiring._ @@ -26,11 +25,12 @@ object ReplaceMemMacros { * This will not generate wmask ports if not needed. * Creates the minimum # of black boxes needed by the design. */ -class ReplaceMemMacros(writer: ConfWriter) extends Transform with DependencyAPIMigration with PreservesAll[Transform] { +class ReplaceMemMacros(writer: ConfWriter) extends Transform with DependencyAPIMigration { override def prerequisites = Forms.MidForm override def optionalPrerequisites = Seq.empty override def optionalPrerequisiteOf = Forms.MidEmitters + override def invalidates(a: Transform) = false /** Return true if mask granularity is per bit, false if per byte or unspecified */ diff --git a/src/main/scala/firrtl/passes/memlib/ReplaceMemTransform.scala b/src/main/scala/firrtl/passes/memlib/ReplaceMemTransform.scala index fe470ef9..87321ea0 100644 --- a/src/main/scala/firrtl/passes/memlib/ReplaceMemTransform.scala +++ b/src/main/scala/firrtl/passes/memlib/ReplaceMemTransform.scala @@ -5,7 +5,7 @@ package memlib import firrtl._ import firrtl.annotations._ -import firrtl.options.{HasShellOptions, PreservesAll, ShellOption} +import firrtl.options.{HasShellOptions, ShellOption} import Utils.error import java.io.{File, CharArrayWriter, PrintWriter} import wiring._ @@ -103,11 +103,12 @@ class SimpleTransform(p: Pass, form: CircuitForm) extends Transform { class SimpleMidTransform(p: Pass) extends SimpleTransform(p, MidForm) // SimpleRun instead of PassBased because of the arguments to passSeq -class ReplSeqMem extends Transform with HasShellOptions with DependencyAPIMigration with PreservesAll[Transform] { +class ReplSeqMem extends Transform with HasShellOptions with DependencyAPIMigration { override def prerequisites = Forms.MidForm override def optionalPrerequisites = Seq.empty override def optionalPrerequisiteOf = Forms.MidEmitters + override def invalidates(a: Transform) = false val options = Seq( new ShellOption[String]( diff --git a/src/main/scala/firrtl/passes/memlib/ResolveMemoryReference.scala b/src/main/scala/firrtl/passes/memlib/ResolveMemoryReference.scala index e64f6cd9..29200631 100644 --- a/src/main/scala/firrtl/passes/memlib/ResolveMemoryReference.scala +++ b/src/main/scala/firrtl/passes/memlib/ResolveMemoryReference.scala @@ -6,7 +6,6 @@ import firrtl._ import firrtl.ir._ import firrtl.Mappers._ import firrtl.annotations._ -import firrtl.options.PreservesAll import firrtl.stage.Forms /** A component, e.g. register etc. Must be declared only once under the TopAnnotation */ @@ -16,11 +15,12 @@ case class NoDedupMemAnnotation(target: ComponentName) extends SingleTargetAnnot /** Resolves annotation ref to memories that exactly match (except name) another memory */ -class ResolveMemoryReference extends Transform with DependencyAPIMigration with PreservesAll[Transform] { +class ResolveMemoryReference extends Transform with DependencyAPIMigration { override def prerequisites = Forms.MidForm override def optionalPrerequisites = Seq.empty override def optionalPrerequisiteOf = Forms.MidEmitters + override def invalidates(a: Transform) = false /** Helper class for determining when two memories are equivalent while igoring * irrelevant details like name and info |
