OpenADFortTk (basic)
src/whirl2sexp/symtab2sexp.h
Go to the documentation of this file.
00001 // -*-Mode: C++;-*-
00002 // $Header: /m_home/m_utkej/Argonne/cvs2svn/cvs/OpenADFortTk/src/whirl2sexp/symtab2sexp.h,v 1.9 2007-10-08 18:28:34 utke Exp $
00003 #ifndef symtab2sexp_h
00004 #define symtab2sexp_h
00005 
00006 #include "Open64IRInterface/Open64BasicTypes.h"
00007 
00008 #include "sexpostream.h"
00009 
00010 //***************************************************************************
00011 // Translate symbol tables
00012 //***************************************************************************
00013 
00014 namespace whirl2sexp {
00015 
00016   extern void 
00017   TranslateGlobalSymbolTables(sexp::ostream& sos, int flags = 0);
00018   
00019   extern void 
00020   TranslateLocalSymbolTables(sexp::ostream& sos, SYMTAB_IDX stab_lvl,
00021                              int flags = 0);
00022 
00023 }; /* namespace whirl2sexp */
00024 
00025 
00026 //***************************************************************************
00027 // Translate individual tables
00028 //***************************************************************************
00029 
00030 namespace whirl2sexp {
00031 
00032   // Translate every entry of the given table at the given lexical level
00033   // ('stab_lvl'). 
00034 
00035   void 
00036   xlate_FILE_INFO(sexp::ostream& sos);
00037 
00038   void 
00039   xlate_ST_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl);
00040   void
00041   xlate_ST_TAB(sexp::ostream& sos, const SCOPE& scope);
00042 
00043   void 
00044   xlate_ST_ATTR_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl);
00045 
00046   void 
00047   xlate_PU_TAB(sexp::ostream& sos);
00048 
00049   void 
00050   xlate_TY_TAB(sexp::ostream& sos);
00051 
00052   void 
00053   xlate_FLD_TAB(sexp::ostream& sos);
00054 
00055   void 
00056   xlate_ARB_TAB(sexp::ostream& sos);
00057 
00058   void 
00059   xlate_TYLIST_TAB(sexp::ostream& sos);
00060   
00061   void 
00062   xlate_TCON_TAB(sexp::ostream& sos);
00063 
00064   void 
00065   xlate_TCON_STR_TAB(sexp::ostream& sos);
00066   
00067   void 
00068   xlate_INITO_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl);
00069 
00070   void 
00071   xlate_INITV_TAB(sexp::ostream& sos);
00072 
00073   void 
00074   xlate_BLK_TAB(sexp::ostream& sos);
00075   
00076   void 
00077   xlate_STR_TAB(sexp::ostream& sos);
00078 
00079   
00080   void 
00081   xlate_LABEL_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl);
00082 
00083   void 
00084   xlate_PREG_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl);
00085       
00086 }; /* namespace whirl2sexp */
00087 
00088 
00089 //***************************************************************************
00090 // Functions and functors to translate individual table entries
00091 //***************************************************************************
00092 
00093 namespace whirl2sexp {
00094   
00095   void
00096   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, ST* st);
00097   
00098   void
00099   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, ST_ATTR* sta);
00100 
00101   void
00102   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, PU* pu);
00103 
00104   void
00105   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, TY* ty);
00106   
00107   void
00108   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, FLD* fld);
00109 
00110   void
00111   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, ARB* arb);
00112  
00113   void
00114   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, TYLIST* tyl);
00115  
00116   void
00117   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, TCON* tcon);
00118 
00119   void
00120   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, INITO* inito);
00121 
00122   void
00123   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, INITV* initv);
00124 
00125   void
00126   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, BLK* blk);
00127     
00128   void
00129   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, LABEL* lbl);
00130 
00131   void
00132   xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, PREG* preg);
00133 
00134   void 
00135   xlate_SYMTAB_entry_TCON_STR(sexp::ostream& sos, UINT32 idx);
00136 
00137   void
00138   xlate_SYMTAB_entry_STR(sexp::ostream& sos, UINT32 idx);
00139 
00140   
00141   // xlate_SYMTAB_entry_op: a templated functor that simply calls the
00142   // above (overloaded) routines.
00143   template <class T>
00144   class xlate_SYMTAB_entry_op {
00145   public:
00146     xlate_SYMTAB_entry_op(sexp::ostream& sos_) : sos(sos_), tblsz(0) { }
00147     ~xlate_SYMTAB_entry_op() { }
00148     
00149     void operator()(UINT32 idx, T* entry) const { 
00150       xlate_SYMTAB_entry(sos, idx, entry);
00151       sos << sexp::EndLine;
00152     }
00153     
00154   private:
00155     sexp::ostream& sos;
00156     UINT32 tblsz; // could use to conditionally generate EndLines
00157   };
00158 
00159 
00160 }; /* namespace whirl2sexp */
00161 
00162 
00163 //***************************************************************************
00164 
00165 #endif /* symtab2sexp_h */
00166 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines