Polaris: ControlRangeDict.cc File Reference

ControlRangeDict.cc File Reference

Go to the source code of this file.

Functions

static void _init_workspaces (ProgramUnit &pgm)
 init_workspaces Initialize the workspaces for each statement in the program.
static PropCtrlRangeWS_get_workspace (const Statement &stmt)
 get_workspace Get the workspace for the given statement.
static void _dump_workspaces (ostream &o, const ProgramUnit &pgm)
 dump_workspaces Dump out the data inside all of the workspaces of the program
static void _make_nonlocals_modified_at_calls (ProgramUnit &pgm)
 _make_nonlocals_modified_at_calls Make all non-local variables be marked as potentially modified for all call statements and all statements containing function calls.
static void _calc_toporder1 (Statement &stmt, int &toporder)
 _calc_toporder Calculate toporder for the flow graph.
static void _calc_toporder (ProgramUnit &pgm, Array< Statement * > &toporder_to_stmt)
static bool _is_else_branch (const Statement &pred, const Statement &succ)
 is_else_branch Return true if the control flow edge between statements pred and succ corresponds to the else branch of an IF statement.
void _intersect_range_maps (Map< Symbol, RefSet< Expression > > &range_map, const Map< Symbol, RefSet< Expression > > &inter_map)
 intersect_range_maps Intersect the ranges of the two variable to range set maps.
static bool _range_maps_equal (const Map< Symbol, RefSet< Expression > > &range_map1, const Map< Symbol, RefSet< Expression > > &range_map2)
 range_maps_equal Return true if the two range maps are equal
static void _put_succ_on_work_list (IntSet &work_list, Statement &stmt)
 put_succ_on_work_list Put all of my successors on the work list.
static void _iterate_to_fixed_point (ProgramUnit &pgm, const Array< Statement * > &toporder_to_stmt)
 iterate_to_fixed_point Propagate the constants contained in the statement's const_maps until a fixed point is reached.

Variables

static unsigned int _pass_tag
static int _debug_level = 0
 ... Pass tag associated with this pass


Detailed Description

Definition in file ControlRangeDict.cc.


Function Documentation

static void _init_workspaces ProgramUnit pgm  )  [static]
 

init_workspaces Initialize the workspaces for each statement in the program.

Note: A lot of the initialization for eliminate_dead_code are hidden in the constructor for PropCtrlRangeWS.

Definition at line 39 of file ControlRangeDict.cc.

References _pass_tag, Iterator< T >::current(), WorkSpaceStack::push(), Iterator< T >::valid(), and Statement::work_stack().

static PropCtrlRangeWS& _get_workspace const Statement stmt  )  [static]
 

get_workspace Get the workspace for the given statement.

Definition at line 55 of file ControlRangeDict.cc.

References _pass_tag.

static void _dump_workspaces ostream &  o,
const ProgramUnit pgm
[static]
 

dump_workspaces Dump out the data inside all of the workspaces of the program

Definition at line 69 of file ControlRangeDict.cc.

References _get_workspace(), Iterator< T >::current(), PropConstWS::print(), Statement::print_debug(), Statement::structures_OK(), Statement::tag(), and Iterator< T >::valid().

static void _make_nonlocals_modified_at_calls ProgramUnit pgm  )  [static]
 

_make_nonlocals_modified_at_calls Make all non-local variables be marked as potentially modified for all call statements and all statements containing function calls.

... Calculate the set of non-local variables.

... Also place any aliased variables in the set.

... Add the non-local variables to the mod_set of all statements that ... are either call statements or contain function calls.

Definition at line 89 of file ControlRangeDict.cc.

References _get_workspace(), Statement::act_refs(), ASSIGNMENT_STMT, Expression::base_variable_ref(), CALL_STMT, Symbol::common_ref(), contains_func_call(), Iterator< T >::current(), DictionaryIter< T >::current(), Type::data_type(), RefSet< T >::del(), equiv_aliases(), Symbol::formal(), RefSet< T >::ins(), INTEGER_TYPE, IS_FORMAL, Statement::lhs(), PropConstWS::mod_set, Statement::stmt_class(), stmt_maymods(), Symbol::sym_class(), symbol(), Symbol::type(), Iterator< T >::valid(), KeyIterator< String, T >::valid(), and VARIABLE_CLASS.

static void _calc_toporder1 Statement stmt,
int &  toporder
[static]
 

_calc_toporder Calculate toporder for the flow graph.

Essentially, this algorithm performs a topological sort on the flow graph, ignoring back edges.

Definition at line 177 of file ControlRangeDict.cc.

References _calc_toporder1(), _get_workspace(), Iterator< T >::current(), PropCtrlRangeWS::toporder(), Iterator< T >::valid(), and PropCtrlRangeWS::visited().

static void _calc_toporder ProgramUnit pgm,
Array< Statement * > &  toporder_to_stmt
[static]
 

... Calculate the topological order for each statement

... Initialize toporder_to_stmt

Definition at line 194 of file ControlRangeDict.cc.

References _calc_toporder1(), _get_workspace(), Iterator< T >::current(), stmt_toporder(), PropConstWS::toporder(), and Iterator< T >::valid().

static bool _is_else_branch const Statement pred,
const Statement succ
[static]
 

is_else_branch Return true if the control flow edge between statements pred and succ corresponds to the else branch of an IF statement.

Note: the exit branch of a DO statement is assumed to be an else branch.

Definition at line 235 of file ControlRangeDict.cc.

References DO_STMT, ELSEIF_STMT, and IF_STMT.

Referenced by _iterate_to_fixed_point().

void _intersect_range_maps Map< Symbol, RefSet< Expression > > &  range_map,
const Map< Symbol, RefSet< Expression > > &  inter_map
 

intersect_range_maps Intersect the ranges of the two variable to range set maps.

Definition at line 248 of file ControlRangeDict.cc.

References Iterator< T >::current(), KeyIterator< S, T >::current_data(), KeyIterator< S, T >::current_key(), RefSet< T >::del(), Mutator< T >::del(), RefSet< T >::ins(), RefSet< T >::member(), Iterator< T >::valid(), and KeyIterator< S, T >::valid().

Referenced by _iterate_to_fixed_point().

static bool _range_maps_equal const Map< Symbol, RefSet< Expression > > &  range_map1,
const Map< Symbol, RefSet< Expression > > &  range_map2
[static]
 

range_maps_equal Return true if the two range maps are equal

Definition at line 283 of file ControlRangeDict.cc.

References KeyIterator< S, T >::current_data(), KeyIterator< S, T >::current_key(), and KeyIterator< S, T >::valid().

Referenced by _iterate_to_fixed_point().

static void _put_succ_on_work_list IntSet work_list,
Statement stmt
[static]
 

put_succ_on_work_list Put all of my successors on the work list.

Definition at line 309 of file ControlRangeDict.cc.

References _get_workspace(), Iterator< T >::current(), RefSet< T >::ins(), PropConstWS::toporder(), and Iterator< T >::valid().

static void _iterate_to_fixed_point ProgramUnit pgm,
const Array< Statement * > &  toporder_to_stmt
[static]
 

iterate_to_fixed_point Propagate the constants contained in the statement's const_maps until a fixed point is reached.

... List of statements that need to be updated.

... Mark all variables for entry statements as non-const and put all ... entries on the work list.

... Iterate until there are no more elements on the work list

... Visit each statement in the work list, in topological order

... Generate the new live variable set for the end of the statement.

... New entering live variable set differs from the old ... one. So update the entering and exiting live variable ... sets for the statement.

... Exiting live var set has changed, so place ... the statement's predecessors on the work list so ... that they can update their live variable sets ... with my live var set.

Definition at line 323 of file ControlRangeDict.cc.

References _debug_level, _get_workspace(), _intersect_range_maps(), _is_else_branch(), _put_succ_on_work_list(), _range_maps_equal(), Iterator< T >::current(), PropCtrlRangeWS::in_ranges, PropCtrlRangeWS::incr_num_visits(), PropCtrlRangeWS::num_visits(), PropCtrlRangeWS::out_else_ranges, PropCtrlRangeWS::out_ranges, Statement::pred(), PropCtrlRangeWS::print(), Statement::print_debug(), PropConstWS::toporder(), PropCtrlRangeWS::update_out_ranges(), and Iterator< T >::valid().


Variable Documentation

unsigned int _pass_tag [static]
 

Definition at line 28 of file ControlRangeDict.cc.

Referenced by _get_workspace(), and _init_workspaces().

int _debug_level = 0 [static]
 

... Pass tag associated with this pass

Definition at line 30 of file ControlRangeDict.cc.

Referenced by _iterate_to_fixed_point().

 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:06:19 2005