Polaris: SSAControlRangeData.h Source File

SSAControlRangeData.h

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