001 /*
002 * This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 * This file is licensed to You under the Eclipse Public License (EPL);
005 * You may not use this file except in compliance with the License. You
006 * may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 * See the COPYRIGHT.txt file distributed with this work for information
011 * regarding copyright ownership.
012 */
013 package org.jikesrvm.compilers.opt.util;
014
015
016 /**
017 * This class generates an enumeration of nodes of a graph, in order
018 * of increasing finishing time in a reverse Depth First Search,
019 * i.e. a search traversing nodes from target to source.
020 */
021 public class ReverseDFSenumerateByFinish extends DFSenumerateByFinish {
022
023 /**
024 * Construct a reverse DFS across a graph.
025 *
026 * @param net The graph over which to search.
027 */
028 public ReverseDFSenumerateByFinish(Graph net) {
029 super(net);
030 }
031
032 /**
033 * Construct a reverse DFS across a subset of a graph, starting
034 * at the given set of nodes.
035 *
036 * @param net The graph over which to search
037 * @param nodes The nodes at which to start the search
038 */
039 public ReverseDFSenumerateByFinish(Graph net, GraphNodeEnumeration nodes) {
040 super(net, nodes);
041 }
042
043 /**
044 * Traverse edges from target to source.
045 *
046 * @param n A node in the DFS
047 * @return The nodes that have edges leading to n
048 */
049 protected GraphNodeEnumeration getConnected(GraphNode n) {
050 return n.inNodes();
051 }
052 }
053
054
055