SSAProgramUnit Class Referencea class for SSA form Fortran program units
More...
#include <SSAProgramUnit.h>
Inheritance diagram for SSAProgramUnit:
[legend]List of all members.
|
Public Member Functions |
| | SSAProgramUnit (const ProgramUnit &p) |
| | SSAProgramUnit (const SSAProgramUnit &p) |
| virtual | ~SSAProgramUnit () |
| SSAProgramUnit & | operator= (const SSAProgramUnit &p) |
| void | rename_variables () |
| | Rename all scalar variables that are not in PHI() functions.
|
| ProgramUnit & | convert_to_standard () |
| | Change the SSAProgramUnit back into a ProgramUnit.
|
| virtual void | write (ostream &o) const |
| | Display the program unit in FORTRAN format.
|
| virtual Listable * | listable_clone () const |
| | Needed for Listable.
|
| virtual void | print (ostream &o) const |
| | Needed for Listable.
|
Public Attributes |
| RefMap< Symbol, Statement > | _def_map |
| | < These symbols were made public for Thomas Lawrence to experiment with.
|
| RefMap< Symbol, Symbol > | _var_map |
Protected Member Functions |
| ImmediateDominator & | idom () const |
| DominanceFrontier & | domf () const |
| void | get_variable_clone (Expression &ex, List< Expression > *ex_list) |
| void | array_in_subscript (RefSet< Symbol > &all, List< Expression > &args) |
| Statement * | make_phi_function (Symbol &v, int fan_in, unsigned int pass) |
| PhiPlaceDict * | init_variable_set () |
| void | place_phi_functions (PhiPlaceDict &V_set, unsigned int pass) |
| void | insert_phi_stmt (RefList< Statement > &vertex, unsigned int pass) |
| void | SEARCH (Statement &X, PhiPlaceDict &V, unsigned int pass) |
| void | init_SSA_stack (PhiPlaceDict *dict) |
| void | convert_to_SSA () |
| void | convert_to_GSA () |
Friends |
| ostream & | operator<< (ostream &o, const SSAProgramUnit &p) |
Detailed Description
a class for SSA form Fortran program units
Base General utility routines - See also:
- ProgramUnit.h
SSAProgramUnit.cc
SSAProgramUnit.h
This class represents the additions to a ProgramUnit so that it is in standard SSA form. The program can optionally be one of three states. 1) PG_STANDARD_FORM 2) PG_SSA_FORM 3) PG_GSA_FORM
Definition at line 41 of file SSAProgramUnit.h.
Constructor & Destructor Documentation
| SSAProgramUnit::SSAProgramUnit |
( |
const ProgramUnit & |
p |
) |
|
|
Member Function Documentation
| ImmediateDominator& SSAProgramUnit::idom |
( |
|
) |
const [inline, protected] |
|
| DominanceFrontier& SSAProgramUnit::domf |
( |
|
) |
const [inline, protected] |
|
| Statement * SSAProgramUnit::make_phi_function |
( |
Symbol & |
v, |
|
|
int |
fan_in, |
|
|
unsigned int |
pass |
|
) |
[protected] |
|
| PhiPlaceDict * SSAProgramUnit::init_variable_set |
( |
|
) |
[protected] |
|
|
|
Definition at line 180 of file SSAProgramUnit.cc.
References ARRAY_REF_OP, PhiPlaceDef::assigned, ASSIGNMENT_STMT, base_name_ref(), Expression::base_variable_ref(), FUNCTION_CLASS, ID_OP, RefList< T >::ins_last(), PhiPlaceDef::involved, Statement::lhs(), Expression::op(), Statement::out_refs(), Statement::stmt_class(), SUBSTRING_OP, Symbol::sym_class(), SYMBOLIC_CONSTANT_CLASS, True, RefSet< T >::valid(), and VARIABLE_CLASS.
Referenced by convert_to_SSA(). |
| void SSAProgramUnit::place_phi_functions |
( |
PhiPlaceDict & |
dict, |
|
|
unsigned int |
pass |
|
) |
[protected] |
|
|
|
... fall through
Definition at line 702 of file SSAProgramUnit.cc.
References PhiPlaceDef::assigned, base_name_ref(), Symbol::clone(), DO_STMT, domf(), RefSet< T >::entries(), RefSet< T >::grab(), Statement::index(), RefSet< T >::ins(), Symtab::ins(), PhiPlaceDef::involved, make_phi_function(), Symbol::name_ref(), NOT_EXTERNAL, NOT_FORMAL, NOT_INTRINSIC, Statement::pred(), Statement::stmt_class(), ProgramUnit::symtab(), WorkSpaceStack::top_ref(), UNKNOWN_TYPE, RefList< T >::valid(), PhiPlaceDef::var, and Statement::work_stack().
Referenced by convert_to_SSA(). |
| void SSAProgramUnit::insert_phi_stmt |
( |
RefList< Statement > & |
vertex, |
|
|
unsigned int |
pass |
|
) |
[protected] |
|
|
|
... Fix the Idom and Dominance Frontier for the list of the Phi ... assignments
... Fix the idom for the children of w in the dominator tree
... Now, the ins_after will do the hard work to fix the control ... flow graph
... Some redundant PHI assignments could be created at the ... FLOW EXIT statement because all the RETURN statements ... artificially have the FLOW EXIT statement as their successor. ... The PHI assignments will never be executed since the subroutine ... already returned. They may still be useful for interprocedural ... analysis as a summary for the subroutine. That requires us to ... change all the RETURN statements to GOTO statements to the ... FLOW EXIT and the FLOW EXIT to its sole RETURN. ... For now, we just ignore the PHI assignments.
... MAYBE THIS IS WRONG: w_ws.PHI.clear();
Definition at line 641 of file SSAProgramUnit.cc.
References Iterator< T >::current(), domf(), FLOW_EXIT_STMT, Mutator< T >::grab(), StmtList::ins_after(), StmtList::ins_before(), listable_clone(), Iterator< T >::reset(), Iterator< T >::set_to_last(), Statement::stmt_class(), ProgramUnit::stmts(), WorkSpaceStack::top_ref(), Iterator< T >::valid(), and Statement::work_stack().
Referenced by convert_to_SSA(). |
| void SSAProgramUnit::SEARCH |
( |
Statement & |
X, |
|
|
PhiPlaceDict & |
V, |
|
|
unsigned int |
pass |
|
) |
[protected] |
|
|
|
... Get the variables for each of the parameter;
... Make BETA assignment to subroutine call parameters
... Make a PHI assignment for an array assignment
... Replace variable uses on the left hand side of the assignment
... Handle PHI function assignment statements
... WARNING:THIS CALL IS NOT SUPPORTED:SETS DO NOT ... HAVE AN ORDER!!!
Definition at line 261 of file SSAProgramUnit.cc.
References _def_map, RefSet< T >::_member(), _ssa_debug, _var_map, alpha(), Expression::arg_list(), ARRAY_REF_OP, ASSIGNMENT_STMT, base_name_ref(), Expression::base_variable_ref(), PhiPlaceDef::C, CALL_STMT, List< T >::clear(), RefList< T >::clear(), Symbol::clone(), Expression::clone(), comma(), Iterator< T >::current(), DO_STMT, Stack< T >::entries(), List< T >::entries(), Statement::follow_ref(), function_call(), get_variable_clone(), Mutator< T >::grab(), id(), Statement::in_refs(), Symtab::ins(), RefMap< S, T >::ins(), List< T >::ins_first(), List< T >::ins_last(), RefList< T >::ins_last(), PhiPlaceDef::involved, List< T >::last_ref(), Statement::lhs(), RefList< T >::member(), List< T >::modify(), Mutator< T >::modify(), Symbol::name(), Symbol::name_ref(), Expression::parameters_guarded(), RefStack< T >::pop(), Stack< T >::pop_grab(), Statement::pred(), Expression::print(), RefSet< T >::print(), RefStack< T >::push(), Stack< T >::push(), READ_STMT, Iterator< T >::reset(), Statement::rhs(), Statement::stmt_class(), substitute_var(), SUBSTRING_OP, Statement::succ(), PhiPlaceDef::syms, ProgramUnit::symtab(), WorkSpaceStack::top_ref(), RefStack< T >::top_ref(), Iterator< T >::valid(), PhiPlaceDef::var, Statement::work_stack(), and WRITE_STMT.
Referenced by convert_to_SSA(). |
| void SSAProgramUnit::init_SSA_stack |
( |
PhiPlaceDict * |
dict |
) |
[protected] |
|
|
|
Definition at line 603 of file SSAProgramUnit.cc.
References _var_map, Symbol::clone(), RefMap< S, T >::ins(), Symtab::ins(), PhiPlaceDef::involved, Symbol::name(), Symbol::name_ref(), RefStack< T >::push(), PhiPlaceDef::syms, ProgramUnit::symtab(), and PhiPlaceDef::var.
Referenced by convert_to_SSA(). |
| void SSAProgramUnit::convert_to_SSA |
( |
|
) |
[protected] |
|
|
|
Definition at line 771 of file SSAProgramUnit.cc.
References ProgramUnit::clean_workspace(), create_pass_tag(), RefList< T >::entries(), List< T >::first_ref(), idom(), init_SSA_stack(), init_variable_set(), RefList< T >::ins_last(), insert_phi_stmt(), StmtList::iterator(), PG_SSA_FORM, place_phi_functions(), WorkSpaceStack::push(), SEARCH(), ProgramUnit::stmts(), WorkSpaceStack::top_ref(), Iterator< T >::valid(), and Statement::work_stack().
Referenced by SSAProgramUnit(). |
| void SSAProgramUnit::convert_to_GSA |
( |
|
) |
[protected] |
|
| void SSAProgramUnit::rename_variables |
( |
|
) |
|
|
|
|
Rename all scalar variables that are not in PHI() functions.
The algorithm is that all scalar variables are assumed to be is they do not belong to a common block.
A scan of the program is then done to find all of the SSA PHI() functions. Any variable that is mentioned in a PHI() function, along with the variable defined by the function are considered to be in the same equiv class.
All variables in the same equiv class are then changed so they map back to a unique variable in the standard form of the program.
... Find all of the candidates for renaming.
... For each definition site of an SSA variable, merge the arguments ... and the value of the function.
... Now that we have all of the SSA variable equivalence classes defined ... we just need to map them to unique variables.
Definition at line 872 of file SSAProgramUnit.cc.
References _def_map, _var_map, Expression::arg_list(), ASSIGNMENT_STMT, Expression::base_variable_ref(), Symbol::clone(), Symbol::common_ref(), Iterator< T >::current(), KeyIterator< S, T >::current_data(), KeyIterator< S, T >::current_key(), Symbol::equivalence_ref(), ProtoRefMap< S, T >::find_ref(), Symbol::formal(), RefMap< S, T >::ins(), Symbol::is_array(), NOT_FORMAL, NOT_SAVED, Expression::op(), Expression::parameters_guarded(), Expression::parameters_valid(), Symtab::rename_and_ins(), Statement::rhs(), Symbol::saved(), SSA_find_ref(), SSA_union(), Statement::stmt_class(), Symbol::sym_class(), ProgramUnit::symtab(), Iterator< T >::valid(), KeyIterator< S, T >::valid(), and VARIABLE_CLASS. |
|
|
Change the SSAProgramUnit back into a ProgramUnit.
... delete pseudo assignment statements
this code here is for removing BETA and ALFA functions from the SSA form it was commented out, but appears to work, so I've put it back in Thomas R. Lawrence (26 July 1994)
end of change
... get_all_variable_clone(*x, L);
Definition at line 946 of file SSAProgramUnit.cc.
References _var_map, ALPHA_OP, Expression::arg_list(), Statement::assertions(), Expression::base_variable_ref(), BLOCK_DATA_PU_TYPE, Statement::build_refs(), CALL_STMT, ProgramUnit::clean(), Expression::clone(), Iterator< T >::current(), StmtList::del(), DO_STMT, ENDDO_STMT, ProtoRefMap< S, T >::find_ref(), id(), Statement::in_refs(), List< T >::ins_last(), RefList< T >::ins_last(), is_pseudo_assignment(), is_ssa_assignment(), Statement::iterate_expressions(), StmtList::iterator(), Mutator< T >::modify(), Statement::out_refs(), Statement::parameters_guarded(), Expression::parameters_guarded(), PG_STANDARD_FORM, ProgramUnit::pu_class(), Statement::rhs(), Statement::stmt_class(), ProgramUnit::stmts(), substitute_var(), List< T >::valid(), RefSet< T >::valid(), and Iterator< T >::valid(). |
| void SSAProgramUnit::write |
( |
ostream & |
o |
) |
const [virtual] |
|
| Listable * SSAProgramUnit::listable_clone |
( |
|
) |
const [virtual] |
|
| void SSAProgramUnit::print |
( |
ostream & |
o |
) |
const [virtual] |
|
Friends And Related Function Documentation
| ostream& operator<< |
( |
ostream & |
o, |
|
|
const SSAProgramUnit & |
p |
|
) |
[friend] |
|
Member Data Documentation
The documentation for this class was generated from the following files:
|