ManagerICFG.hpp

Go to the documentation of this file.
00001 
00016 #ifndef ICFGManagerStandard_h
00017 #define ICFGManagerStandard_h
00018 
00019 //--------------------------------------------------------------------
00020 // OpenAnalysis headers
00021 #include <OpenAnalysis/Utils/OA_ptr.hpp>
00022 #include <OpenAnalysis/CFG/EachCFGInterface.hpp>
00023 #include <OpenAnalysis/CFG/CFG.hpp>
00024 #include <OpenAnalysis/IRInterface/ICFGIRInterface.hpp>
00025 #include <OpenAnalysis/CallGraph/CallGraphInterface.hpp>
00026 #include "ICFG.hpp"
00027 
00028 /*
00029 #include <queue>
00030 #include <set>
00031 #include <map>
00032 #include <string>
00033 #include <algorithm>
00034 #include <cctype>
00035 */
00036 
00037 namespace OA {
00038   namespace ICFG {
00039 
00045 class ManagerICFGStandard { 
00046 public:
00047   ManagerICFGStandard(OA_ptr<ICFGIRInterface> _ir);
00048  ~ManagerICFGStandard () {}
00049 
00050   OA_ptr<ICFG> performAnalysis( OA_ptr<IRProcIterator>,
00051                                         OA_ptr<CFG::EachCFGInterface>,
00052                                         OA_ptr<CallGraph::CallGraphInterface>);
00053 
00054 private: // helper functions
00055 
00056   bool stmt_has_call(StmtHandle stmt);
00057 
00058   StmtHandle 
00059   get_call_stmt(OA_ptr<CFG::Node> cfgNode);
00060 
00061   OA_ptr<Node> create_icfg_node(
00062         OA_ptr<ICFG> icfg, ProcHandle proc, NodeType pType, 
00063         OA_ptr<CFG::Node> cfgNode);
00064 
00065   OA_ptr<Node> handle_call_node(OA_ptr<ICFG> icfg, 
00066         ProcHandle proc, OA_ptr<CFG::Node> cfgNodeNew,
00067         OA_ptr<Node> prevICFGNode, 
00068         OA_ptr<Node>& firstICFGNode,
00069         std::list<ProcHandle>& worklist);
00070     
00071   OA_ptr<std::list<OA_ptr<CFG::Node> > >
00072   break_out_calls(OA_ptr<CFG::Node> cfgNode);
00073 
00074 private: // member variables
00075 
00076   OA_ptr<ICFGIRInterface> mIR;
00077   OA_ptr<CFG::EachCFGInterface> mEachCFG;
00078   OA_ptr<CallGraph::CallGraphInterface> mCallGraph;
00079   
00080   // mapping of CFG nodes to ICFG nodes so that know what
00081   // ICFG nodes edges should connect
00082   typedef std::map<OA_ptr<CFG::Node>,OA_ptr<Node> > 
00083       NodeToNodeMap;
00084   NodeToNodeMap mCFGNodeToICFGNode;
00085 
00086 
00087 };
00088 
00089   } // end of ICFG namespace
00090 } // end of OA namespace
00091 
00092 #endif