Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
cxx_graph.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 //-*-c++-*-
00102 #ifndef cxx_graph_INCLUDED
00103 #define cxx_graph_INCLUDED "cxx_graph.h"
00104 
00105 #ifdef _KEEP_RCS_ID
00106 #endif /* _KEEP_RCS_ID */
00107 
00108 #ifndef defs_INCLUDED
00109 #include "defs.h"
00110 #endif
00111 #ifndef cxx_graph_i_INCLUDED
00112 #include "cxx_graph.i"
00113 #endif
00114 #ifndef graph_template_INCLUDED
00115 #include "graph_template.h"
00116 #endif
00117 
00118 /* To up the graph capacity, here's what all one needs to do:
00119  * 1. change the typedefs below to (say) mUINT32.
00120  * 2. change the typedefs in graph_template.h
00121  * 3. increase INVALID_VINDEX16 and GRAPH16_CAPACITY in cxx_graph.cxx.
00122  * 4. change 
00123  *       ARRAY_DIRECTED_GRAPH16(mUINT16 num_v, mUINT16 num_e, WN_MAP map, 
00124  *    to
00125  *       ARRAY_DIRECTED_GRAPH16(mUINT32 num_v, mUINT32 num_e, WN_MAP map, 
00126  *    in dep_graph.h
00127  * 5. increase LNO_Graph_Capacity in lnodriver.c.
00128  */
00129 
00130 
00131 class VERTEX16 {
00132   friend        class DIRECTED_GRAPH16<class EDGE16, class VERTEX16>;
00133   friend  class DIRECTED_GRAPH16<class ARRAY_EDGE16,class ARRAY_VERTEX16>;  
00134   friend  class DIRECTED_GRAPH16<class LAT_EDGE16,class LAT_VERTEX16>;  
00135   friend  class DIRECTED_GRAPH16<class TEDGE,class TVERTEX>;  
00136   friend  class DIRECTED_GRAPH16<class FB_EDGE, class FB_NODE>;
00137 private:
00138   EINDEX16      _from;          // link to in edges
00139                                 // also used to link free vertices
00140   EINDEX16      _to;            // link to out edges
00141                                 // also used to mark free vertices if
00142                                 // _to == INVALID_VINDEX16
00143 
00144                 VERTEX16(const VERTEX16&);
00145 
00146 protected:
00147   void          Set_Next_Free_Vertex(VINDEX16 i){ _from = i; }
00148   void          Set_To_Free()                   { _to = INVALID_VINDEX16; }
00149   BOOL          Is_Free() const         { return _to == INVALID_VINDEX16; }
00150   VINDEX16      Get_Next_Free_Vertex() const    { return _from; }
00151   void          Set_Out_Edge(EINDEX16 i)        { _from = i; }
00152   void          Set_In_Edge(EINDEX16 i)         { _to = i; }
00153 
00154 public:
00155                 VERTEX16()                      { _from = 0; _to = 0; }
00156                 ~VERTEX16()                     {};
00157 
00158   VERTEX16&     operator = (const VERTEX16&);
00159 
00160   EINDEX16      Get_In_Edge() const             { return _to; }
00161                                 // Get the first in-edge of the vertex
00162   EINDEX16      Get_Out_Edge() const            { return _from; }
00163                                 // Get the first out-edge of the vertex
00164 };
00165 
00166 class EDGE16 {
00167   friend        class DIRECTED_GRAPH16<class EDGE16,class VERTEX16>;
00168   friend  class DIRECTED_GRAPH16<class ARRAY_EDGE16,class ARRAY_VERTEX16>;  
00169   friend  class DIRECTED_GRAPH16<class LAT_EDGE16,class LAT_VERTEX16>;  
00170   friend  class DIRECTED_GRAPH16<class TEDGE,class TVERTEX>;  
00171   friend  class DIRECTED_GRAPH16<class FB_EDGE, class FB_NODE>;
00172   friend        class SCC_DIRECTED_GRAPH16;
00173 private:
00174 
00175   VINDEX16      _from;          // the source of the edge
00176   VINDEX16      _to;            // the sink of the edge
00177   EINDEX16      _nfrom;         // next edge of same source
00178   EINDEX16      _nto;           // next edge of same sink
00179 
00180                 EDGE16(const EDGE16&);
00181 
00182 protected:
00183   void          Set_Source(VINDEX16 i)          { _from = i; }
00184   void          Set_Sink(VINDEX16 i)            { _to = i; }
00185   void          Set_Next_Out_Edge(EINDEX16 i)   { _nfrom = i; }
00186   void          Set_Next_In_Edge(EINDEX16 i)    { _nto = i; }
00187   void          Set_Next_Free_Edge(EINDEX16 i)  { _from = i; }
00188   void          Set_To_Free()                   { _to = INVALID_VINDEX16; }
00189   BOOL          Is_Free() const         { return _to == INVALID_VINDEX16; }
00190   VINDEX16      Get_Next_Free_Edge() const      { return _from; }
00191   EINDEX16      Get_Next_Out_Edge() const       { return _nfrom; }
00192   EINDEX16      Get_Next_In_Edge() const        { return _nto; }
00193 public:
00194                 EDGE16()                        { _from=_to=_nfrom=_nto=0; }
00195                 ~EDGE16()                       {}
00196 
00197   EDGE16&       operator = (const EDGE16&);
00198 
00199   VINDEX16      Get_Source() const              { return _from; }
00200   VINDEX16      Get_Sink() const                { return _to; }
00201 };
00202 
00203 #endif          // cxx_graph_INCLUDED
00204 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines