scale.callGraph
Class Suite

java.lang.Object
  extended by scale.common.Root
      extended by scale.callGraph.Suite
All Implemented Interfaces:
AnnotationInterface, DisplayNode

public class Suite
extends Root

This class is meant to facilitate separate compilations by being a repository for multiple CallGraph instances.

$Id: Suite.java,v 1.66 2007-10-04 19:53:35 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

In Scale, each source file is converted to a Clef abstract syntax tree (AST). The ASTs are processed into call graphs. This class is a holder for multiple call graphs and has methods that perform similar to the methods on a single call graph. In addition, this class maintains a mapping from a name to a set of top level declarations and from these declarations to the call graphs in which they are defined.

See Also:
CallGraph

Field Summary
static boolean classTrace
          True if traces are to be performed.
 
Constructor Summary
Suite(boolean noStaticDecls)
          Create a holder for related call graphs that acts like a single call graph.
 
Method Summary
 void addCallGraph(CallGraph cg)
          Add a call graph to the Suite.
 void addProfiling(Vector<java.lang.String> moduleNames, int profileOptions)
          Add the profiling instrumentation to every call graph in the suite.
 java.util.Iterator<RoutineDecl> allDefRoutines()
          Return an enumeration of all the routines with bodies.
 java.util.Iterator<RoutineDecl> allExternRoutines()
          Return an enumeration of all the external routines.
 java.util.Iterator<RoutineDecl> allRoutines()
          Return an enumeration of all the routines.
 java.util.Enumeration<Declaration> externDecls(Declaration d)
          Return an enumeration of the external (referencing) declarations for a given defining declaration.
 CallGraph getCallGraph(Declaration decl)
          Return the CallGraph in which the declaration is defined.
 java.util.Enumeration<CallGraph> getCallGraphs()
          Return an enumeration of all the call graphs.
 RoutineDecl getMain()
          Return the main routine if any.
 java.util.Enumeration<java.lang.String> getNames()
          Return an enumeration of all the call graph names.
 java.util.Enumeration<Declaration> otherDecls(Declaration decl)
          Return all the other top level declarations with the same name (including routine declarations).
 java.util.Enumeration<Declaration> otherDecls(java.lang.String name)
          Return all the other top level declarations with the same name (including routine declarations)
 void printAllRoutines()
          Print to out the routines in this call graph.
 void printXRef()
          Print a listing of all symbols and the call graphs in which they are referenced.
 void readProfInfo(Vector<java.lang.String> profilePaths, int profileOptions)
          Read in profiling informationforo every call graph in the suite.
 java.util.Iterator<Declaration> topLevelDecls()
          Return an enumeration of all the top level declarations except routines.
 java.util.Iterator<Declaration> topLevelDefDecls()
          Return an enumeration of all the top level defining declarations.
 java.util.Iterator<Declaration> topLevelExternDecls()
          Return an enumeration of all the top level external declarations.
 
Methods inherited from class scale.common.Root
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayColorHint, getDisplayLabel, getDisplayName, getDisplayShapeHint, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toString, toStringAnnotations, toStringClass, toStringSpecial, trace, trace, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

classTrace

public static boolean classTrace
True if traces are to be performed.

Constructor Detail

Suite

public Suite(boolean noStaticDecls)
Create a holder for related call graphs that acts like a single call graph.

Parameters:
noStaticDecls - is true if static functions and variable should be made global for inlining
See Also:
CallGraph
Method Detail

getCallGraphs

public java.util.Enumeration<CallGraph> getCallGraphs()
Return an enumeration of all the call graphs.


getNames

public java.util.Enumeration<java.lang.String> getNames()
Return an enumeration of all the call graph names.


addProfiling

public void addProfiling(Vector<java.lang.String> moduleNames,
                         int profileOptions)
Add the profiling instrumentation to every call graph in the suite.

Parameters:
moduleNames - is the list of all source modules in the program and must include the module containing "main"
profileOptions - specifies which profiling instrumentation to insert

readProfInfo

public void readProfInfo(Vector<java.lang.String> profilePaths,
                         int profileOptions)
Read in profiling informationforo every call graph in the suite.

Parameters:
profilePaths - is the list of directories to search for profile information and must include the module containing "main"
profileOptions - specifies which profiling instrumentation to insert

addCallGraph

public void addCallGraph(CallGraph cg)
Add a call graph to the Suite.

Parameters:
cg - is the call graph
See Also:
CallGraph

otherDecls

public java.util.Enumeration<Declaration> otherDecls(java.lang.String name)
Return all the other top level declarations with the same name (including routine declarations)

Parameters:
name - is the name of a Declaration

otherDecls

public java.util.Enumeration<Declaration> otherDecls(Declaration decl)
Return all the other top level declarations with the same name (including routine declarations).

Parameters:
decl - is a Declaration

getCallGraph

public CallGraph getCallGraph(Declaration decl)
Return the CallGraph in which the declaration is defined.

Parameters:
decl - is a Declaration (may be routine declaration)

printXRef

public void printXRef()
Print a listing of all symbols and the call graphs in which they are referenced.


printAllRoutines

public void printAllRoutines()
Print to out the routines in this call graph.


getMain

public RoutineDecl getMain()
Return the main routine if any.


allRoutines

public java.util.Iterator<RoutineDecl> allRoutines()
Return an enumeration of all the routines.


topLevelDecls

public java.util.Iterator<Declaration> topLevelDecls()
Return an enumeration of all the top level declarations except routines.


allDefRoutines

public java.util.Iterator<RoutineDecl> allDefRoutines()
Return an enumeration of all the routines with bodies. That is, the routines that aren't defined external.


topLevelDefDecls

public java.util.Iterator<Declaration> topLevelDefDecls()
Return an enumeration of all the top level defining declarations. We don't return routines or declarations declared with the extern keyword (a referencing declaration).


allExternRoutines

public java.util.Iterator<RoutineDecl> allExternRoutines()
Return an enumeration of all the external routines.


topLevelExternDecls

public java.util.Iterator<Declaration> topLevelExternDecls()
Return an enumeration of all the top level external declarations. We don't return routines.


externDecls

public java.util.Enumeration<Declaration> externDecls(Declaration d)
Return an enumeration of the external (referencing) declarations for a given defining declaration.

Parameters:
d - the defining declaration.