Skip to content

Commit

Permalink
refactor traversal interface. Make distinction between traverseNode a…
Browse files Browse the repository at this point in the history
…nd traverseScope
  • Loading branch information
yaqiz01 committed Jun 23, 2018
1 parent f20f7cf commit 926b455
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/codegen/ParamCodegen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ abstract class ParamCodegen(implicit compiler:Spade) extends Pass with BFSTopolo
val allNodes = new BFSTopologicalTraversal with GraphSchedular {
type N = Parameter
val forward = false
override def traverseNode(n:N, prev:T) = traverse(List(n), prev)
}.schedule(compiler.designParam).toSet.toList
}.scheduleNode(compiler.designParam).toSet.toList
traverse(scheduleDepFree(allNodes), ())
}

Expand Down
10 changes: 1 addition & 9 deletions src/codegen/SpadeCodegen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,4 @@ package codegen

import prism.traversal._

abstract class SpadeCodegen(implicit compiler:Spade) extends SpadeTraversal with ChildFirstTraversal with Codegen {
override def runPass = {
traverseNode(compiler.top)
}

override def quote(n:Any):String = {
super[SpadeTraversal].quote(n)
}
}
abstract class SpadeCodegen(implicit compiler:Spade) extends SpadeTraversal with ChildFirstTraversal with Codegen
6 changes: 0 additions & 6 deletions src/codegen/dot/SpadeIRDotCodegen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,4 @@ class SpadeIRDotCodegen[M<:SpadeNode:ClassTag:TypeTag](val fileName:String)(impl
}
}

override def runPass = {
compiler.top.collectDown[M]().headOption.foreach { node =>
traverseNode(node)
}
}

}
4 changes: 3 additions & 1 deletion src/pass/SpadeTraversal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ import spade._

import prism.traversal._

trait SpadeTraversal extends SpadePass with SpadeWorld with prism.traversal.Traversal
trait SpadeTraversal extends SpadePass with SpadeWorld with prism.traversal.Traversal { self:HierarchicalTraversal =>
def top = compiler.top
}

0 comments on commit 926b455

Please sign in to comment.