| Polaris: ControlRangeDict.h Source File | ||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
ControlRangeDict.hGo to the documentation of this file.00001 #ifndef _CONTROL_RANGE_DICT_H 00002 #define _CONTROL_RANGE_DICT_H 00003 /// 00004 /// file ControlRangeDict.h 00005 /// 00006 /// \class ControlRangeDict 00007 /// \brief Collection of ranges extracted from program's control flow 00008 /// \defgroup Polaris 00009 /// \ingroup Polaris 00010 /// Range 00011 /// \see ControlRangeDict.h 00012 /// \see ControlRangeDict.h 00013 /// \see ControlRangeDict.cc 00014 /// 00015 /// \endcode 00016 /// \section Overview Overview 00017 /// A ControlRangeDict object is a repository for variable 00018 /// ranges for a program unit. Only those ranges that originate from 00019 /// FORTRAN control flow statements are collected. 00020 /// 00021 /// \endcode 00022 /// \section Description Description 00023 /// A ControlRangeDict object is a repository of the variable ranges 00024 /// for all points of a program unit. These ranges are extracted 00025 /// from the control flow statements of the program; that is, they 00026 /// are taken from IF conditional tests, DO statements, and 00027 /// CSRD$ ASSERT statements. 00028 /// 00029 /// The ControlRangeDict class was designed to generate variable 00030 /// ranges quickly, at the cost of accuracy. If one wishes a 00031 /// more accurate set of variable ranges, AIRangeDict should be used. 00032 /// 00033 #include "../Collection/Database.h" 00034 #include "../Collection/RefMap.h" 00035 #include "../Collection/Set.h" 00036 #include "../Symbol/Symbol.h" 00037 #include "../Expression/Expression.h" 00038 #include "../String.h" 00039 /// 00040 #include "RangeDict.h" 00041 #include "ExprSet.h" 00042 /// 00043 class ControlRangeDict : public RangeDict { 00044 public: 00045 ControlRangeDict(ProgramUnit &pgm, int debug = 0); 00046 virtual ~ControlRangeDict(); 00047 00048 virtual void print(ostream & o) const; 00049 ///< Print out the range dictionary. This operation is 00050 ///< essentially just a dump of the data structures of the 00051 ///< range dictionary. 00052 00053 virtual void pretty_print(ostream & o, const Statement &stmt) const; 00054 ///< Print out the range dictionary in a more user-readable 00055 ///< manner. 00056 00057 virtual Listable *listable_clone(void) const; 00058 virtual int structures_OK() const; 00059 ///< Methods required by Listable 00060 00061 protected: 00062 virtual void _set_range(const Symbol &var, const Statement &stmt, 00063 Expression *range); 00064 ///< Not implemented. Will p_assert if called. 00065 00066 virtual void _del_range(const Symbol &var, const Statement &stmt); 00067 ///< Not implemented. Will p_assert if called. 00068 00069 virtual const Expression *_get_range_ref(const Symbol &var, 00070 const Statement &stmt); 00071 ///< Return the range associated with the given variable. If the 00072 ///< variable doesn't have an associated range, return 0; 00073 00074 private: 00075 ExprSet _range_values; 00076 Database<String, RefMap<Symbol, Expression> > _pgm_ranges; 00077 00078 void _add_safe_cond_ranges(const ProgramUnit &pgm); 00079 00080 void _generate_map(const ProgramUnit &pgm); 00081 00082 }; 00083 00084 #endif 00085 |
||
|