InterActive.hpp

Go to the documentation of this file.
00001 
00016 #ifndef InterActiveStandard_hpp
00017 #define InterActiveStandard_hpp
00018 
00019 #include <cassert>
00020 #include <iostream>
00021 #include <map>
00022 #include <OpenAnalysis/Utils/OA_ptr.hpp>
00023 #include <OpenAnalysis/IRInterface/IRHandles.hpp>
00024 #include <OpenAnalysis/DataFlow/LocDFSet.hpp>
00025 #include <OpenAnalysis/Activity/ActiveStandard.hpp>
00026 #include <OpenAnalysis/OABase/Annotation.hpp>
00027 
00028 namespace OA {
00029   namespace Activity {
00030 
00031 
00032 class InterActive : public virtual Annotation {
00033 public:
00034   InterActive(); 
00035   ~InterActive() {}
00036 
00039   OA_ptr<ProcHandleIterator> getKnownProcIterator();
00040 
00041   // *************************************************************************
00042 
00044   bool isActive(ProcHandle proc, StmtHandle stmt);
00045 
00047   bool isActive(ProcHandle proc, MemRefHandle memref);
00048 
00050   OA_ptr<LocIterator> getActiveLocsIterator(ProcHandle proc);
00051 
00053   OA_ptr<StmtHandleIterator> getActiveStmtIterator(ProcHandle proc);
00054 
00056   OA_ptr<MemRefHandleIterator> getActiveMemRefIterator(ProcHandle proc); 
00057 
00059   int getNumIterUseful();
00060 
00062   int getNumIterVary();
00063 
00065   int getNumIterActive();
00066 
00068   int getActiveSizeInBytes();
00069 
00070   // *****************************************************************
00071   // Construction methods 
00072   // *****************************************************************
00073 
00075   void mapProcToActive(ProcHandle p, OA_ptr<Activity::ActiveStandard> active);
00076 
00078   void setNumIterUseful(int n);
00079 
00081   void setNumIterVary(int n);
00082 
00084   void setNumIterActive(int n);
00085 
00087   void setActiveSizeInBytes(int n);
00088 
00089   // *****************************************************************
00090   // Annotation Interface
00091   // *****************************************************************
00092   void output(IRHandlesIRInterface &ir);
00093 
00094   // *****************************************************************
00095   // Output
00096   // *****************************************************************
00097 
00098   void dump(std::ostream& os, OA_ptr<IRHandlesIRInterface> ir);
00099 
00100 private:
00101   // mapping of procedures to activity results
00102   std::map<ProcHandle,OA_ptr<Activity::ActiveStandard> > mProcToActiveMap;
00103 
00104   // set of active symbols from all procedures
00105   std::set<SymHandle> mActiveSymSet;
00106   bool mUnknownLocActive;
00107   int mSizeInBytes;
00108 
00109   // numIters:  number of iterations over nodes
00110   int mNumIterUseful;
00111   int mNumIterVary;
00112   int mNumIterActive;
00113 
00115   class ActivityProcIter : public virtual ProcHandleIterator,
00116                            public IRHandleSetIterator<ProcHandle>
00117   {
00118   public:
00119     ActivityProcIter(OA_ptr<std::set<ProcHandle> > pSet )
00120       : IRHandleSetIterator<ProcHandle>(pSet) {}
00121     ~ActivityProcIter() { }
00122 
00123     ProcHandle current() const
00124     { return IRHandleSetIterator<ProcHandle>::current(); }
00125     bool isValid() const  
00126     { return IRHandleSetIterator<ProcHandle>::isValid(); }
00127     void operator++() { IRHandleSetIterator<ProcHandle>::operator++(); }
00128     void reset() { IRHandleSetIterator<ProcHandle>::reset(); }
00129   };
00130 
00131 
00132 };
00133 
00134   } // end of Activity namespace
00135 } // end of OA namespace
00136 
00137 #endif
00138