Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

procedureInfo Class Reference

Procedure information. More...

#include <proceduredb.h>

List of all members.

Public Types

typedef map< basicblockNode *,
int > 
worklist_order_map
typedef worklist_order_map::iterator worklist_order_map_p
typedef map< stmtLocation *,
procedureInfo *> 
callsite_map
typedef callsite_map::iterator callsite_map_p
typedef callsite_map::const_iterator callsite_map_cp
typedef map< basicblockLocation *,
memoryblock_set > 
mergepoint_map
typedef mergepoint_map::iterator mergepoint_map_p
typedef set< procedureInfo * > procedure_set
typedef procedure_set::iterator procedure_set_p
typedef procedure_set::const_iterator procedure_set_cp

Public Methods

DFPreds * dominance_frontiers () const
 Return the dominance frontiers. More...

 procedureInfo (procNode *the_proc)
 Create a procedureInfo object for a procedure. More...

 ~procedureInfo ()
 Destroy a procedureInfo object. More...

void add_ancestor_set (procedure_set &ancestors)
 Add ancestor set. More...

void setup_call_at (procedureInfo *caller, stmtLocation *callsite)
 Call the procedure. More...

void return_from ()
 Return from the procedure. More...

procNode * proc () const
 Get the procedure. More...

string & name ()
 Get the procedure name. More...

const procedure_set & ancestors () const
 Set of ancestors. More...

const procedure_set & calls () const
 Return the calls. More...

const callsite_map & callsites () const
 Return the set of callsites. More...

stmtLocation * current_callsite () const
 Return the current callsite. More...

procedureInfo * current_caller ()
 Return the current caller. More...

procedureInfo * caller_at (stmtLocation *callsite)
 Return the caller. More...

bool is_current_call_recursive (procedureInfo *caller)
 Is recursive call? More...

procLocation * current_procedure_location ()
 Return the procedure location. More...

void print_call_stack (ostream &out)
 Print call stack. More...

void progress_meter (ostream &out)
 Progress meter. More...

void print (ostream &out)
 Output. More...

void stats (ostream &out)
 Stats. More...

Context insensitivity
void make_context_insensitive ()
 Set context-insensitive. More...

bool is_context_insensitive () const
 Is context-insensitive. More...

procLocation * get_context () const
 Get context-insensitive. More...

basicblockLocation * external_inputs_mergepoint ()
 Location to merge external inputs. More...

Merge-point management
void setup_merge_point (memoryBlock *block_to_merge, basicblockLocation *cur)
 Set up merge points. More...

memoryblock_set * lookup_merge_point (basicblockLocation *where)
 Lookup a merge point. More...

External input and output management
Manage external inputs and outputs when working in context-insensitive mode.

const memoryblock_set & external_inputs () const
 Get external inputs. More...

const memoryblock_set & external_outputs () const
 Get external outputs. More...

bool add_external_input (memoryBlock *block)
 Add an external input. More...

bool add_external_output (memoryBlock *block)
 Add an external output. More...

Worklist management
basicblockNode * get_next_block (Direction dir)
 Get the next block on the worklist. More...

void add_block (basicblockNode *block, Direction dir)
 Add a block to the worklist. More...

void add_reachable_blocks (basicblockNode *block, Direction dir)
 Add all reachable blocks to the worklist. More...

void add_all_blocks ()
 Add all blocks. More...

void add_start_block (Direction dir)
 Add the start node. More...

bool is_empty () const
 Test for empty worklist. More...


Private Methods

void reverse_post_order (Direction dir, basicblockNode *cur, basicblock_set &visited, basicblock_list &order)
 Compute a reverse post-ordering of the basic blocks. More...

int block_position (basicblockNode *block, Direction dir)
basicblockNode * block_at (int position, Direction dir)
void add_reachable_blocks_rec (Direction dir, basicblockNode *cur, worklist_set &temp, bool first)

Private Attributes

procNode * _proc
 A pointer to the procedure definition. More...

workList _worklist
 The worklist of basic blocks. More...

worklist_order_map _forward_worklist_order
 The forward ordering of basic blocks in the worklist. More...

vector< basicblockNode * > _forward_basicblock_order
 The forward enumeration of basic blocks. More...

worklist_order_map _backward_worklist_order
 The backward ordering of basic blocks in the worklist. More...

vector< basicblockNode * > _backward_basicblock_order
 The backward enumeration of basic blocks. More...

mergepoint_map _merge_points
 Merge points. More...

DFPreds * _dominance_frontiers
 Dominance frontiers. More...

loopTree * _loops
 Loop tree. More...

callsite_map _callsites
 Call sites. More...

stmtLocation * _current_callsite
 Current call site. More...

bool _context_insensitive
 Context insensitive. More...

TREE procLocation * _only_context
 Only context. More...

memoryblock_set _external_inputs
 External inputs. More...

memoryblock_set _external_outputs
 External outputs. More...

procedure_set _ancestors
 Ancestors. More...

procedure_set _calls
 Called procedures. More...

bool _is_recursive
 Called recursively. More...


Detailed Description

Procedure information.

This class holds information about a single procedure definition, including:

_unit : the unit in which it is defined _worklist_order : the best ordering of its basic blocks for the worklist _dominance_frontiers : the precomputed dominance frontiers _callsites : the set of places this procedure is called

At the start of analysis, only the first two fields are filled. When a procedure is actually encountered during analysis, then the worklist order and dominance frontiers are computed.


Member Typedef Documentation

typedef map< stmtLocation *, procedureInfo *> procedureInfo::callsite_map
 

typedef callsite_map::const_iterator procedureInfo::callsite_map_cp
 

typedef callsite_map::iterator procedureInfo::callsite_map_p
 

typedef map< basicblockLocation *, memoryblock_set > procedureInfo::mergepoint_map
 

typedef mergepoint_map::iterator procedureInfo::mergepoint_map_p
 

typedef set< procedureInfo * > procedureInfo::procedure_set
 

typedef procedure_set::const_iterator procedureInfo::procedure_set_cp
 

typedef procedure_set::iterator procedureInfo::procedure_set_p
 

typedef map< basicblockNode *, int > procedureInfo::worklist_order_map
 

typedef worklist_order_map::iterator procedureInfo::worklist_order_map_p
 


Constructor & Destructor Documentation

procedureInfo::procedureInfo (  procNode *    the_proc ) 
 

Create a procedureInfo object for a procedure.

This constructor creates a new instance, and precomputes the worklist orderings, and the dominance frontiers.

procedureInfo::~procedureInfo (    ) 
 

Destroy a procedureInfo object.


Member Function Documentation

void procedureInfo::add_all_blocks (    ) 
 

Add all blocks.

Add all blocks in the procedure to the worklist

void procedureInfo::add_ancestor_set (  procedure_set &    ancestors ) 
 

Add ancestor set.

(Only called once by the procedureDB::build method). Add the list of ancestors. This list is used to force reanalysis to reach the procedure.

void procedureInfo::add_block (  basicblockNode *    block,
Direction    dir
) 
 

Add a block to the worklist.

Add a block, fixing the position as necessary to point to the earliest block on the list.

bool procedureInfo::add_external_input (  memoryBlock *    block ) 
 

Add an external input.

This method is called by Pointers::record_external_inputs_and_outputs when it finds a use whose reaching definition is outside the current procedure. This method adds that variable as an external input.

Return true if the input wasn't already there.

bool procedureInfo::add_external_output (  memoryBlock *    block ) 
 

Add an external output.

This method is called by Pointers::record_external_inputs_and_outputs when it finds a def that could be accessed outside the current procedure. This method adds that variable as an extern output.

If the output is the result of a weak update, then we also add to the external inputs, and return whether or not this created a new input.

void procedureInfo::add_reachable_blocks (  basicblockNode *    block,
Direction    dir
) 
 

Add all reachable blocks to the worklist.

Add all the blocks reachable from the given block, NOT including the block itself.

void procedureInfo::add_reachable_blocks_rec (  Direction    dir,
basicblockNode *    cur,
worklist_set &    temp,
bool    first
)  [private]
 

void procedureInfo::add_start_block (  Direction    dir ) 
 

Add the start node.

This is either the entry node (for forward analysis) or the exit node (for backward analysis).

const procedure_set& procedureInfo::ancestors (    )  const [inline]
 

Set of ancestors.

basicblockNode * procedureInfo::block_at (  int    position,
Direction    dir
)  [private]
 

int procedureInfo::block_position (  basicblockNode *    block,
Direction    dir
)  [private]
 

procedureInfo * procedureInfo::caller_at (  stmtLocation *    callsite ) 
 

Return the caller.

Given a callsite, return the caller at that callsite.

const procedure_set& procedureInfo::calls (    )  const [inline]
 

Return the calls.

Return the set of procedures that this one calls.

const callsite_map& procedureInfo::callsites (    )  const [inline]
 

Return the set of callsites.

procedureInfo * procedureInfo::current_caller (    ) 
 

Return the current caller.

Returns null is there is none.

stmtLocation* procedureInfo::current_callsite (    )  const [inline]
 

Return the current callsite.

procLocation * procedureInfo::current_procedure_location (    ) 
 

Return the procedure location.

For context insensitive calls, this just returns the only context (see below). For context sensitive calls, it gets the procLocation attached to the current callsite.

DFPreds* procedureInfo::dominance_frontiers (    )  const [inline]
 

Return the dominance frontiers.

const memoryblock_set& procedureInfo::external_inputs (    )  const [inline]
 

Get external inputs.

basicblockLocation * procedureInfo::external_inputs_mergepoint (    ) 
 

Location to merge external inputs.

Attach the merge of external inputs to this location.

const memoryblock_set& procedureInfo::external_outputs (    )  const [inline]
 

Get external outputs.

procLocation* procedureInfo::get_context (    )  const [inline]
 

Get context-insensitive.

Return the context-insensitive callsite, or null if there is none.

basicblockNode * procedureInfo::get_next_block (  Direction    dir ) 
 

Get the next block on the worklist.

Return the next block on the worklist, and update the position.

bool procedureInfo::is_context_insensitive (    )  const [inline]
 

Is context-insensitive.

bool procedureInfo::is_current_call_recursive (  procedureInfo *    caller ) 
 

Is recursive call?

Check the callsite for recursion

bool procedureInfo::is_empty (    )  const
 

Test for empty worklist.

Return true if the worklist is empty, which typically indicates that we are done analyzing this particular procedure.

memoryblock_set * procedureInfo::lookup_merge_point (  basicblockLocation *    merge_location ) 
 

Lookup a merge point.

Given a particular basic block, see if there are any objects to be merged at its entry.

void procedureInfo::make_context_insensitive (    ) 
 

Set context-insensitive.

This flag can only be set before the first analysis of the procedure.

string& procedureInfo::name (    )  [inline]
 

Get the procedure name.

void procedureInfo::print (  ostream &    out ) 
 

Output.

void procedureInfo::print_call_stack (  ostream &    out ) 
 

Print call stack.

procNode* procedureInfo::proc (    )  const [inline]
 

Get the procedure.

void procedureInfo::progress_meter (  ostream &    out ) 
 

Progress meter.

void procedureInfo::return_from (    ) 
 

Return from the procedure.

This just clears the current callsite, so that there's no confusion.

void procedureInfo::reverse_post_order (  Direction    dir,
basicblockNode *    cur,
basicblock_set &    visited,
basicblock_list &    order
)  [private]
 

Compute a reverse post-ordering of the basic blocks.

This routine builds a reverse-post-order traversal of the control-flow graph. The direction argument is used to produce an ordering for the regular CFG as well as the reverse CFG (for backward analysis).

void procedureInfo::setup_call_at (  procedureInfo *    caller,
stmtLocation *    callsite
) 
 

Call the procedure.

Set up the procedure at the given callsite. This sets the current call site pointer.

void procedureInfo::setup_merge_point (  memoryBlock *    block_to_merge,
basicblockLocation *    cur
) 
 

Set up merge points.

When a memory block changes during pointer analysis, this method sets up merg points for the block in the dominance frontier of the procedure.

void procedureInfo::stats (  ostream &    out ) 
 

Stats.

Output a whole bunch of statistics about this procedure (particularly useful after analysis is complete).


Member Data Documentation

procedure_set procedureInfo::_ancestors [private]
 

Ancestors.

Maintain a set of ancestors in the call graph. This makes searching the scope and updating the worklist faster.

vector< basicblockNode * > procedureInfo::_backward_basicblock_order [private]
 

The backward enumeration of basic blocks.

This maps basic blocks to bit positions in the worklist.

worklist_order_map procedureInfo::_backward_worklist_order [private]
 

The backward ordering of basic blocks in the worklist.

We precompute this ordering to favor quick convergence of dataflow problems. It's just a depth-first ordering.

procedure_set procedureInfo::_calls [private]
 

Called procedures.

The procedures directly called by this one.

callsite_map procedureInfo::_callsites [private]
 

Call sites.

This set holds all of the statements that are determined to be calls to this procedure. The map is from callsites to the procedure making the call (the context).

bool procedureInfo::_context_insensitive [private]
 

Context insensitive.

Set to true if this procedure is analyzed context insensitively.

stmtLocation* procedureInfo::_current_callsite [private]
 

Current call site.

Set by the call() method.

DFPreds* procedureInfo::_dominance_frontiers [private]
 

Dominance frontiers.

This is a special version of dominance frontiers. For each node X in the dominance frontier of some node Y, it also provide the particular immediate predecessor of Y that is dominated by X.

memoryblock_set procedureInfo::_external_inputs [private]
 

External inputs.

When a procedure is analyzed without context sensitivity, we need to record those objects that enter the procedure from outside. We can think of these objects as inputs to the procedure that are not represented in the parameter list (e.g, a global variable). Since each context could have a different reaching def, we need to merge together those reaching defs before entering the procedure. This works a bit like a merge-point.

memoryblock_set procedureInfo::_external_outputs [private]
 

External outputs.

Like the external inputs, when we're using context insensitive mode, defs inside the procedure can reach outside the procedure. We can think of these objects as outputs from the procedure. In order to make sure that those defs reach the right uses, we create a def at the callsite with a use whose reaching definition is inside the procedure.

vector< basicblockNode * > procedureInfo::_forward_basicblock_order [private]
 

The forward enumeration of basic blocks.

This maps basic blocks to bit positions in the worklist.

worklist_order_map procedureInfo::_forward_worklist_order [private]
 

The forward ordering of basic blocks in the worklist.

We precompute this ordering to favor quick convergence of dataflow problems. It's just a depth-first ordering.

bool procedureInfo::_is_recursive [private]
 

Called recursively.

Record if this procedure is recursive.

loopTree* procedureInfo::_loops [private]
 

Loop tree.

This object contains all the information we need about the loops in this procedure. In addition, it provides a classification of all edges in the control-flow graph.

mergepoint_map procedureInfo::_merge_points [private]
 

Merge points.

These are the phi functions for this procedure. Note that since a procedure may be called in many different contexts, we need to separate the merge points out.

TREE procLocation* procedureInfo::_only_context [private]
 

Only context.

For context insensitive procedures, we build a separate location tree that holds all of the context insensitive uses and defs.

Note that since this location is removed from the location tree, this object actually owns it.

procNode* procedureInfo::_proc [private]
 

A pointer to the procedure definition.

workList procedureInfo::_worklist [private]
 

The worklist of basic blocks.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 12:06:32 2002 for C-Breeze by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001