OpenADFortTk (basic)
src/xaif2whirl/PUXlationContext.h
Go to the documentation of this file.
00001 // -*-Mode: C++;-*-
00002 // $Header: /m_home/m_utkej/Argonne/cvs2svn/cvs/OpenADFortTk/src/xaif2whirl/PUXlationContext.h,v 1.4 2008-02-21 14:32:05 utke Exp $
00003 
00004 #ifndef PUXlationContext_INCLUDED
00005 #define PUXlationContext_INCLUDED
00006 
00007 #include <list> 
00008 #include <iostream>
00009 
00010 #include "Open64IRInterface/Open64BasicTypes.h"
00011 #include "WhirlParentize.h"
00012 #include "WhirlIDMaps.h"
00013 #include "Symbol.h"
00014 #include "XAIFSymToSymbolMap.h"
00015 #include "XlationContext.h"
00016 
00017 namespace xaif2whirl {
00018 
00043   class PUXlationContext {
00044   public: 
00045 
00050     PUXlationContext(const std::string& anOriginator, PU_Info* pu_forest);
00051 
00052     ~PUXlationContext();
00053 
00054     // -------------------------------------------------------
00055     // stacked XlationContext manipulation (Create, Delete...)
00056     // -------------------------------------------------------
00057   
00061     void createXlationContext();
00062 
00068     void createXlationContext(XlationContext::Flags_E f);
00069 
00075     void deleteXlationContext();
00076   
00080     XlationContext& currentXlationContext();
00081 
00082     // -------------------------------------------------------
00083     // PU level maps and data
00084     // -------------------------------------------------------
00085 
00086     WN* findParentWN(WN*);
00087     WN* findParentBlockWN(WN*);
00088     fortTkSupport::WhirlParentMap* getWNParentMap() const;
00089     void setWNParentMap(fortTkSupport::WhirlParentMap* aWhirlParentMapP);
00090   
00091     std::pair<ST_TAB*, PU_Info*> findSymTab(fortTkSupport::SymTabId stabId);
00092   
00093     PU_Info* findPU(fortTkSupport::PUId aPUid);
00094 
00095     fortTkSupport::WNId findWNId(WN* wn);
00096     fortTkSupport::WNToWNIdMap* getWNToWNIdMap() const;
00097     void setWNToWNIdMap(fortTkSupport::WNToWNIdMap* aWNToWNIdMapP);
00098 
00099     WN* findWN(fortTkSupport::WNId aWNId, bool mustFind = false);
00100     fortTkSupport::WNIdToWNMap* getWNIdToWNMap() const;
00101     void setWNIdToWNMap(fortTkSupport::WNIdToWNMap* aWNIdToWNMapP);
00102 
00103     fortTkSupport::Symbol* findSym(const std::string& scopeid, const std::string& symid);
00104     fortTkSupport::XAIFSymToSymbolMap& getXAIFSymToSymbolMap();
00105     
00106     // -------------------------------------------------------
00107     // Misc
00108     // -------------------------------------------------------
00109 
00110     void dump(std::ostream& o, const std::string& indent) const;
00111     void ddump() const;
00112 
00113     static void setPrefix(const std::string& aPrefix);
00114     static const std::string& getPrefix();
00115 
00116   private: 
00120     PUXlationContext(const XlationContext& x);
00121 
00125     PUXlationContext();
00126 
00130     PUXlationContext& operator=(const PUXlationContext& x);
00131   
00132     fortTkSupport::SymTabIdToSymTabMap mySymTabIdToSymTabMap;
00133 
00134     fortTkSupport::PUIdToPUMap myPUIdToPUMap;
00135 
00136     fortTkSupport::XAIFSymToSymbolMap myXAIFSymToSymbolMap;
00137 
00141     fortTkSupport::WhirlParentMap* myWNParentMapP;
00142 
00146     fortTkSupport::WNToWNIdMap* myWNToWNIdMapP;
00147   
00151     fortTkSupport::WNIdToWNMap* myWNIdToWNMapP;
00152 
00153     // a globally defined prefix for all newly created symbols
00154     static std::string ourPrefix;
00155 
00160     typedef std::list<XlationContext> XlationContextStack;
00161 
00165     XlationContextStack myXlationContextStack;
00166 
00171     void PushNewXlationContext(XlationContext::Flags_E f);
00172 
00176     std::string myOriginator;
00177 
00178   };
00179 
00180 }
00181 
00182 #endif /* XlationContext_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines