| Polaris: PropRangeEdge.h Source File | ||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
PropRangeEdge.hGo to the documentation of this file.00001 #ifndef _PROP_RANGE_EDGE_H 00002 #define _PROP_RANGE_EDGE_H 00003 /// 00004 /// File PropRangeEdge.h 00005 /// 00006 /// \class PropRangeEdge 00007 /// \brief Flow graph edge used by propagate_ranges. 00008 /// \defgroup Polaris 00009 /// \ingroup Polaris 00010 /// Range 00011 /// \see PropRangeWS.h 00012 /// \see PropRangeWS.h 00013 /// 00014 /// \endcode 00015 /// \section Overview Overview 00016 /// This class represents an edge in the ProgramUnit's flow graph with 00017 /// a StmtRanges object attached to it. 00018 /// 00019 #include "../Statement/Statement.h" 00020 #include "../Listable.h" 00021 /// 00022 #include "StmtRanges.h" 00023 /// 00024 class PropRangeEdge : public Listable { 00025 public: 00026 inline PropRangeEdge(Statement &p, Statement &s); 00027 inline PropRangeEdge(const PropRangeEdge &other); 00028 inline virtual ~PropRangeEdge(); 00029 00030 inline Statement &pred() const; 00031 inline Statement &succ() const; 00032 inline StmtRanges *ranges_ref() const; 00033 inline void ranges(StmtRanges *c); 00034 inline StmtRanges *grab_ranges(); 00035 00036 inline virtual Listable *listable_clone(void) const; 00037 inline virtual void print(ostream &o) const; 00038 inline virtual int structures_OK() const; 00039 ///< Functions required by Listable. 00040 00041 private: 00042 Statement *_pred; ///< Source statement of edge 00043 Statement *_succ; ///< Destination statement of edge 00044 StmtRanges *_ranges; ///< Ranges valid for this edge 00045 }; 00046 00047 00048 ///< inline functions 00049 00050 inline 00051 PropRangeEdge::PropRangeEdge(Statement &p, Statement &s) 00052 { 00053 _pred = &p; 00054 _succ = &s; 00055 _ranges = 0; 00056 } 00057 00058 inline 00059 PropRangeEdge::PropRangeEdge(const PropRangeEdge &other) 00060 { 00061 _pred = other._pred; 00062 _succ = other._succ; 00063 00064 if (other._ranges) 00065 _ranges = new StmtRanges(*other._ranges); 00066 else 00067 _ranges = 0; 00068 } 00069 00070 inline 00071 PropRangeEdge::~PropRangeEdge() 00072 { 00073 if (_ranges) 00074 delete _ranges; 00075 } 00076 00077 inline Statement & 00078 PropRangeEdge::pred() const 00079 { 00080 return * (Statement *) _pred; 00081 } 00082 00083 inline Statement & 00084 PropRangeEdge::succ() const 00085 { 00086 return * (Statement *) _succ; 00087 } 00088 00089 inline StmtRanges * 00090 PropRangeEdge::ranges_ref() const 00091 { 00092 return (StmtRanges *) _ranges; 00093 } 00094 00095 inline void 00096 PropRangeEdge::ranges(StmtRanges *c) 00097 { 00098 if (_ranges != c) { 00099 if (_ranges) 00100 delete _ranges; 00101 00102 _ranges = c; 00103 } 00104 } 00105 00106 inline StmtRanges * 00107 PropRangeEdge::grab_ranges() 00108 { 00109 StmtRanges *temp = _ranges; 00110 _ranges = 0; 00111 return temp; 00112 } 00113 00114 inline Listable * 00115 PropRangeEdge::listable_clone(void) const 00116 { 00117 return new PropRangeEdge(*this); 00118 } 00119 00120 inline void 00121 PropRangeEdge::print(ostream &o) const 00122 { 00123 o << _pred->tag() << "-->" << _succ->tag(); 00124 } 00125 00126 inline int 00127 PropRangeEdge::structures_OK() const 00128 { 00129 return 1; 00130 } 00131 00132 #endif 00133 |
||
|