Search in sources :

Example 1 with ReverseDFSenumerateByFinish

use of org.jikesrvm.compilers.opt.util.ReverseDFSenumerateByFinish in project JikesRVM by JikesRVM.

the class DF_System method numberEquationsTopological.

/**
 *  Number the equations in topological order.
 *
 *  <p> PRECONDITION: Already called addGraphEdges()
 *
 *  <p>Algorithm:
 *   <ul>
 *   <li>     1. create a DAG of SCCs
 *   <li>     2. number this DAG topologically
 *   <li>     3. walk through the DAG and number nodes as they are
 *               encountered
 *    </ul>
 */
private void numberEquationsTopological() {
    Enumeration<GraphNode> topOrder = GraphUtilities.enumerateTopSort(equations);
    Enumeration<GraphNode> rev = new ReverseDFSenumerateByFinish(equations, topOrder);
    int number = 0;
    while (rev.hasMoreElements()) {
        GraphNode elt = rev.nextElement();
        if (elt instanceof DF_Equation) {
            DF_Equation eq = (DF_Equation) elt;
            eq.setTopologicalNumber(number++);
        }
    }
}
Also used : ReverseDFSenumerateByFinish(org.jikesrvm.compilers.opt.util.ReverseDFSenumerateByFinish) GraphNode(org.jikesrvm.compilers.opt.util.GraphNode)

Aggregations

GraphNode (org.jikesrvm.compilers.opt.util.GraphNode)1 ReverseDFSenumerateByFinish (org.jikesrvm.compilers.opt.util.ReverseDFSenumerateByFinish)1