Polaris: ip_ssa.h Source File

ip_ssa.h

Go to the documentation of this file.
00001 ///
00002 #ifndef _ip_ssa_h
00003 #define _ip_ssa_h
00004 ///
00005 #include "Program.h"
00006 ///
00007 #include "code_domains.h"
00008 ///
00009 ///
00010 class GlobalDefSite : public Listable{
00011  private:
00012   ProgramUnit* _pgm;
00013   Statement* _stmt;
00014  public:
00015   GlobalDefSite(){
00016     _pgm=0;
00017     _stmt=0;
00018   }
00019   GlobalDefSite(ProgramUnit& pgm, Statement& stmt){
00020     _pgm=&pgm;
00021     _stmt=&stmt;
00022   }
00023   GlobalDefSite(const GlobalDefSite& other){
00024     _pgm=other._pgm;
00025     _stmt=other._stmt;
00026   }
00027   GlobalDefSite& operator=(const GlobalDefSite& other){
00028     _pgm=other._pgm;
00029     _stmt=other._stmt;
00030     return *this;
00031   }
00032   bool operator==(const GlobalDefSite& other){
00033     return (_pgm==other._pgm &&
00034         _stmt==other._stmt);
00035   }
00036   ~GlobalDefSite(){}
00037   ProgramUnit& pgm(){
00038     return *_pgm;
00039   }
00040   Statement& stmt(){
00041     return *_stmt;
00042   }
00043   void print(ostream& o) const{
00044     int dummy=1;
00045     o<<"GlobalDefSite: "<<_pgm->routine_name_ref()<<" : ";
00046     _stmt->write(o,dummy);
00047   }
00048   Listable* listable_clone() const{
00049     return new GlobalDefSite(*_pgm, *_stmt);
00050   }
00051 };
00052 
00053 ///< Builds sets of inputs for every output to every routine.
00054 ///< An output is a common variable or formal.
00055 void build_in_out_sets(Program& prog, ProgramUnit& pgm);
00056 
00057 
00058 ///< Builds sets of inputs for given output to given domain.
00059 ///< Even though the domain is intraprocedural, this routine takes into
00060 ///< account interprocedural information passed via common variables and 
00061 ///< actual/formal parameters.
00062 void build_in_out_set(Symbol& out, IntraPCodeDomain& domain,
00063               RefList<Symbol>& in,
00064               ProgramUnit& pgm, Program& prog);
00065 
00066 
00067 ///< Return last gsa name associated with the given base symbol.
00068 Symbol* last_gsa_symbol(ProgramUnit& pgm, Symbol& sym);
00069 
00070 
00071 ///< Put the whole program in GSA format.
00072 void make_ip_ssa(Program& prog);
00073 
00074 ///< Bring the program back from GSA format.
00075 void undo_ip_ssa(Program& prog);
00076 
00077 /*!
00078   \brief Global mapping per pgm, per base symbol, of subprogram calls into SSA
00079   names.
00080 */
00081 Database<ProgramUnit*, ///< Every program unit.
00082      Database<Statement*, ///< Every call site.
00083           RefDatabase<Symbol*, ///< Every base symbol.
00084                   Symbol> > >& ip_ssa_gmap(); ///< SSA name.
00085 
00086 /*!
00087   \brief The reaching definitions list per pgm, per base symbol (for 
00088   commons only).
00089 */
00090 Database<ProgramUnit*, ///< Every program unit.
00091      Database<Symbol*, ///< Every base common variable.
00092           List<GlobalDefSite> > >& ip_ssa_dmap(); ///< Reaching defs.
00093 
00094 
00095 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:56 2005