|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.callGraph.CallGraph
public final class CallGraph
This class holds all of the RoutineDecl instances for the routines in a single compilation unit.
$Id: CallGraph.java,v 1.126 2007-10-29 13:46:16 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
A class that represents the call graph of a program. This class is used to build the call graph and maintain a pointer to the root node (the main routine) of the program.
The class also maintains information about the routines and global variables in a program.
RoutineDecl
Field Summary | |
---|---|
static boolean |
alphabeticalOrder
If true, return routines in
alphabetical order. |
Constructor Summary | |
---|---|
CallGraph(java.lang.String name,
Suite suite,
SourceLanguage sourceLang)
Create a call graph of call nodes. |
Method Summary | |
---|---|
void |
addCallee(RoutineDecl caller,
RoutineDecl rd)
Add a call to the call graph. |
void |
addFunction(RoutineDecl p)
Add the routine to the list of routines that are referenced. |
void |
addProfiling(Vector<java.lang.String> moduleNames,
int profileOptions)
Add the profiling instrumentation to every call node in the call graph. |
SymtabEntry |
addRootSymbol(Declaration decl)
Add the declaration to the
root symbol table scope. |
SymtabEntry |
addSymbol(Declaration decl)
Add the declaration to the
current symbol table scope. |
void |
addTopLevelDecl(Declaration decl)
Add a top level declaration . |
java.util.Iterator<RoutineDecl> |
allRoutines()
Return an Iterator of all the routines . |
RoutineDecl[] |
allRoutinesArray()
Return an array of all the routines . |
static void |
cleanup()
Clean up for profiling statistics. |
void |
computeCallGraph()
Compute the call graph. |
Node |
getAST()
Return the root of the Clef abstract syntax tree (AST). |
RoutineDecl |
getMain()
Return the main procedure if any. |
java.lang.String |
getName()
Return the name associated with this call graph. |
SourceLanguage |
getSourceLanguage()
Return the source language of the call graph. |
Suite |
getSuite()
Return the Suite to which this
CallGraph belongs. |
Symtab |
getSymbolTable()
Return the symbol table for the clef tree. |
void |
graphCallTree(DisplayGraph da)
Create a graphic display of the call graph. |
int |
hashCode()
Use the file name of the source file. |
int |
numRoutines()
Return the number of routines in this call graph. |
void |
optimizeAST()
Apply optimizations to the AST. |
void |
printAllRoutines()
Print to out the routines in
this call graph. |
void |
processFunctionPointers()
Associate indirect calls with their targets. |
void |
readProfInfo(Vector<java.lang.String> profilePaths,
int profileOptions)
Read in the profiling information for every call node in the call graph. |
void |
recordRoutine(RoutineDecl rd)
Record the RoutineDecl . |
void |
removeClefAST()
Remove the Clef AST to save space. |
static void |
reportProfileProblem(java.lang.String text)
Generate a message for a profile data problem and abort. |
void |
setAST(Node ast)
Specify the root node of the AST. |
void |
setMain(RoutineDecl main)
Specify the main procedure (if any) in the CallGraph. |
java.util.Iterator<Declaration> |
topLevelDecls()
Return an Iterator of all the top level declarations except routines. |
java.util.Iterator<Declaration> |
topLevelDefDecls()
Return an Iterator of all the top level declarations (except routines) that
are defining definitions. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static boolean alphabeticalOrder
routines
in
alphabetical order.
Constructor Detail |
---|
public CallGraph(java.lang.String name, Suite suite, SourceLanguage sourceLang)
name
- the name of the Clef AST (i.e., the file name)suite
- is the collection of call graphssourceLang
- specifies the source language usedMethod Detail |
---|
public int hashCode()
hashCode
in class java.lang.Object
public final void optimizeAST()
public final Suite getSuite()
Suite
to which this
CallGraph belongs.
public final java.lang.String getName()
public final SourceLanguage getSourceLanguage()
public final Node getAST()
public final void setAST(Node ast)
public final void computeCallGraph()
public final void removeClefAST()
public final Symtab getSymbolTable()
public void addFunction(RoutineDecl p)
routines
that are referenced.
public void addCallee(RoutineDecl caller, RoutineDecl rd)
caller
- the call node representing the callerrd
- the declaration node representig the calleepublic void addProfiling(Vector<java.lang.String> moduleNames, int profileOptions)
moduleNames
- is the list of all source modules in the program
and must include the module containing "main"profileOptions
- specifies which profiling instrumentation to insertpublic static void reportProfileProblem(java.lang.String text)
public void readProfInfo(Vector<java.lang.String> profilePaths, int profileOptions)
profilePaths
- is the list of directories to search for
profile information and must include the module containing "main"profileOptions
- specifies which profiling instrumentation to insertpublic void printAllRoutines()
routines
in
this call graph.
public void processFunctionPointers()
public void recordRoutine(RoutineDecl rd)
RoutineDecl
.
public RoutineDecl getMain()
public void setMain(RoutineDecl main)
public java.util.Iterator<RoutineDecl> allRoutines()
Iterator
of all the routines
.
public RoutineDecl[] allRoutinesArray()
routines
.
public int numRoutines()
routines
in this call graph.
public void addTopLevelDecl(Declaration decl)
declaration
.
public java.util.Iterator<Declaration> topLevelDecls()
Iterator
of all the top level declarations
except routines.
public java.util.Iterator<Declaration> topLevelDefDecls()
Iterator
of all the top level declarations
(except routines) that
are defining definitions. We use this to distinguish between
defining and references declarations (ie., those with the extern
keyword).
public void graphCallTree(DisplayGraph da)
da
- is the graph displaypublic java.lang.String toString()
toString
in class java.lang.Object
public SymtabEntry addSymbol(Declaration decl)
declaration
to the
current symbol table scope.
public SymtabEntry addRootSymbol(Declaration decl)
declaration
to the
root symbol table scope.
public static void cleanup()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |