C-Breeze
C Compiler Infrastructure

[ Project home page]
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   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 map< stmtLocation *,
memoryblock_set
callsite_changes_map
typedef callsite_changes_map::iterator callsite_changes_map_p
typedef map< procedureInfo *,
int > 
proc_int_map
typedef proc_int_map::iterator proc_int_map_p

Public Member Functions

DFPredsdominance_frontiers () const
 Return the dominance frontiers.

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

 ~procedureInfo ()
 Destroy a procedureInfo object.

void add_ancestor_set (procedureinfo_set &ancestors)
 Add ancestor set.

void setup_call_at (procedureInfo *caller, stmtLocation *callsite, bool is_recursive_call, bool multiple_target_call)
 Call the procedure.

procNodeproc () const
 Return from the procedure Get the procedure.

string & name ()
 Get the procedure name.

string qualified_name ()
 Qualified name.

const procedureinfo_setancestors () const
 Set of ancestors.

const procedureinfo_setcalls () const
 Return the calls.

const callsite_mapcallsites () const
 Return the set of callsites.

procedureInfo * first_caller () const
 Return the first caller.

bool is_recursive () const
 Is procedure recursive?

void set_recursive ()
 Set recursive flag.

declNodereturn_variable () const
 Return variable.

returnNodereturn_stmt () const
 Return statment.

bool never_returns () const
 Test never returns flag.

void set_never_returns ()
 Set never returns flag.

void set_pending_changes (stmtLocation *callsite, memoryblock_set &changes)
 Set pending changes.

void get_pending_changes (stmtLocation *callsite, memoryblock_set &changes)
 Get pending changes.

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

bool is_ancestor (procedureInfo *other)
 Is ancestor?

procLocationprocedure_location (stmtLocation *callsite)
 Get the procedure location.

int analysis_count () const
 Get the analysis count.

void incr_analysis_count ()
 Increment analysis count.

bool is_verbose () const
 Is verbose?

bool is_library_routine ()
 Is library routine?

void print (ostream &out)
 Output.

void stats (ostream &out)
 Stats.

int count_calling_contexts ()
 Count contexts.

int procedure_size ()
 Procedure size.

void start_self_timer ()
 Start the self timer.

void stop_self_timer ()
 Stop the self timer.

double self_timer ()
 Return the self time.

void start_total_timer ()
 Start the total timer.

void stop_total_timer ()
 Stop the total timer.

double total_timer ()
 Return the total time.

Context insensitivity
bool is_context_insensitive () const
 Is context-insensitive.

bool prefer_context_sensitive () const
 Do we prefer context sensitive?

void set_prefer_context_sensitive ()
 Set context-sensitivity preference.

procLocationget_context () const
 Get context-insensitive.

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

memoryblock_setlookup_merge_point (basicblockLocation *where)
 Lookup a merge point.

void check_merge_point (memoryBlock *block_to_merge, basicblockLocation *cur)
 Check merge point.

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

const memoryblock_setexternal_inputs () const
 Get external inputs.

const memoryblock_setexternal_outputs () const
 Get external outputs.

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

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

Worklist management
basicblockNodeget_next_block (Direction dir)
 Get the next block on the worklist.

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

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

void add_all_blocks ()
 Add all blocks.

void add_start_block (Direction dir)
 Add the start node.

bool is_empty () const
 Test for empty worklist.

void remove_branch_blocks (basicblockNode *cond, basicblockNode *branch_taken, basicblockNode *branch_not_taken)
 Remove branch.

void update_conditional_worklist (basicblockNode *block, bool has_truth_value, bool which_branch)
 Conditional worklist algorithm.

cfg_edge_setactive_edges ()
 Active edges.


Private Types

typedef map< basicblockNode *,
basicblockNode * > 
true_branch_map
 True branches.

typedef true_branch_map::iterator true_branch_map_p

Private Member Functions

int count_calling_contexts_rec (proc_int_map &count, stmtNode *callsite)
 Count contexts.

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

void dfs_dominators (Direction dir, basicblockNode *cur, basicblock_set &visited, basicblock_list &order, basicblock_list &rpo_order)
 Alternative ordering.

int block_position (basicblockNode *block, Direction dir)
basicblockNodeblock_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.

workList _worklist
 The worklist of basic blocks.

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

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

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

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

mergepoint_map _merge_points
 Merge points.

DFPreds_dominance_frontiers
 Dominance frontiers.

loopTree_loops
 Loop tree.

callsite_map _callsites
 Call sites.

declNode_return_variable
 Return value variable.

returnNode_return_stmt
 Return statement.

bool _never_returns
 Never returns.

callsite_changes_map _pending_changes
 Pending changes.

bool _context_insensitive
 Current call site Context insensitive.

bool _prefer_context_sensitive
 Prefer context sensitive.

TREE procLocation_only_context
 Only context.

memoryblock_set _external_inputs
 External inputs.

memoryblock_set _external_outputs
 External outputs.

procedureinfo_set _ancestors
 Ancestors.

procedureInfo * _first_caller
 First caller.

procedureinfo_set _calls
 Called procedures.

bool _is_recursive
 Called recursively.

basicblock_set _blocks_to_skip
 Blocks to skip.

cfg_edge_set _active_edges
 Active edges.

true_branch_map _true_branches
int _analysis_count
 Analysis count.

bool _verbose
 Verbose.

cbzTimer _self_timer
 Self timer.

cbzTimer _total_timer
 Total timer.


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.

Definition at line 76 of file proceduredb.h.


Member Typedef Documentation

typedef map< stmtLocation *, memoryblock_set> procedureInfo::callsite_changes_map
 

Definition at line 94 of file proceduredb.h.

typedef callsite_changes_map::iterator procedureInfo::callsite_changes_map_p
 

Definition at line 95 of file proceduredb.h.

Referenced by get_pending_changes().

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

Definition at line 85 of file proceduredb.h.

Referenced by count_calling_contexts_rec(), and Pointers::pass_one_external_output().

typedef callsite_map::const_iterator procedureInfo::callsite_map_cp
 

Definition at line 87 of file proceduredb.h.

Referenced by count_calling_contexts_rec(), and Pointers::pass_one_external_output().

typedef callsite_map::iterator procedureInfo::callsite_map_p
 

Definition at line 86 of file proceduredb.h.

Referenced by caller_at().

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

Definition at line 89 of file proceduredb.h.

typedef mergepoint_map::iterator procedureInfo::mergepoint_map_p
 

Definition at line 90 of file proceduredb.h.

Referenced by lookup_merge_point().

typedef map< procedureInfo *, int > procedureInfo::proc_int_map
 

Definition at line 99 of file proceduredb.h.

Referenced by count_calling_contexts().

typedef proc_int_map::iterator procedureInfo::proc_int_map_p
 

Definition at line 100 of file proceduredb.h.

Referenced by count_calling_contexts_rec().

typedef map< basicblockNode *, basicblockNode * > procedureInfo::true_branch_map [private]
 

True branches.

This sucks: keep a mapping from conditionals to the true branches. Apparently there is no convention in the dismantler/cfg.

Definition at line 311 of file proceduredb.h.

typedef true_branch_map::iterator procedureInfo::true_branch_map_p [private]
 

Definition at line 312 of file proceduredb.h.

Referenced by update_conditional_worklist().

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

Definition at line 80 of file proceduredb.h.

Referenced by block_position().

typedef worklist_order_map::iterator procedureInfo::worklist_order_map_p
 

Definition at line 81 of file proceduredb.h.

Referenced by block_position().


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.

Definition at line 701 of file proceduredb.cc.

References _backward_basicblock_order, _backward_worklist_order, _forward_basicblock_order, _forward_worklist_order, _prefer_context_sensitive, _proc, _return_stmt, _return_variable, _true_branches, _verbose, _worklist, basicblock_list, basicblock_list_p, basicblock_set, Condition, pointerOptions::Context_sensitive_procedures, procNode::decl(), idNode::decl(), dfs_dominators(), procNode::entry(), procNode::exit(), returnNode::expr(), Id, gotoNode::label(), Label, workList::max_size(), declNode::name(), name(), labelNode::name(), Return, reverse_post_order(), stmt_list_p, blockNode::stmts(), str_set_p, Node::typ(), and pointerOptions::Verbose_procedures.

procedureInfo::~procedureInfo  
 

Destroy a procedureInfo object.

Definition at line 876 of file proceduredb.cc.

References _dominance_frontiers, _loops, and _only_context.


Member Function Documentation

cfg_edge_set& procedureInfo::active_edges   [inline]
 

Active edges.

Return the set of active edges.

Definition at line 667 of file proceduredb.h.

References cfg_edge_set.

Referenced by Pointers::process_merge_point().

void procedureInfo::add_all_blocks  
 

Add all blocks.

Add all blocks in the procedure to the worklist

Definition at line 1603 of file proceduredb.cc.

References _active_edges, _blocks_to_skip, _worklist, and workList::add_all_blocks().

Referenced by Pointers::analyze_procedure().

void procedureInfo::add_ancestor_set procedureinfo_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.

Definition at line 883 of file proceduredb.cc.

References _ancestors.

Referenced by procedureDB::build().

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.

Definition at line 1526 of file proceduredb.cc.

References _blocks_to_skip, _worklist, workList::add_block(), basicblock_set_p, and block_position().

Referenced by add_reachable_blocks_rec(), and add_start_block().

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.

Definition at line 1156 of file proceduredb.cc.

References _external_inputs, vector_set< memoryBlock * >::find(), vector_set< memoryBlock * >::insert(), and memoryBlock::name().

Referenced by add_external_output(), Pointers::nearest_def_at(), and Pointers::record_external_inputs_and_outputs().

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.

Definition at line 1173 of file proceduredb.cc.

References _external_outputs, add_external_input(), memoryBlock::current_def(), vector_set< memoryBlock * >::find(), vector_set< memoryBlock * >::insert(), memoryAccess::is_weak(), and memoryBlock::name().

Referenced by Pointers::record_external_inputs_and_outputs().

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.

Definition at line 1547 of file proceduredb.cc.

References add_reachable_blocks_rec(), and worklist_set.

Referenced by Pointers::analyze_procedure(), and livenessAnalyzer::at_basicblock_entry().

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

Definition at line 1567 of file proceduredb.cc.

References add_block(), basicblock_list, basicblock_list_p, block_position(), Forward, basicblockNode::preds(), and basicblockNode::succs().

Referenced by add_reachable_blocks().

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).

Definition at line 1612 of file proceduredb.cc.

References add_block(), Forward, and proc().

int procedureInfo::analysis_count   const [inline]
 

Get the analysis count.

Definition at line 673 of file proceduredb.h.

Referenced by procedureDB::number_of_procedures().

const procedureinfo_set& procedureInfo::ancestors   const [inline]
 

Set of ancestors.

Definition at line 405 of file proceduredb.h.

References procedureinfo_set.

Referenced by procedureDB::is_visible_to().

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

Definition at line 1802 of file proceduredb.cc.

References _backward_basicblock_order, _forward_basicblock_order, and Forward.

Referenced by get_next_block().

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

Definition at line 1767 of file proceduredb.cc.

References _backward_worklist_order, _forward_worklist_order, Forward, stmtNode::output(), worklist_order_map, and worklist_order_map_p.

Referenced by add_block(), add_reachable_blocks_rec(), and remove_branch_blocks().

procedureInfo * procedureInfo::caller_at stmtLocation   callsite
 

Return the current callsite Return the current caller Return the caller.

Given a callsite, return the caller at that callsite.

Definition at line 1118 of file proceduredb.cc.

References _callsites, and callsite_map_p.

const procedureinfo_set& procedureInfo::calls   const [inline]
 

Return the calls.

Return the set of procedures that this one calls.

Definition at line 411 of file proceduredb.h.

References procedureinfo_set.

const callsite_map& procedureInfo::callsites   const [inline]
 

Return the set of callsites.

Definition at line 415 of file proceduredb.h.

Referenced by count_calling_contexts_rec(), and Pointers::pass_one_external_output().

void procedureInfo::check_merge_point memoryBlock   block_to_merge,
basicblockLocation   cur
 

Check merge point.

This method is used only for debugging to make sure we aren't finding new things to merge.

Definition at line 1343 of file proceduredb.cc.

References _dominance_frontiers, basicblock_set, basicblock_set_map, basicblock_set_map_map_p, basicblock_set_map_p, basicblockLocation::block(), memoryBlock::current_def(), def, memoryBlock::is_flow_sensitive(), memoryBlock::last_def_at(), procLocation::lookup_block(), basicblockLocation::proc_location(), and pointerOptions::Verbose.

int procedureInfo::count_calling_contexts  
 

Count contexts.

Count the number of calling contexts for the given procedure.

Definition at line 1865 of file proceduredb.cc.

References count_calling_contexts_rec(), and proc_int_map.

Referenced by Pointers::compute_accuracy(), and stats().

int procedureInfo::count_calling_contexts_rec proc_int_map   count,
stmtNode   callsite
[private]
 

Count contexts.

Count the number of calling contexts for the given procedure.

Definition at line 1880 of file proceduredb.cc.

References callsite_map, callsite_map_cp, callsites(), is_recursive(), proc_int_map_p, stmt_set, and stmt_set_p.

Referenced by count_calling_contexts().

void procedureInfo::dfs_dominators Direction    dir,
basicblockNode   cur,
basicblock_set   visited,
basicblock_list   order,
basicblock_list   rpo_order
[private]
 

Alternative ordering.

Depth-first search of the dominator tree.

Definition at line 1464 of file proceduredb.cc.

References basicblock_list, basicblock_list_p, and basicblockNode::children().

Referenced by procedureInfo().

DFPreds* procedureInfo::dominance_frontiers   const [inline]
 

Return the dominance frontiers.

Definition at line 348 of file proceduredb.h.

Referenced by mergePoints::find_merge_points().

const memoryblock_set& procedureInfo::external_inputs   const [inline]
 

Get external inputs.

Definition at line 573 of file proceduredb.h.

Referenced by Pointers::pass_external_inputs(), Pointers::process_local_changes(), and Pointers::record_external_inputs_and_outputs().

const memoryblock_set& procedureInfo::external_outputs   const [inline]
 

Get external outputs.

Definition at line 577 of file proceduredb.h.

Referenced by Pointers::pass_external_outputs().

procedureInfo* procedureInfo::first_caller   const [inline]
 

Return the first caller.

Definition at line 419 of file proceduredb.h.

Referenced by procedureDB::mark_for_reanalysis().

procLocation* procedureInfo::get_context   const [inline]
 

Get context-insensitive.

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

Definition at line 531 of file proceduredb.h.

Referenced by Pointers::pass_one_external_output().

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.

Definition at line 1512 of file proceduredb.cc.

References _worklist, block_at(), workList::get_next_block(), and workList::is_empty().

Referenced by Pointers::analyze_procedure().

void procedureInfo::get_pending_changes stmtLocation   callsite,
memoryblock_set   changes
 

Get pending changes.

Check the current callsite to see if changes were left behind by a previous analysis in a different context. If so, get the changes now and merge them in.

Definition at line 1078 of file proceduredb.cc.

References _pending_changes, callsite_changes_map_p, vector_set< memoryBlock * >::insert(), memoryblock_set_p, and memoryBlock::set_current_def_use().

Referenced by Pointers::procedure_call().

void procedureInfo::incr_analysis_count   [inline]
 

Increment analysis count.

Definition at line 677 of file proceduredb.h.

Referenced by Pointers::analyze_procedure().

bool procedureInfo::is_ancestor procedureInfo *    other
 

Is ancestor?

Return true if the given procedure is an ancestor in the call graph.

Definition at line 1131 of file proceduredb.cc.

References _ancestors, and procedureinfo_set_p.

bool procedureInfo::is_context_insensitive   const [inline]
 

Is context-insensitive.

Definition at line 517 of file proceduredb.h.

Referenced by Pointers::analyze_procedure_at(), Pointers::nearest_def_at(), procedureDB::number_of_procedures(), Pointers::pass_external_inputs(), Pointers::pass_external_outputs(), procedure_location(), Pointers::progress_meter(), qualified_name(), setup_call_at(), and stats().

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.

Definition at line 1625 of file proceduredb.cc.

References _worklist, and workList::is_empty().

Referenced by Pointers::analyze_procedure().

bool procedureInfo::is_library_routine   [inline]
 

Is library routine?

Test the decl_location of the procedure declaration.

Definition at line 687 of file proceduredb.h.

References procNode::decl(), declNode::decl_location(), proc(), and declNode::UNKNOWN.

Referenced by procedureDB::number_of_procedures(), and procedureDB::stats().

bool procedureInfo::is_recursive   const [inline]
 

Is procedure recursive?

This boolean is set if the analyzer discovers that the procedure is part of a recursive cycle.

Definition at line 426 of file proceduredb.h.

Referenced by count_calling_contexts_rec(), procedureDB::is_recursive_call(), procedureDB::number_of_procedures(), qualified_name(), and setup_call_at().

bool procedureInfo::is_verbose   const [inline]
 

Is verbose?

Definition at line 681 of file proceduredb.h.

Referenced by Pointers::analyze_procedure().

memoryblock_set * procedureInfo::lookup_merge_point basicblockLocation   where
 

Lookup a merge point.

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

Definition at line 1313 of file proceduredb.cc.

References _merge_points, memoryblock_set_cp, and mergepoint_map_p.

Referenced by Pointers::process_merge_point().

string& procedureInfo::name   [inline]
 

Get the procedure name.

Definition at line 394 of file proceduredb.h.

References procNode::decl(), declNode::name(), and proc().

Referenced by Pointers::analyze_procedure_at(), procedureDB::is_reanalysis_required(), procedureDB::mark_for_reanalysis(), Pointers::nearest_def_at(), Pointers::pass_return_value(), procedureDB::print_call_stack(), procedureInfo(), qualified_name(), and Pointers::record_external_inputs_and_outputs().

bool procedureInfo::never_returns   const [inline]
 

Test never returns flag.

When true, it indicates that this procedure never returns, probably because it always calls exit() or abort().

Definition at line 454 of file proceduredb.h.

Referenced by Pointers::analyze_procedure_at(), Pointers::pass_external_outputs(), Pointers::procedure_call(), and qualified_name().

bool procedureInfo::prefer_context_sensitive   const [inline]
 

Do we prefer context sensitive?

Definition at line 521 of file proceduredb.h.

Referenced by setup_call_at().

void procedureInfo::print ostream &    out
 

Output.

Definition at line 1810 of file proceduredb.cc.

References _proc, procNode::decl(), and declNode::name().

procNode* procedureInfo::proc   const [inline]
 

Return from the procedure Get the procedure.

Definition at line 390 of file proceduredb.h.

Referenced by add_start_block(), livenessAnalyzer::at_procedure_entry(), is_library_routine(), procedureDB::is_visible_to(), procedureDB::is_visible_to_caller(), name(), Pointers::nearest_def_at(), Pointers::pass_parameters(), Pointers::procedure_call(), procedure_size(), Pointers::record_external_inputs_and_outputs(), setup_call_at(), and procedureDB::times_called().

procLocation * procedureInfo::procedure_location stmtLocation   callsite
 

Get the procedure location.

For a given callsite, return the corresponding procLocation of the called procedure. For context-insensitive procedures, we just return the one context.

Definition at line 1144 of file proceduredb.cc.

References _only_context, stmtLocation::calls(), and is_context_insensitive().

Referenced by Pointers::analyze_procedure_at(), Pointers::pass_one_external_input(), Pointers::pass_parameters(), Pointers::pass_return_value(), and Pointers::record_external_inputs_and_outputs().

int procedureInfo::procedure_size  
 

Procedure size.

Count the number of statements in the dismantled form of the procedure.

Definition at line 1977 of file proceduredb.cc.

References procNode::body(), proc(), stmt_list_p, and blockNode::stmts().

Referenced by procedureDB::number_of_procedures(), and stats().

string procedureInfo::qualified_name  
 

Qualified name.

Includes either (I), (S), or (R) for context-insensitive, context-sensitive, or recursive.

Definition at line 987 of file proceduredb.cc.

References _callsites, _external_inputs, _external_outputs, is_context_insensitive(), is_recursive(), name(), never_returns(), self_timer(), and total_timer().

Referenced by Pointers::analyze_procedure(), procedureDB::build(), procedureDB::progress_meter(), and setup_call_at().

void procedureInfo::remove_branch_blocks basicblockNode   cond,
basicblockNode   branch_taken,
basicblockNode   branch_not_taken
 

Remove branch.

This routine removes basic blocks that will not be visited when the direction of a branch can be determined.

Definition at line 1635 of file proceduredb.cc.

References _blocks_to_skip, _forward_basicblock_order, _worklist, block_position(), Dominators::dominates(), and workList::remove_block().

Referenced by update_conditional_worklist().

returnNode* procedureInfo::return_stmt   const [inline]
 

Return statment.

Get a pointer to the returnNode (there should only be one!)

Definition at line 447 of file proceduredb.h.

Referenced by Pointers::pass_return_value().

declNode* procedureInfo::return_variable   const [inline]
 

Return variable.

For procedures with a return value this field holds the declaration of the special dismantler-created variable to hold that value. Such variables are flagged as return values in their declaration.

Definition at line 441 of file proceduredb.h.

Referenced by Pointers::eval(), Pointers::pass_return_value(), and Pointers::record_external_inputs_and_outputs().

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).

Definition at line 1419 of file proceduredb.cc.

References _loops, loopTree::BackEdge, basicblock_list, loopTree::classifyEdge(), Forward, basicblockNode::preds(), and basicblockNode::succs().

Referenced by procedureInfo().

double procedureInfo::self_timer   [inline]
 

Return the self time.

Definition at line 723 of file proceduredb.h.

References cbzTimer::time().

Referenced by qualified_name(), and stats().

void procedureInfo::set_never_returns   [inline]
 

Set never returns flag.

Setting this flag indicates that the procedure never returns. This is caused by a call to exit() or abort() that dominates the end of the procedure.

Definition at line 462 of file proceduredb.h.

Referenced by Pointers::analyze_procedure().

void procedureInfo::set_pending_changes stmtLocation   callsite,
memoryblock_set   changes
 

Set pending changes.

In context-sensitive analysis when we pass external outputs back to other callsites, we need to collect those changes so that the calling procedure will see them when it's analyzed. This routine stores that set of changes for the caller according to the callsite.

Definition at line 1065 of file proceduredb.cc.

References _pending_changes.

Referenced by Pointers::pass_one_external_output().

void procedureInfo::set_prefer_context_sensitive   [inline]
 

Set context-sensitivity preference.

Definition at line 525 of file proceduredb.h.

void procedureInfo::set_recursive   [inline]
 

Set recursive flag.

Set by the analyzer when it discovers that the procedure is part of a recrusive cycle.

Definition at line 433 of file proceduredb.h.

Referenced by procedureDB::build(), and procedureDB::is_recursive_call().

void procedureInfo::setup_call_at procedureInfo *    caller,
stmtLocation   callsite,
bool    is_recursive_call,
bool    multiple_target_call
 

Call the procedure.

Set up the procedure at the given callsite. This method performs many tasks, including making the procedure context-insensitive, if that's called for.

Definition at line 888 of file proceduredb.cc.

References _calls, _callsites, _context_insensitive, _first_caller, _only_context, stmtLocation::calls(), pointerOptions::Context_insensitive, is_context_insensitive(), is_recursive(), prefer_context_sensitive(), proc(), procLocation::proc(), qualified_name(), pointerOptions::Recursion_Context_sensitive, stmtLocation::remove_call(), and stmtLocation::setup_cs_call().

Referenced by Pointers::procedure_call().

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.

Definition at line 1210 of file proceduredb.cc.

References _dominance_frontiers, _merge_points, basicblock_set, basicblock_set_map, basicblock_set_map_map_p, basicblock_set_map_p, basicblockLocation::block(), memoryBlock::current_def(), def, memoryBlock::is_flow_sensitive(), basicblockLocation::last(), procLocation::lookup_block(), memoryBlock::name(), memoryBlock::nearest_def_at(), basicblockLocation::proc_location(), memoryBlock::setup_merge_uses_at(), and pointerOptions::Verbose.

Referenced by Pointers::process_local_changes().

void procedureInfo::start_self_timer   [inline]
 

Start the self timer.

Definition at line 715 of file proceduredb.h.

References cbzTimer::start().

Referenced by Pointers::analyze(), and Pointers::procedure_call().

void procedureInfo::start_total_timer   [inline]
 

Start the total timer.

Definition at line 727 of file proceduredb.h.

References cbzTimer::start().

Referenced by Pointers::analyze(), and Pointers::procedure_call().

void procedureInfo::stats ostream &    out
 

Stats.

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

Definition at line 1820 of file proceduredb.cc.

References _ancestors, _calls, _callsites, _external_inputs, _external_outputs, _proc, count_calling_contexts(), procNode::decl(), is_context_insensitive(), declNode::name(), procedure_size(), self_timer(), and total_timer().

Referenced by procedureDB::stats().

void procedureInfo::stop_self_timer   [inline]
 

Stop the self timer.

Definition at line 719 of file proceduredb.h.

References cbzTimer::stop().

Referenced by Pointers::analyze(), and Pointers::procedure_call().

void procedureInfo::stop_total_timer   [inline]
 

Stop the total timer.

Definition at line 731 of file proceduredb.h.

References cbzTimer::stop().

Referenced by Pointers::analyze(), and Pointers::procedure_call().

double procedureInfo::total_timer   [inline]
 

Return the total time.

Definition at line 735 of file proceduredb.h.

References cbzTimer::time().

Referenced by qualified_name(), and stats().

void procedureInfo::update_conditional_worklist basicblockNode   block,
bool    has_truth_value,
bool    which_branch
 

Conditional worklist algorithm.

Process a conditional branch.

Definition at line 1675 of file proceduredb.cc.

References _active_edges, _true_branches, basicblock_list_p, cfg_edge_pair, cfg_edge_set_p, basicblockNode::dfn(), remove_branch_blocks(), basicblockNode::succs(), and true_branch_map_p.

Referenced by Pointers::analyze_procedure().


Member Data Documentation

cfg_edge_set procedureInfo::_active_edges [private]
 

Active edges.

Definition at line 304 of file proceduredb.h.

Referenced by add_all_blocks(), and update_conditional_worklist().

int procedureInfo::_analysis_count [private]
 

Analysis count.

Count the number of times the procedure is analyzed.

Definition at line 320 of file proceduredb.h.

procedureinfo_set procedureInfo::_ancestors [private]
 

Ancestors.

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

Definition at line 271 of file proceduredb.h.

Referenced by add_ancestor_set(), is_ancestor(), and stats().

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

The backward enumeration of basic blocks.

This maps basic blocks to bit positions in the worklist.

Definition at line 136 of file proceduredb.h.

Referenced by block_at(), and procedureInfo().

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.

Definition at line 130 of file proceduredb.h.

Referenced by block_position(), and procedureInfo().

basicblock_set procedureInfo::_blocks_to_skip [private]
 

Blocks to skip.

In conditional mode, this tells us which blocks are currently being skipped because they are on branches that are not taken. We need this list in order to set up the merge points properly.

Definition at line 298 of file proceduredb.h.

Referenced by add_all_blocks(), add_block(), and remove_branch_blocks().

procedureinfo_set procedureInfo::_calls [private]
 

Called procedures.

The procedures directly called by this one.

Definition at line 284 of file proceduredb.h.

Referenced by setup_call_at(), and stats().

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).

Definition at line 168 of file proceduredb.h.

Referenced by caller_at(), qualified_name(), setup_call_at(), and stats().

bool procedureInfo::_context_insensitive [private]
 

Current call site Context insensitive.

Set to true if this procedure is analyzed context insensitively.

Definition at line 223 of file proceduredb.h.

Referenced by setup_call_at().

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.

Definition at line 152 of file proceduredb.h.

Referenced by check_merge_point(), setup_merge_point(), and ~procedureInfo().

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.

Definition at line 253 of file proceduredb.h.

Referenced by add_external_input(), qualified_name(), and stats().

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.

Definition at line 264 of file proceduredb.h.

Referenced by add_external_output(), qualified_name(), and stats().

procedureInfo* procedureInfo::_first_caller [private]
 

First caller.

Creates a minimum spanning tree of the call graph. We use this to mark for reanalysis.

Definition at line 278 of file proceduredb.h.

Referenced by setup_call_at().

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

The forward enumeration of basic blocks.

This maps basic blocks to bit positions in the worklist.

Definition at line 123 of file proceduredb.h.

Referenced by block_at(), procedureInfo(), and remove_branch_blocks().

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.

Definition at line 117 of file proceduredb.h.

Referenced by block_position(), and procedureInfo().

bool procedureInfo::_is_recursive [private]
 

Called recursively.

Record if this procedure is recursive.

Definition at line 290 of file proceduredb.h.

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.

Definition at line 160 of file proceduredb.h.

Referenced by reverse_post_order(), and ~procedureInfo().

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.

Definition at line 144 of file proceduredb.h.

Referenced by lookup_merge_point(), and setup_merge_point().

bool procedureInfo::_never_returns [private]
 

Never returns.

When this flag is set true it indicates that the given procedure never returns. This can happen if a procedure always calls exit(), for example. We'll use this information to prune the control-flow graph.

Definition at line 190 of file proceduredb.h.

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.

Definition at line 241 of file proceduredb.h.

Referenced by procedure_location(), setup_call_at(), and ~procedureInfo().

callsite_changes_map procedureInfo::_pending_changes [private]
 

Pending changes.

When this procedure calls a procedure that is context-insensitive, it is possible that other callsites will produce changes that are propagated here. For example:

foo() { bar(); } baz() { bar(); }

Assume bar() is context-insensitive. While analyzing bar() in the baz() context, we may need to propagate changes to the foo() callsite. The reason that this isn't a problem in the baz() context is that we actually pass the changes back to baz() as the external_changes set.

The solution is to store the changes produced by passing the external output in this map, and then pick them up when we actually revisit the context.

Definition at line 211 of file proceduredb.h.

Referenced by get_pending_changes(), and set_pending_changes().

bool procedureInfo::_prefer_context_sensitive [private]
 

Prefer context sensitive.

This flag is set at the beginning of the analysis to indicate that the preferred mode for this procedure is context sensitive. We only check this flag during context insensitive analysis.

Definition at line 231 of file proceduredb.h.

Referenced by procedureInfo().

procNode* procedureInfo::_proc [private]
 

A pointer to the procedure definition.

Definition at line 106 of file proceduredb.h.

Referenced by print(), procedureInfo(), and stats().

returnNode* procedureInfo::_return_stmt [private]
 

Return statement.

Store a pointer to the return statement (there should only be one!)

Definition at line 181 of file proceduredb.h.

Referenced by procedureInfo().

declNode* procedureInfo::_return_variable [private]
 

Return value variable.

Store the special return value variable so that we can easily get it when we need to retrieve the return value.

Definition at line 175 of file proceduredb.h.

Referenced by procedureInfo().

cbzTimer procedureInfo::_self_timer [private]
 

Self timer.

Keep track of the total time spent analyzing this routine (not including called routines).

Definition at line 334 of file proceduredb.h.

cbzTimer procedureInfo::_total_timer [private]
 

Total timer.

Keep track of the total time spend analyzing this routine, including procedures that it calls.

Definition at line 341 of file proceduredb.h.

true_branch_map procedureInfo::_true_branches [private]
 

Definition at line 314 of file proceduredb.h.

Referenced by procedureInfo(), and update_conditional_worklist().

bool procedureInfo::_verbose [private]
 

Verbose.

When true, turn on verbose output when we're analyzing this procedure.

Definition at line 327 of file proceduredb.h.

Referenced by procedureInfo().

workList procedureInfo::_worklist [private]
 

The worklist of basic blocks.

Definition at line 110 of file proceduredb.h.

Referenced by add_all_blocks(), add_block(), get_next_block(), is_empty(), procedureInfo(), and remove_branch_blocks().


The documentation for this class was generated from the following files:

Generated on August 27, 2003
Back to the C-Breeze home page