Polaris: GSAControlRangeData.h Source File

GSAControlRangeData.h

Go to the documentation of this file.
00001 #ifndef _GSA_CONTROL_RANGE_DATA_H
00002 #define _GSA_CONTROL_RANGE_DATA_H
00003 ///
00004 /// file GSAControlRangeData.h
00005 ///
00006 /// \class GSAControlRangeData 
00007 /// \brief WorkSpace for propagate ranges
00008 /// \defgroup Polaris
00009 /// \ingroup Polaris
00010 ///  Range
00011 /// \see GSAControlRangeData.h
00012 /// \see GSAControlRangeData.h
00013 /// \see GSAControlRangeData.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 GSAControlRangesDict Constructor.List
00019 ///
00020 #ifdef POLARIS_GNU_PRAGMAS
00021 #pragma interface
00022 #endif
00023 ///
00024 #include "../Collection/Set.h"
00025 #include "../Collection/Map.h"
00026 #include "../Collection/RefMap.h"
00027 #include "../Symbol/Symbol.h"
00028 #include "../Statement/Statement.h"
00029 #include "../Expression/Expression.h"
00030 ///
00031 #include "RangeDict.h"
00032 #include "ExprSet.h"
00033 ///
00034 class GSAControlRangeDict;
00035 
00036 class GSAControlRangeData : public Listable {
00037     friend class GSAControlRangeDict;
00038 public:
00039     GSAControlRangeData(const Statement &stmt, RangeDict &range_dict,
00040             ExprSet &range_values);
00041     GSAControlRangeData(const GSAControlRangeData &other);
00042     virtual ~GSAControlRangeData();
00043 
00044     inline const Statement &stmt() const;
00045     ///< Return the statement this object is associated with.
00046 
00047     inline GSAControlRangeData *icdom_ref() ;
00048     ///< Return my immediate control dominator.  My immediate control dominator
00049     ///< is the most immediate dominating statement that I am control dependent
00050     ///< upon.
00051 
00052     inline const Statement *icdom_succ_ref() ;
00053     ///< Return the statement successor of my immediate control
00054     ///< dominator that dominates me.  Used to determine which exiting
00055     ///< flow edge of my icdom I belong to.
00056 
00057     Expression *get_range_ref(const Symbol &var);
00058     ///< Return the control range associated with the given variable
00059     ///< and my statement.
00060 
00061     int num_computed_ranges() const;
00062     ///< Return the number of constrained ranges that I have computed.
00063 
00064     RefSet<Symbol> *range_vars();
00065     ///< Return the set of variables that would have ranges that are
00066     ///< not the unconstrained range.
00067 
00068     void clear();
00069     ///< Delete all information stored in myself.
00070     ///< Warning, other GSAControlRangeData objects may have pointers
00071     ///< into my out_ranges field, which is deleted.
00072 
00073     void clear_ranges();
00074     ///< Delete all range information stored in myself.
00075     ///< However, still keep my icdom information.
00076     ///< Warning, other GSAControlRangeData objects may have pointers
00077     ///< into my out_ranges field, which is deleted.
00078 
00079     virtual Listable *listable_clone() const;
00080     virtual void print(ostream &o) const;
00081     virtual int structures_OK() const;
00082     ///< Functions required by Listable.
00083 
00084 private:
00085     RangeDict *_range_dict_ref; ///< Ref to my control range dictionary.
00086     ExprSet *_range_values_ref; ///< Ref to set of all used expressions.
00087     const Expression *_om_ref;  ///< Ref to an omega expr in _range_values_ref.
00088     const Statement *_stmt_ref; ///< Statement which this workspace belongs to.
00089     GSAControlRangeData *_idom_ref; ///< my immediate dominator
00090     GSAControlRangeData *_icdom_ref; ///< My immediate control-dominator
00091     const Statement *_icdom_succ_ref; ///< The successor of my icdom
00092                                       ///< which dominates me.
00093     bool    _icdom_valid;       ///< Is icdom_ref and icdom_succ_ref valid.
00094     Map<Statement, Map<Symbol, Set<Expression> > > _local_ranges;
00095                 ///< Set of new ranges introduced by this stmt.
00096     Map<Statement, RefMap<Symbol, Expression> > _out_ranges;
00097                 ///< Var ranges for each exiting arc of stmt.
00098 
00099     void _compute_icdom_ref();
00100     Map<Symbol, Set<Expression> > &_get_local_ranges(const Statement &succ_stmt);
00101     Set<Expression> *_get_local_ranges(const Symbol &var,
00102                        const Statement &succ_stmt);
00103     Expression *_get_succ_range_ref(const Symbol &var,
00104                     const Statement &succ_stmt);
00105 };
00106 
00107 
00108 ///< inline functions
00109 
00110 inline const Statement &
00111 GSAControlRangeData::stmt() const
00112 {
00113     return *_stmt_ref;
00114 }
00115 
00116 inline GSAControlRangeData *
00117 GSAControlRangeData::icdom_ref() 
00118 {
00119     if (! _icdom_valid)
00120          _compute_icdom_ref();
00121 
00122     return _icdom_ref;
00123 }
00124 
00125 inline const Statement *
00126 GSAControlRangeData::icdom_succ_ref()
00127 {
00128     if (! _icdom_valid)
00129          _compute_icdom_ref();
00130 
00131     return _icdom_succ_ref;
00132 }
00133 
00134 #endif
00135 
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:53 2005