aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/options/phases
diff options
context:
space:
mode:
authorSchuyler Eldridge2020-06-19 01:11:15 -0400
committerSchuyler Eldridge2020-06-22 19:00:20 -0400
commitd66ff2357e59113ecf48c7d257edff429c4266e0 (patch)
tree30f5d068ea78caf172008f900e3d4fde7e20f6b0 /src/main/scala/firrtl/options/phases
parent2d1e074a67483c136d5f0ed86e8ecf1b8505bc10 (diff)
Convert PreservesAll to explicit invalidates=false
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/main/scala/firrtl/options/phases')
-rw-r--r--src/main/scala/firrtl/options/phases/AddDefaults.scala6
-rw-r--r--src/main/scala/firrtl/options/phases/Checks.scala6
-rw-r--r--src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala6
-rw-r--r--src/main/scala/firrtl/options/phases/DeletedWrapper.scala7
-rw-r--r--src/main/scala/firrtl/options/phases/GetIncludes.scala6
-rw-r--r--src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala6
6 files changed, 24 insertions, 13 deletions
diff --git a/src/main/scala/firrtl/options/phases/AddDefaults.scala b/src/main/scala/firrtl/options/phases/AddDefaults.scala
index 79089194..9777aff0 100644
--- a/src/main/scala/firrtl/options/phases/AddDefaults.scala
+++ b/src/main/scala/firrtl/options/phases/AddDefaults.scala
@@ -3,19 +3,21 @@
package firrtl.options.phases
import firrtl.AnnotationSeq
-import firrtl.options.{Dependency, Phase, PreservesAll, TargetDirAnnotation}
+import firrtl.options.{Dependency, Phase, TargetDirAnnotation}
/** Add default annotations for a [[Stage]]
*
* This currently only adds a [[TargetDirAnnotation]]. This isn't necessary for a [[StageOptionsView]], but downstream
* tools may expect a [[TargetDirAnnotation]] to exist.
*/
-class AddDefaults extends Phase with PreservesAll[Phase] {
+class AddDefaults extends Phase {
override def prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations])
override def optionalPrerequisiteOf = Seq.empty
+ override def invalidates(a: Phase) = false
+
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 ed2f1a28..7dce7bbe 100644
--- a/src/main/scala/firrtl/options/phases/Checks.scala
+++ b/src/main/scala/firrtl/options/phases/Checks.scala
@@ -4,18 +4,20 @@ package firrtl.options.phases
import firrtl.AnnotationSeq
import firrtl.annotations.Annotation
-import firrtl.options.{OptionsException, OutputAnnotationFileAnnotation, Phase, PreservesAll, TargetDirAnnotation}
+import firrtl.options.{OptionsException, OutputAnnotationFileAnnotation, Phase, TargetDirAnnotation}
import firrtl.options.Dependency
/** [[firrtl.options.Phase Phase]] that validates an [[AnnotationSeq]]. If successful, views of this [[AnnotationSeq]]
* as [[StageOptions]] are guaranteed to succeed.
*/
-class Checks extends Phase with PreservesAll[Phase] {
+class Checks extends Phase {
override def prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations], Dependency[AddDefaults])
override def optionalPrerequisiteOf = Seq.empty
+ override def invalidates(a: Phase) = false
+
/** 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 1eb4c2d9..559b5d28 100644
--- a/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala
+++ b/src/main/scala/firrtl/options/phases/ConvertLegacyAnnotations.scala
@@ -4,15 +4,17 @@ package firrtl.options.phases
import firrtl.AnnotationSeq
import firrtl.annotations.LegacyAnnotation
-import firrtl.options.{Dependency, Phase, PreservesAll}
+import firrtl.options.{Dependency, Phase}
/** Convert any [[firrtl.annotations.LegacyAnnotation LegacyAnnotation]]s to non-legacy variants */
-class ConvertLegacyAnnotations extends Phase with PreservesAll[Phase] {
+class ConvertLegacyAnnotations extends Phase {
override def prerequisites = Seq(Dependency[GetIncludes])
override def optionalPrerequisiteOf = Seq.empty
+ override def invalidates(a: Phase) = false
+
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 76ff21ad..3661d836 100644
--- a/src/main/scala/firrtl/options/phases/DeletedWrapper.scala
+++ b/src/main/scala/firrtl/options/phases/DeletedWrapper.scala
@@ -4,7 +4,7 @@ package firrtl.options.phases
import firrtl.AnnotationSeq
import firrtl.annotations.DeletedAnnotation
-import firrtl.options.{Phase, PreservesAll, Translator}
+import firrtl.options.{Phase, Translator}
import scala.collection.mutable
@@ -12,13 +12,14 @@ import scala.collection.mutable
* wrapped [[firrtl.options.Phase Phase]] will be added as [[firrtl.annotations.DeletedAnnotation DeletedAnnotation]]s.
* @param p a [[firrtl.options.Phase Phase]] to wrap
*/
-class DeletedWrapper(p: Phase) extends Phase with Translator[AnnotationSeq, (AnnotationSeq, AnnotationSeq)]
- with PreservesAll[Phase] {
+class DeletedWrapper(p: Phase) extends Phase with Translator[AnnotationSeq, (AnnotationSeq, AnnotationSeq)] {
override def prerequisites = Seq.empty
override def optionalPrerequisiteOf = Seq.empty
+ override def invalidates(a: Phase) = false
+
override lazy val name: String = p.name
def aToB(a: AnnotationSeq): (AnnotationSeq, AnnotationSeq) = (a, a)
diff --git a/src/main/scala/firrtl/options/phases/GetIncludes.scala b/src/main/scala/firrtl/options/phases/GetIncludes.scala
index 86e451eb..a0b15173 100644
--- a/src/main/scala/firrtl/options/phases/GetIncludes.scala
+++ b/src/main/scala/firrtl/options/phases/GetIncludes.scala
@@ -7,7 +7,7 @@ import net.jcazevedo.moultingyaml._
import firrtl.AnnotationSeq
import firrtl.annotations.{AnnotationFileNotFoundException, JsonProtocol, LegacyAnnotation}
import firrtl.annotations.AnnotationYamlProtocol._
-import firrtl.options.{InputAnnotationFileAnnotation, Phase, PreservesAll, StageUtils}
+import firrtl.options.{InputAnnotationFileAnnotation, Phase, StageUtils}
import firrtl.FileUtils
import java.io.File
@@ -16,12 +16,14 @@ import scala.collection.mutable
import scala.util.{Try, Failure}
/** Recursively expand all [[InputAnnotationFileAnnotation]]s in an [[AnnotationSeq]] */
-class GetIncludes extends Phase with PreservesAll[Phase] {
+class GetIncludes extends Phase {
override def prerequisites = Seq.empty
override def optionalPrerequisiteOf = Seq.empty
+ override def invalidates(a: Phase) = false
+
/** Read all [[annotations.Annotation]] from a file in JSON or YAML format
* @param filename a JSON or YAML file of [[annotations.Annotation]]
* @throws annotations.AnnotationFileNotFoundException if the file does not exist
diff --git a/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala b/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala
index 2d226de1..7d857108 100644
--- a/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala
+++ b/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala
@@ -4,7 +4,7 @@ package firrtl.options.phases
import firrtl.AnnotationSeq
import firrtl.annotations.{DeletedAnnotation, JsonProtocol}
-import firrtl.options.{Phase, PreservesAll, StageOptions, Unserializable, Viewer}
+import firrtl.options.{Phase, StageOptions, Unserializable, Viewer}
import firrtl.options.Dependency
import java.io.PrintWriter
@@ -12,7 +12,7 @@ import java.io.PrintWriter
/** [[firrtl.options.Phase Phase]] that writes an [[AnnotationSeq]] to a file. A file is written if and only if a
* [[StageOptions]] view has a non-empty [[StageOptions.annotationFileOut annotationFileOut]].
*/
-class WriteOutputAnnotations extends Phase with PreservesAll[Phase] {
+class WriteOutputAnnotations extends Phase {
override def prerequisites =
Seq( Dependency[GetIncludes],
@@ -22,6 +22,8 @@ class WriteOutputAnnotations extends Phase with PreservesAll[Phase] {
override def optionalPrerequisiteOf = Seq.empty
+ override def invalidates(a: Phase) = false
+
/** Write the input [[AnnotationSeq]] to a fie. */
def transform(annotations: AnnotationSeq): AnnotationSeq = {
val sopts = Viewer[StageOptions].view(annotations)