OpenADFortTk (basic)
src/whirl2sexp/wn2sexp.h
Go to the documentation of this file.
00001 // -*-Mode: C++;-*-
00002 // $Header: /m_home/m_utkej/Argonne/cvs2svn/cvs/OpenADFortTk/src/whirl2sexp/wn2sexp.h,v 1.8 2007-10-08 18:28:34 utke Exp $
00003 #ifndef wn2sexp_h
00004 #define wn2sexp_h
00005 
00006 #include <vector> // STL
00007 #include <list>   // STL
00008 
00009 #include "Open64IRInterface/Open64BasicTypes.h"
00010 
00011 #include "sexpostream.h"
00012 #include "SexpTags.h"
00013 
00014 #include "whirl2sexp.i"
00015 
00016 //***************************************************************************
00017 // Commonly used WHIRL translation functions
00018 //***************************************************************************
00019 
00020 namespace whirl2sexp {
00021     
00022   // Note: All routines Assume that Open64 symbol table globals are
00023   // already set.
00024 
00025   // TranslateWN: Translates the given WHIRL node, emitting output to
00026   // 'sos'.  If 'wn' is NULL, emits an empty list.  
00027   extern whirl2sexp::status 
00028   TranslateWN(sexp::ostream& sos, WN* wn);
00029 
00030   // TranslateWNChildren: Given a non-NULL WHIRL node, translates its
00031   // children, emitting output to 'sos'.
00032   extern whirl2sexp::status 
00033   TranslateWNChildren(sexp::ostream& sos, WN* wn);
00034   
00035 }; /* namespace whirl2sexp */
00036 
00037 
00038 //***************************************************************************
00039 // S-expressions sexp::ostream operators
00040 //***************************************************************************
00041 
00042 // ---------------------------------------------------------
00043 // Shortcut for TranslateWN()
00044 // ---------------------------------------------------------
00045 
00046 #if 0 // Is this going to be more of an annoyance than not?
00047 
00048 struct TranslateWNInfo_ {
00049   WN* val;
00050 };
00051 
00052 sexp::ostream&
00053 operator<<(std::ostream& os, const TranslateWNInfo_& x)
00054 {
00055   sexp::ostream& sos = dynamic_cast<sexp::ostream&>(os);
00056   TranslateWN(sos, x.val);
00057   return sos;
00058 }
00059 
00060 inline TranslateWNInfo_ 
00061 TranslateWN(WN* val)
00062 {
00063   TranslateWNInfo_ x;
00064   x.val = val;
00065   return x;
00066 }
00067 
00068 #endif
00069 
00070 // ---------------------------------------------------------
00071 // GenSexp*: Generate an S-expression for a given object
00072 // ---------------------------------------------------------
00073 
00074 struct GenSexpSymInfo_ {
00075   ST_IDX val;
00076 };
00077 struct GenSexpTyInfo_ {
00078   TY_IDX val;
00079 };
00080 
00081 struct GenSexpWNOprInfo_ {
00082   WN* val;
00083 };
00084 struct GenSexpSymRefInfo_ {
00085   ST_IDX val;
00086 };
00087 struct GenSexpSymNmInfo_ {
00088   ST* val;
00089 };
00090 struct GenSexpTyUseInfo_ {
00091   TY_IDX val;
00092 };
00093 
00094 struct GenSexpFlgInfo_ {
00095   const char* val;
00096 };
00097 struct GenSexpOpaqueFlgInfo_ {
00098   UINT64 val;
00099 };
00100 
00101 
00102 sexp::ostream&
00103 operator<<(std::ostream& os, const GenSexpSymInfo_& x);
00104 
00105 inline GenSexpSymInfo_ 
00106 GenSexpSym(ST_IDX val)
00107 {
00108   GenSexpSymInfo_ x;
00109   x.val = val;
00110   return x;
00111 }
00112 
00113 
00114 sexp::ostream&
00115 operator<<(std::ostream& os, const GenSexpTyInfo_& x);
00116 
00117 inline GenSexpTyInfo_ 
00118 GenSexpTy(TY_IDX val)
00119 {
00120   GenSexpTyInfo_ x;
00121   x.val = val;
00122   return x;
00123 }
00124 
00125 
00126 sexp::ostream&
00127 operator<<(std::ostream& os, const GenSexpWNOprInfo_& x);
00128 
00129 inline GenSexpWNOprInfo_ 
00130 GenSexpWNOpr(WN* val)
00131 {
00132   GenSexpWNOprInfo_ x;
00133   x.val = val;
00134   return x;
00135 }
00136 
00137 
00138 sexp::ostream&
00139 operator<<(std::ostream& os, const GenSexpSymRefInfo_& x);
00140 
00141 inline GenSexpSymRefInfo_ 
00142 GenSexpSymRef(ST_IDX val)
00143 {
00144   GenSexpSymRefInfo_ x;
00145   x.val = val;
00146   return x;
00147 }
00148 
00149 
00150 sexp::ostream&
00151 operator<<(std::ostream& os, const GenSexpSymNmInfo_& x);
00152 
00153 inline GenSexpSymNmInfo_ 
00154 GenSexpSymNm(ST* val)
00155 {
00156   GenSexpSymNmInfo_ x;
00157   x.val = val;
00158   return x;
00159 }
00160 
00161 
00162 sexp::ostream&
00163 operator<<(std::ostream& os, const GenSexpTyUseInfo_& x);
00164 
00165 inline GenSexpTyUseInfo_ 
00166 GenSexpTyUse(TY_IDX val)
00167 {
00168   GenSexpTyUseInfo_ x;
00169   x.val = val;
00170   return x;
00171 }
00172 
00173 
00174 // Cf. GenSexpFlg
00175 sexp::ostream&
00176 operator<<(std::ostream& os, const GenSexpFlgInfo_& x);
00177 
00178 inline GenSexpFlgInfo_
00179 GenSexpFlg(const char* val)
00180 {
00181   GenSexpFlgInfo_ x;
00182   x.val = val;
00183   return x;
00184 }
00185 
00186 
00187 // Cf. GenSexpOpaqueFlg
00188 sexp::ostream&
00189 operator<<(std::ostream& os, const GenSexpOpaqueFlgInfo_& x);
00190 
00191 inline GenSexpOpaqueFlgInfo_
00192 GenSexpOpaqueFlg(UINT64 val)
00193 {
00194   GenSexpOpaqueFlgInfo_ x;
00195   x.val = val;
00196   return x;
00197 }
00198 
00199 
00200 //***************************************************************************
00201 
00202 #endif /* wn2sexp_h */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines