Polaris: range_dict_util.cc File Reference

range_dict_util.cc File Reference

Go to the source code of this file.

Functions

void sort_sym_list (RefList< Symbol > &sym_list)
 Description: Rename any variables named MIN or MAX in the given program so that they will not conflict with the symbols for the intrinsics MIN and MAX.
static void _fix_intr_var_conflicts (Symtab &symtab, Symbol &var)
 remove_min_max_var_conflicts Rename any variables named MIN or MAX in the given program so that they will not conflict with the symbols for the intrinsics MIN and MAX.
void remove_min_max_var_conflicts (Symtab &symtab)
 Description: If the given statement has a MAYMODS assertion, return the set of possibly modified variables.
RefSet< Symbol > * stmt_maymods (const Statement &stmt)
 Silvius: force insertion of ranges according to the Fortran 77 standard for the following case: DIMENSION A(m,n:p,*) DO i=1,k DO j=h,100 A(i,j,...)=..
static void get_array_refs (Expression &expr, RefList< Expression > &array_refs)
static Statementskip_blocks (Statement *ref)
 Return the last statement that is within the same block as 'ref'.
void enforce_standard_within_bounds (ProgramUnit &pgm, RefList< Statement > &new_ifs)
 Silvius: force insertion of ranges according to the Fortran 77 standard for the following case: DIMENSION A(m,n:p,*) DO i=1,k DO j=h,100 A(i,j,...)=...
void clean_after_standard_enforcement (ProgramUnit &pgm, RefList< Statement > &new_ifs)
 Clean up after enforce_standard_within_bounds.


Detailed Description

Definition in file range_dict_util.cc.


Function Documentation

void sort_sym_list RefList< Symbol > &  sym_list  ) 
 

Description: Rename any variables named MIN or MAX in the given program so that they will not conflict with the symbols for the intrinsics MIN and MAX.

Definition at line 21 of file range_dict_util.cc.

References Iterator< T >::current(), RefList< T >::entries(), RefList< T >::grab(), Symbol::name_ref(), and Iterator< T >::valid().

Referenced by IPCPProcData::add_maymods(), SSAFullRangeDict::pretty_print(), SSAControlRangeDict::pretty_print(), GSAFullRangeDict::pretty_print(), GSAControlRangeDict::pretty_print(), ControlRangeDict::pretty_print(), BaseStmtRanges::pretty_print(), and StmtRanges::simplify_min_max().

static void _fix_intr_var_conflicts Symtab symtab,
Symbol var
[static]
 

remove_min_max_var_conflicts Rename any variables named MIN or MAX in the given program so that they will not conflict with the symbols for the intrinsics MIN and MAX.

Definition at line 51 of file range_dict_util.cc.

References FUNCTION_CLASS, INTEGER_TYPE, IS_INTRINSIC, make_type(), NOT_EXTERNAL, and NOT_FORMAL.

Referenced by remove_min_max_var_conflicts().

void remove_min_max_var_conflicts Symtab symtab  ) 
 

Description: If the given statement has a MAYMODS assertion, return the set of possibly modified variables.

Otherwise, return NULL.

Definition at line 66 of file range_dict_util.cc.

References _fix_intr_var_conflicts().

RefSet<Symbol>* stmt_maymods const Statement stmt  ) 
 

Silvius: force insertion of ranges according to the Fortran 77 standard for the following case: DIMENSION A(m,n:p,*) DO i=1,k DO j=h,100 A(i,j,...)=..

Otherwise, return NULL.

Definition at line 85 of file range_dict_util.cc.

References Assertion::arg_list_guarded(), Assertion::arg_list_valid(), AS_MAYMOD, Expression::base_variable_ref(), Iterator< T >::current(), RefSet< T >::ins(), Assertion::type(), and Iterator< T >::valid().

Referenced by _make_nonlocals_modified_at_calls().

static void get_array_refs Expression expr,
RefList< Expression > &  array_refs
[static]
 

Definition at line 114 of file range_dict_util.cc.

References ARRAY_REF_OP, Iterator< T >::current(), and Iterator< T >::valid().

Referenced by enforce_standard_within_bounds().

static Statement* skip_blocks Statement ref  )  [static]
 

Return the last statement that is within the same block as 'ref'.

... Got to the end of the block.

... Skip this block.

... Skip this block.

Definition at line 124 of file range_dict_util.cc.

References DO_STMT, ENDDO_STMT, ENDIF_STMT, FLOW_EXIT_STMT, Statement::follow_ref(), IF_STMT, Statement::matching_endif_ref(), Statement::next_ref(), Statement::stmt_class(), and WHILE_STMT.

void enforce_standard_within_bounds ProgramUnit pgm,
RefList< Statement > &  new_ifs
 

Silvius: force insertion of ranges according to the Fortran 77 standard for the following case: DIMENSION A(m,n:p,*) DO i=1,k DO j=h,100 A(i,j,...)=...

In this case, since the access on A must be within bounds we will add to the dictionary the following ranges: k=[1,m] and h=[n:p]. Silvius: since I do not want to get to the guts of the AIRangeDict, we will force the insertionof the ranges by inserting some guards in the code, such as: IF (1.LE.k.AND.k.LE.m) THEN DO i=1,k Silvius: for now we do not catch all possible ranges, just look at some particular cases.

silvius: not sure this is right

First find DO loops and select "inits" and "limits"

... Go through all the statements in the loop.

cerr<<"\nAt loop "<<loopit.current();

... Check whether the init or limit are ID_OP.

cerr<<"\nNo suitable init/limit found.";

cerr<<"\nAt statement: "<<*stit;

... Go through all the array references in the statement.

cerr<<"\n\tFor array ref "<<ar;

... If it gets here, it is the loop index.

... Report it for now.

... Insert if not already found.

cerr<<"\n\t\tInsert relation: " <<*lower<<"<="<<bit.current()<<"<="<<*upper;

... At this point we have all the solutions for this loop. ... Let us insert the solutions as pgm guards.

Definition at line 167 of file range_dict_util.cc.

References and(), Expression::arg_list(), Expression::array(), Expression::clone(), constant(), Iterator< T >::current(), Symbol::dim(), DO_STMT, RefList< T >::entries(), List< T >::entries(), Statement::follow_ref(), get_array_refs(), ID_OP, Statement::index(), Statement::init(), RefList< T >::ins_last(), VariableSymbol::is_gsa_symbol(), Statement::iterate_expressions(), le(), Statement::limit(), ArrayBounds::lower_exists(), ArrayBounds::lower_guarded(), Statement::next_ref(), Listable::next_ref(), Expression::op(), Listable::prev_ref(), simplify(), Expression::subscript(), Expression::symbol(), ArrayBounds::upper_exists(), ArrayBounds::upper_guarded(), and Iterator< T >::valid().

void clean_after_standard_enforcement ProgramUnit pgm,
RefList< Statement > &  new_ifs
 

Clean up after enforce_standard_within_bounds.

Definition at line 273 of file range_dict_util.cc.

References Iterator< T >::current(), Statement::matching_endif_ref(), Statement::next_ref(), Statement::prev_ref(), and Iterator< T >::valid().

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