google / xls

XLS: Accelerated HW Synthesis

Home Page:http://google.github.io/xls/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a trivial query engine

meheff opened this issue · comments

We should have a trivial stateless query engine which just analyzes the immediate vicinity of the node being queried. The query engine would require no construction time, and any node could be queried even after nodes are added/removed. This query engine could be used in place of the many times in the code where we determine things like:

  • Is this node value a constant (Is<Literal>): replace with QueryEngine::AlllBitsKnown()
  • Are these node values the same or not the same (nodeA == nodeB): replace with QueryEngine::NodesKnownUnsigned(Not)Equals
  • Is the node value one-hot (Is<OneHot>). May require adding a method to the query engine.

This has a number of advantages. First, the query engine can be a bit smarter than the naive inplace logic now potentially producing improved qor. This enables easy swapping out with more capable query engines for any pass. Finally this can be used to unify the optimization pass constructor interface which will simplify registration. Basically, every pass should take a query engine specification and the optimization level.