cetus.analysis
Class CallGraph

java.lang.Object
  extended by cetus.analysis.CallGraph

public class CallGraph
extends java.lang.Object

A static call graph for the program.


Nested Class Summary
 class CallGraph.Caller
           
 class CallGraph.Node
           
 
Constructor Summary
CallGraph(Program program)
          Creates a call graph for the program.
 
Method Summary
 boolean callsSelf(Procedure proc)
           
 java.util.HashMap getCallGraph()
          Access the graph directly as a hash map.
 CallGraph.Node getRoot()
          Access the root node of the graph.
 java.util.List<Procedure> getTopologicalCallList()
           
 boolean isLeaf(Procedure proc)
          Determines if the procedure is a leaf of the call graph.
 boolean isRecursive(Procedure proc)
           
 void print(java.io.OutputStream stream)
          Prints the graph to a stream in graphviz format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallGraph

public CallGraph(Program program)
Creates a call graph for the program. Assumes the graph is rooted at a procedure called "main" or "MAIN__". (The second is used in f2c code.)

Parameters:
program - The program for which to create the call graph.
Method Detail

callsSelf

public boolean callsSelf(Procedure proc)

getCallGraph

public java.util.HashMap getCallGraph()
Access the graph directly as a hash map.

Returns:
a HashMap representing the graph.

getRoot

public CallGraph.Node getRoot()
Access the root node of the graph.

Returns:
the root Node object.

isLeaf

public boolean isLeaf(Procedure proc)
Determines if the procedure is a leaf of the call graph.

Parameters:
proc - A Procedure appearing in the call graph.
Returns:
true if the procedure does not call and other procedures of the program (i.e., library calls are ignored), or false otherwise.

isRecursive

public boolean isRecursive(Procedure proc)

print

public void print(java.io.OutputStream stream)
Prints the graph to a stream in graphviz format.

Parameters:
stream - The stream on which to print the graph.

getTopologicalCallList

public java.util.List<Procedure> getTopologicalCallList()