OpenADFortTk (basic)
src/sexp2whirl/sexp2symtab.h
Go to the documentation of this file.
00001 // -*-Mode: C++;-*-
00002 // $Header: /m_home/m_utkej/Argonne/cvs2svn/cvs/OpenADFortTk/src/sexp2whirl/sexp2symtab.h,v 1.9 2007-10-08 18:28:33 utke Exp $
00003 #ifndef sexp2symtab_h
00004 #define sexp2symtab_h
00005 
00006 #include <sexp.h>
00007 
00008 #include "Open64IRInterface/Open64BasicTypes.h"
00009 
00010 #include "Diagnostics.h"
00011 
00012 namespace sexp2whirl {
00013 
00014   extern void 
00015   TranslateGlobalSymbolTables(sexp_t* gbl_symtab, int flags = 0);
00016 
00017   extern void 
00018   TranslateLocalSymbolTables(sexp_t* pu_symtab, SYMTAB_IDX stab_lvl,
00019                              int flags = 0);
00020 
00021 }; /* namespace sexp2whirl */
00022 
00023 
00024 //***************************************************************************
00025 // Translate individual tables
00026 //***************************************************************************
00027 
00028 namespace sexp2whirl {
00029 
00030   // Translate every entry of the given table at the given lexical level
00031   // ('stab_lvl'). 
00032 
00033   void 
00034   xlate_FILE_INFO(sexp_t* file_info);
00035 
00036   void 
00037   xlate_ST_TAB(sexp_t* st_tab, SYMTAB_IDX stab_lvl);
00038   void
00039   xlate_ST_TAB(sexp_t* st_tab, const SCOPE& scope);
00040 
00041   void 
00042   xlate_ST_ATTR_TAB(sexp_t* st_attr_tab, SYMTAB_IDX stab_lvl);
00043 
00044   void 
00045   xlate_PU_TAB(sexp_t* pu_tab);
00046 
00047   void 
00048   xlate_TY_TAB(sexp_t* ty_tab);
00049 
00050   void 
00051   xlate_FLD_TAB(sexp_t* fld_tab);
00052 
00053   void 
00054   xlate_ARB_TAB(sexp_t* arb_tab);
00055 
00056   void 
00057   xlate_TYLIST_TAB(sexp_t* tylist_tab);
00058   
00059   void 
00060   xlate_TCON_TAB(sexp_t* tcon_tab);
00061 
00062   void 
00063   xlate_TCON_STR_TAB(sexp_t* str_tab);
00064   
00065   void 
00066   xlate_INITO_TAB(sexp_t* inito_tab, SYMTAB_IDX stab_lvl);
00067 
00068   void 
00069   xlate_INITV_TAB(sexp_t* initv_tab);
00070 
00071   void 
00072   xlate_BLK_TAB(sexp_t* blk_tab);
00073   
00074   void 
00075   xlate_STR_TAB(sexp_t* str_tab);
00076 
00077   
00078   void 
00079   xlate_LABEL_TAB(sexp_t* label_tab, SYMTAB_IDX stab_lvl);
00080   
00081   void 
00082   xlate_PREG_TAB(sexp_t* preg_tab, SYMTAB_IDX stab_lvl);
00083       
00084 }; /* namespace sexp2whirl */
00085 
00086 
00087 //***************************************************************************
00088 // Functions to translate individual table entries
00089 //***************************************************************************
00090 
00091 namespace sexp2whirl {
00092   
00093   ST*
00094   xlate_ST_TAB_entry(sexp_t* sx);
00095   
00096   ST_ATTR*
00097   xlate_ST_ATTR_TAB_entry(sexp_t* sx);
00098 
00099   PU*
00100   xlate_PU_TAB_entry(sexp_t* sx);
00101 
00102   TY*
00103   xlate_TY_TAB_entry(sexp_t* sx);
00104 
00105   FLD*
00106   xlate_FLD_TAB_entry(sexp_t* sx);
00107 
00108   ARB*
00109   xlate_ARB_TAB_entry(sexp_t* sx);
00110   
00111   TYLIST*
00112   xlate_TYLIST_TAB_entry(sexp_t* sx);
00113 
00114   TCON*
00115   xlate_TCON_TAB_entry(sexp_t* sx);
00116 
00117   INITO*
00118   xlate_INITO_TAB_entry(sexp_t* sx);
00119 
00120   INITV*
00121   xlate_INITV_TAB_entry(sexp_t* sx);
00122 
00123   BLK*
00124   xlate_BLK_TAB_entry(sexp_t* sx);
00125   
00126   LABEL*
00127   xlate_LABEL_TAB_entry(sexp_t* sx);
00128 
00129   PREG*
00130   xlate_PREG_TAB_entry(sexp_t* sx);
00131 
00132 
00133   UINT32
00134   xlate_TCON_STR_TAB_entry(sexp_t* sx, std::string& buf);
00135 
00136   UINT32
00137   xlate_STR_TAB_entry(sexp_t* sx, std::string& buf);
00138   
00139 
00140   // xlate_SYMTAB_entry: Templated access to translation routines
00141   template <typename T>
00142   T*
00143   xlate_SYMTAB_entry(sexp_t* sx)
00144   { FORTTK_DIE("Must not be called (template specialization must exist)"); }
00145   
00146   // Specializations of xlate_SYMTAB_entry
00147   template <> 
00148   inline ST* 
00149   xlate_SYMTAB_entry<ST>(sexp_t* sx) { return xlate_ST_TAB_entry(sx); }
00150   
00151   template <>
00152   inline ST_ATTR* 
00153   xlate_SYMTAB_entry<ST_ATTR>(sexp_t* sx) { return xlate_ST_ATTR_TAB_entry(sx); }
00154   
00155   template <>
00156   inline PU* 
00157   xlate_SYMTAB_entry<PU>(sexp_t* sx) { return xlate_PU_TAB_entry(sx); }
00158 
00159   template <>
00160   inline TY* 
00161   xlate_SYMTAB_entry<TY>(sexp_t* sx) { return xlate_TY_TAB_entry(sx); }
00162   
00163   template <>
00164   inline FLD* 
00165   xlate_SYMTAB_entry<FLD>(sexp_t* sx) { return xlate_FLD_TAB_entry(sx); }
00166   
00167   template <>
00168   inline ARB* 
00169   xlate_SYMTAB_entry<ARB>(sexp_t* sx) { return xlate_ARB_TAB_entry(sx); }
00170   
00171   template <>
00172   inline TYLIST* 
00173   xlate_SYMTAB_entry<TYLIST>(sexp_t* sx) { return xlate_TYLIST_TAB_entry(sx); }
00174   
00175   template <>
00176   inline TCON* 
00177   xlate_SYMTAB_entry<TCON>(sexp_t* sx) { return xlate_TCON_TAB_entry(sx); }
00178   
00179   template <>
00180   inline INITO* 
00181   xlate_SYMTAB_entry<INITO>(sexp_t* sx) { return xlate_INITO_TAB_entry(sx); }
00182   
00183   template <>
00184   inline INITV* 
00185   xlate_SYMTAB_entry<INITV>(sexp_t* sx) { return xlate_INITV_TAB_entry(sx); }
00186   
00187   template <>
00188   inline BLK* 
00189   xlate_SYMTAB_entry<BLK>(sexp_t* sx) { return xlate_BLK_TAB_entry(sx); }
00190     
00191   template <>
00192   inline LABEL* 
00193   xlate_SYMTAB_entry<LABEL>(sexp_t* sx) { return xlate_LABEL_TAB_entry(sx); }
00194   
00195   template <>
00196   inline PREG* 
00197   xlate_SYMTAB_entry<PREG>(sexp_t* sx) { return xlate_PREG_TAB_entry(sx); }
00198   
00199 }; /* namespace sexp2whirl */
00200 
00201 
00202 //***************************************************************************
00203 
00204 #endif /* sexp2symtab_h */
00205 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines