#include <proceduredb.h>
Inheritance diagram for procedureDB::
Public Methods | |
procedureDB () | |
Create a new procedureDB. More... | |
~procedureDB () | |
Destroy the procedure database. More... | |
void | build (procNode *root, Linker &linker) |
Build database. More... | |
void | clear () |
Clear. More... | |
void | add_procedure (procNode *proc) |
Add a procedure to the database. More... | |
procedureInfo * | lookup (procNode *proc) |
Lookup procedure-specific information. More... | |
void | setup_analysis () |
Set up analysis. More... | |
bool | is_in_scope (procedureInfo *info, memoryBlock *block) |
Is variable in scope. More... | |
void | mark_for_reanalysis (procedureInfo *info) |
Mark procedure for reanalysis. More... | |
bool | is_reanalysis_required (procedureInfo *info) |
Has reanalysis been forced? More... | |
int | times_called (procedureInfo *info) |
Times called. More... | |
void | stats (ostream &out) |
Print some statistics. More... | |
int | size () const |
Return the number of procedures. More... | |
Static Public Attributes | |
bool | _debug = false |
Private Attributes | |
proc_info_map | _procedures |
All procedures. More... | |
callGraph * | _callgraph |
Call graph. More... | |
procedureInfo::procedure_set | _need_reanalysis |
Need reanalysis. More... |
This class holds all of the procedureInfo instances. It also contains an instance of the Linker class, which connects up declarations across translation units. We also use it to look up procNodes given their declarations.
|
Create a new procedureDB. The constructor does not create the database |
|
Destroy the procedure database.
|
|
Add a procedure to the database.
|
|
Build database. This method first visits all the procedures currently parsed and builds a procedureInfo object for each. It uses the Linker object, which has already traversed the entire system and fixed the linkages between symbol references and externally defined symbols. |
|
Clear. Remove all procedureInfo objects and delete them. |
|
Is variable in scope. Check to see if the variable is accessible in the given procedure. We do this by seeing if it is local in this procedure, or any of the possible callers of this procedure. |
|
Has reanalysis been forced? At a procedure call, check to see if this particular procedure is on the _needs_reanalysis list, indicating that we cannot skip analyzing it, even if the inputs appear not to have changed. |
|
Lookup procedure-specific information.
|
|
Mark procedure for reanalysis. Record that particular procedure needs to be reanalyzed. Add all of it's ancestors to the list as well to ensure that we actually reach it again. |
|
Set up analysis. Add all procedures to the _needs_analysis list. |
|
Return the number of procedures.
|
|
Print some statistics.
|
|
Times called. Use the callgraph to estimate the number of paths from main down to the given procedure. We'll use this to decide when to make a procedure context insensitive. The basic heuristic is that if a procedure is small, and called in many places, then leave it context sensitive. |
|
Call graph.
|
|
|
|
Need reanalysis. In context-insensitive mode, we may need to revisit procedures because of changes in other calling contexts. Whenever a non-local change occurs, we add the procedure and all of it's ancestors back on this list. This ensures that we will revisit the procedure at some point. |
|
All procedures. A mapping from procedure definitions to procedure info objects |