Polaris: PropCtrlRangeWS.h Source File

PropCtrlRangeWS.h

Go to the documentation of this file.
00001 #ifndef _PROP_CTRL_RANGE_WS_H
00002 #define _PROP_CTRL_RANGE_WS_H
00003 ///
00004 /// file PropCtrlRangeWS.h
00005 ///
00006 /// \class PropCtrlRangeWS 
00007 /// \brief WorkSpace for propagate ranges
00008 /// \defgroup Polaris
00009 /// \ingroup Polaris
00010 ///  Range
00011 /// \see PropCtrlRangeWS.h
00012 /// \see PropCtrlRangeWS.h
00013 /// \see PropCtrlRangeWS.cc
00014 ///
00015 /// \endcode
00016 /// \section Overview Overview
00017 /// This class holds an assortment of temporary data associated with
00018 /// a particular statement for the AIRangesDict Constructor.
00019 ///
00020 #include "../Collection/List.h"
00021 #include "../Collection/RefSet.h"
00022 #include "../Collection/Set.h"
00023 #include "../WorkSpace.h"
00024 #include "../Symbol/Symbol.h"
00025 #include "../Statement/Statement.h"
00026 #include "../Expression/Expression.h"
00027 ///
00028 #include "PropRangeEdge.h"
00029 ///
00030 class PropCtrlRangeWS : public WorkSpace {
00031 public:
00032     RefSet<Symbol> mod_set;  ///< Set of variables that are modified.
00033     Map< Symbol, Set<Expression> >  *new_ranges;
00034                                  ///< New var ranges that hold at this stmt
00035     Map< Symbol, Set<Expression> >  *new_else_ranges;
00036                                  ///< New var ranges that hold for ELSE branch
00037     Map< Symbol, RefSet<Expression> > in_ranges;
00038                                  ///< Var ranges that hold on entry of stmt
00039     Map< Symbol, RefSet<Expression> > out_ranges;
00040                                  ///< Var ranges that hold on exit of stmt
00041     Map< Symbol, RefSet<Expression> > out_else_ranges;
00042                                  ///< Var ranges that hold on ELSE branch
00043         
00044 
00045     PropCtrlRangeWS(unsigned long pass_tag, const Statement &stmt);
00046     PropCtrlRangeWS(const PropCtrlRangeWS &other);
00047     virtual ~PropCtrlRangeWS();
00048 
00049     bool update_out_ranges();
00050     ///< Update the value of the output ranges sets from the value of
00051     ///< the input live variable set.  Return true if this update modified
00052     ///< any of the values the the output ranges.
00053 
00054     inline int num_visits() const;
00055     ///< Return the number of visits made to this WorkSpace's Statement
00056     ///< by the iterative portion of the range propagation pass.
00057 
00058     inline void incr_num_visits();
00059     ///< Increment the number of visits by one.
00060 
00061     inline bool visited() const;
00062     inline void visited(bool v);
00063     ///< Reference the visited field.  Has no relation to num_visits.
00064 
00065     inline int toporder() const;
00066     inline void toporder(int val);
00067     ///< Reference the toporder field.
00068 
00069     inline virtual Listable *listable_clone() const;
00070     virtual void print(ostream &o) const;
00071     virtual int structures_OK() const;
00072     ///< Functions required by Listable.
00073 
00074 private:
00075     int _num_visits;         ///< Number of visits made to this node.
00076     bool _visited;       ///< True if visited by _calc_rpostorder
00077     int _toporder;       ///< Reverse topological sort ordering
00078 
00079     void _add_to_mod_set(const RefSet<Expression> &refs);
00080     void _add_asserts_to_ranges(const Statement &stmt);
00081 };
00082 
00083 
00084 ///< inline functions
00085 
00086 inline int
00087 PropCtrlRangeWS::num_visits() const
00088 {
00089     return _num_visits;
00090 }
00091 
00092 inline void
00093 PropCtrlRangeWS::incr_num_visits()
00094 {
00095     ++_num_visits;
00096 }
00097 
00098 inline bool
00099 PropCtrlRangeWS::visited() const
00100 {
00101     return _visited;
00102 }
00103 
00104 inline void
00105 PropCtrlRangeWS::visited(bool v)
00106 {
00107     _visited = v;
00108 }
00109 
00110 inline int
00111 PropCtrlRangeWS::toporder() const
00112 {
00113     return _toporder;
00114 }
00115 
00116 inline void
00117 PropCtrlRangeWS::toporder(int val)
00118 {
00119     _toporder = val;
00120 }
00121 
00122 inline Listable *
00123 PropCtrlRangeWS::listable_clone() const
00124 {
00125     return new PropCtrlRangeWS(*this);
00126 }
00127 
00128 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:06:03 2005