Polaris: Program Class Reference

Program Class Reference

a class for Fortran programs. More...

#include <Program.h>

Inheritance diagram for Program:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Program ()
 Program (ProgramUnit *pgm)
 Program (const Program &p)
Programoperator= (const Program &pgm)
virtual Programclone () const
 Return (and give control of) a new Program which has been copied from this one.
virtual ~Program ()
void read (const char *fname)
 Scan and read the Fortran source code.
void absorb (ProgramUnit *pgm)
 Absorb the ProgramUnit unit into the program.
void absorb (Program *p)
 Absorb the Program unit into the program.
EntryPointsentry_points () const
 Return a collection of the ENTRY/ProgramUnit pairs in the Program.
void compute_call_lists ()
 Fill in the "calls" and "called_by" lists for each ProgramUnit.
virtual int structures_OK () const
 Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.
void clean ()
 Search through the Program and find all symbol uses.
void write (ostream &o) const
 Display the program unit in FORTRAN format.
void print (ostream &o) const
 Print the program unit in FORTRAN format.

Detailed Description

a class for Fortran programs.

Base General utility routines

See also:
Program.h

Program.cc

Program.h

Description

This class represents a Fortran program and contains all of compilation units (ProgramUnit's) comprising that program.

Definition at line 33 of file Program.h.


Constructor & Destructor Documentation

Program::Program  ) 
 

Definition at line 33 of file Program.cc.

References register_instance().

Referenced by clone().

Program::Program ProgramUnit pgm  ) 
 

Definition at line 40 of file Program.cc.

References absorb(), and register_instance().

Program::Program const Program p  ) 
 

Definition at line 49 of file Program.cc.

References BaseMapRoot::clear(), Database< S, T >::operator=(), and register_instance().

Program::~Program  )  [virtual]
 

Definition at line 75 of file Program.cc.

References unregister_instance().


Member Function Documentation

Program & Program::operator= const Program pgm  ) 
 

Definition at line 60 of file Program.cc.

References BaseMapRoot::clear(), and Database< S, T >::operator=().

Program * Program::clone  )  const [virtual]
 

Return (and give control of) a new Program which has been copied from this one.

Definition at line 70 of file Program.cc.

References Program().

Referenced by check_parallel_and_instrument().

void Program::read const char *  fname  ) 
 

Scan and read the Fortran source code.

... ... previous 2 statement is replaced by following due to complainment from ... gcc 2.96 as:

... new char[100];

... new char[100];

... Allocate vname and wname using malloc(), these are temporary files ... File vname is for the VDL coming from the scanner. ... File wname is for any warnings coming from the scanner

... p_assert( vname, "can not allocate temporary file name" ); ... -->

cmd += " -d"; cmd += dec( x );

cmd += " -c"; cmd += dec( x );

... If the warnings file is empty, just delete it

... Copy the warnings to cerr and delete the file

... Should be using the wait() call here to return the status of the ... system call.

... silvius: do not unlink if it was given as input.

... Deallocate vname using free().

Definition at line 201 of file Program.cc.

References StmtList::_set_block_structure(), absorb(), change_default_type_size(), COMPLEX_TYPE, StmtList::create_assertions(), DOUBLE_PRECISION_TYPE, List< T >::entries(), List< T >::first_ref(), INTEGER_TYPE, BinRep::is_set(), is_vdl(), List< T >::last_ref(), LOGICAL_TYPE, mark_loops_with_location(), pfree(), BinRep::read(), REAL_TYPE, remove_all_statement_functions(), set_subst_field_print(), ProgramUnit::stmts(), and switch_value().

Referenced by main(), process(), and read_pu().

void Program::absorb ProgramUnit pgm  ) 
 

Absorb the ProgramUnit unit into the program.

Definition at line 83 of file Program.cc.

References Database< String, ProgramUnit >::ins().

Referenced by absorb(), main(), Program(), read(), and read_pu().

void Program::absorb Program p  ) 
 

Absorb the Program unit into the program.

Definition at line 91 of file Program.cc.

References absorb().

EntryPoints * Program::entry_points  )  const
 

Return a collection of the ENTRY/ProgramUnit pairs in the Program.

Definition at line 102 of file Program.cc.

References Iterator< T >::current(), ENTRY_STMT, RefDatabase< S, T >::ins(), Symbol::name_ref(), Statement::routine_guarded(), Statement::routine_valid(), Expression::symbol(), and Iterator< T >::valid().

void Program::compute_call_lists  ) 
 

Fill in the "calls" and "called_by" lists for each ProgramUnit.

... silvius: clear up old calls and called_by lists.

... silvius: find the ones that are actually called. ... The old method was giving wrong results after deadcode ... elimination (of routine calls).

... Find the called routines by finding all EXTERNAL symbols mentioned

Definition at line 372 of file Program.cc.

References ProgramUnit::add_call(), ProgramUnit::add_called_by(), ASSIGNMENT_STMT, CALL_STMT, ProgramUnit::called_by(), ProgramUnit::calls(), RefSet< T >::clear(), Iterator< T >::current(), Symbol::external(), ProtoRefDatabase< S, T >::find_ref(), Expression::function(), FUNCTION_CALL_OP, FUNCTION_CLASS, RefDatabase< S, T >::ins(), Symtab::iterator(), StmtList::iterator(), Symbol::name_ref(), Expression::op(), Statement::rhs(), Statement::routine_guarded(), ProgramUnit::routine_name_ref(), Statement::stmt_class(), ProgramUnit::stmts(), SUBROUTINE_CLASS, Symbol::sym_class(), Expression::symbol(), ProgramUnit::symtab(), Definition::tag_ref(), and Iterator< T >::valid().

int Program::structures_OK  )  const [virtual]
 

Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.

Reimplemented from BaseMapRoot.

Definition at line 129 of file Program.cc.

void Program::clean  ) 
 

Search through the Program and find all symbol uses.

Remove any symbols from each symbol table that are not found.

Definition at line 363 of file Program.cc.

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

Referenced by main().

void Program::write ostream &  o  )  const
 

Display the program unit in FORTRAN format.

Definition at line 144 of file Program.cc.

References KeyIterator< S, T >::current_data(), dump_switches(), polaris_major_version, polaris_minor_version, switch_value(), KeyIterator< S, T >::valid(), and ProgramUnit::write().

Referenced by main().

void Program::print ostream &  o  )  const [virtual]
 

Print the program unit in FORTRAN format.

Reimplemented from Database< String, ProgramUnit >.

Definition at line 167 of file Program.cc.

References KeyIterator< S, T >::current_data(), dump_switches(), polaris_major_version, polaris_minor_version, ProgramUnit::print(), switch_value(), and KeyIterator< S, T >::valid().

Referenced by main().


The documentation for this class was generated from the following files:
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:07:54 2005