diff options
| author | Schuyler Eldridge | 2020-04-21 22:41:23 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2020-04-22 18:46:31 -0400 |
| commit | 39d76a02785f4391b67abd3b7d7720d287736312 (patch) | |
| tree | e820790206a46a315e0b2d5634c5a8c9825931a2 /src/main/scala/firrtl/options | |
| parent | 1bf80040825e96ce04c15374304c144b9d48e902 (diff) | |
Mixin DependencyAPIMigration to all Transforms
This mixes in the new DependencyAPIMigration trait into all Transforms
and Passes. This enables in-tree transforms/passes to build without
deprecation warnings associated with the deprecated CircuitForm.
As a consequence of this, every Transform now has UnknownForm as both
its inputForm and outputForm. This PR modifies legacy Compiler and
testing infrastructure to schedule transforms NOT using
mergeTransforms/getLoweringTransforms (which rely on inputForm and
outputForm not being UnknownForm), but instead using the Dependency
API.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/main/scala/firrtl/options')
7 files changed, 16 insertions, 14 deletions
diff --git a/src/main/scala/firrtl/options/DependencyManager.scala b/src/main/scala/firrtl/options/DependencyManager.scala index 71c7bf26..537f87bd 100644 --- a/src/main/scala/firrtl/options/DependencyManager.scala +++ b/src/main/scala/firrtl/options/DependencyManager.scala @@ -20,9 +20,11 @@ case class DependencyManagerException(message: String, cause: Throwable = null) trait DependencyManager[A, B <: TransformLike[A] with DependencyAPI[B]] extends TransformLike[A] with DependencyAPI[B] { import DependencyManagerUtils.CharSet - override lazy val prerequisites = currentState + override def prerequisites = currentState - override lazy val dependents = Seq.empty + override def dependents = Seq.empty + + override def optionalPrerequisites = Seq.empty override def invalidates(a: B): Boolean = (_currentState &~ _targets)(oToD(a)) diff --git a/src/main/scala/firrtl/options/phases/AddDefaults.scala b/src/main/scala/firrtl/options/phases/AddDefaults.scala index a327d930..034c502f 100644 --- a/src/main/scala/firrtl/options/phases/AddDefaults.scala +++ b/src/main/scala/firrtl/options/phases/AddDefaults.scala @@ -12,9 +12,9 @@ import firrtl.options.{Dependency, Phase, PreservesAll, TargetDirAnnotation} */ class AddDefaults extends Phase with PreservesAll[Phase] { - override val prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations]) + override def prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations]) - override val dependents = Seq.empty + override def dependents = Seq.empty def transform(annotations: AnnotationSeq): AnnotationSeq = { val td = annotations.collectFirst{ case a: TargetDirAnnotation => a}.isEmpty diff --git a/src/main/scala/firrtl/options/phases/Checks.scala b/src/main/scala/firrtl/options/phases/Checks.scala index 659247c9..69cbc7ed 100644 --- a/src/main/scala/firrtl/options/phases/Checks.scala +++ b/src/main/scala/firrtl/options/phases/Checks.scala @@ -12,9 +12,9 @@ import firrtl.options.Dependency */ class Checks extends Phase with PreservesAll[Phase] { - override val prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations], Dependency[AddDefaults]) + override def prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations], Dependency[AddDefaults]) - override val dependents = Seq.empty + override def dependents = Seq.empty /** Validate an [[AnnotationSeq]] for [[StageOptions]] * @throws OptionsException if annotations are invalid diff --git a/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala b/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala index a8e86a77..7611f66f 100644 --- a/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala +++ b/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala @@ -9,9 +9,9 @@ import firrtl.options.{Dependency, Phase, PreservesAll} /** Convert any [[firrtl.annotations.LegacyAnnotation LegacyAnnotation]]s to non-legacy variants */ class ConvertLegacyAnnotations extends Phase with PreservesAll[Phase] { - override val prerequisites = Seq(Dependency[GetIncludes]) + override def prerequisites = Seq(Dependency[GetIncludes]) - override val dependents = Seq.empty + override def dependents = Seq.empty def transform(annotations: AnnotationSeq): AnnotationSeq = LegacyAnnotation.convertLegacyAnnos(annotations) diff --git a/src/main/scala/firrtl/options/phases/DeletedWrapper.scala b/src/main/scala/firrtl/options/phases/DeletedWrapper.scala index 5374aa66..4a112172 100644 --- a/src/main/scala/firrtl/options/phases/DeletedWrapper.scala +++ b/src/main/scala/firrtl/options/phases/DeletedWrapper.scala @@ -15,9 +15,9 @@ import scala.collection.mutable class DeletedWrapper(p: Phase) extends Phase with Translator[AnnotationSeq, (AnnotationSeq, AnnotationSeq)] with PreservesAll[Phase] { - override val prerequisites = Seq.empty + override def prerequisites = Seq.empty - override val dependents = Seq.empty + override def dependents = Seq.empty override lazy val name: String = p.name diff --git a/src/main/scala/firrtl/options/phases/GetIncludes.scala b/src/main/scala/firrtl/options/phases/GetIncludes.scala index f6c02543..3b26795f 100644 --- a/src/main/scala/firrtl/options/phases/GetIncludes.scala +++ b/src/main/scala/firrtl/options/phases/GetIncludes.scala @@ -18,9 +18,9 @@ import scala.util.{Try, Failure} /** Recursively expand all [[InputAnnotationFileAnnotation]]s in an [[AnnotationSeq]] */ class GetIncludes extends Phase with PreservesAll[Phase] { - override val prerequisites = Seq.empty + override def prerequisites = Seq.empty - override val dependents = Seq.empty + override def dependents = Seq.empty /** Read all [[annotations.Annotation]] from a file in JSON or YAML format * @param filename a JSON or YAML file of [[annotations.Annotation]] diff --git a/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala b/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala index 4a638393..79769a81 100644 --- a/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala +++ b/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala @@ -14,13 +14,13 @@ import java.io.PrintWriter */ class WriteOutputAnnotations extends Phase with PreservesAll[Phase] { - override val prerequisites = + override def prerequisites = Seq( Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations], Dependency[AddDefaults], Dependency[Checks] ) - override val dependents = Seq.empty + override def dependents = Seq.empty /** Write the input [[AnnotationSeq]] to a fie. */ def transform(annotations: AnnotationSeq): AnnotationSeq = { |
