ManagerInterReachConsts.cpp

Go to the documentation of this file.
00001 
00016 #include "ManagerInterReachConsts.hpp"
00017 #include <Utils/Util.hpp>
00018 
00019 
00020 namespace OA {
00021   namespace ReachConsts {
00022 
00023 static bool debug = false;
00024 
00025 ManagerInterReachConsts::ManagerInterReachConsts(
00026     OA_ptr<ReachConstsIRInterface> _ir) : mIR(_ir)
00027 {
00028     OA_DEBUG_CTRL_MACRO("DEBUG_ManagerInterReachConsts:ALL", debug);
00029 }
00030 
00034 OA_ptr<InterReachConsts> 
00035 ManagerInterReachConsts::performAnalysis(
00036         OA_ptr<CallGraph::CallGraphInterface> callGraph,
00037         // OA_ptr<DataFlow::ParamBindings> paramBind,
00038         OA_ptr<Alias::InterAliasInterface> interAlias,
00039         OA_ptr<SideEffect::InterSideEffectInterface> interSE,
00040         OA_ptr<CFG::EachCFGInterface> eachCFG,
00041         DataFlow::DFPImplement algorithm)
00042 {
00043   OA_ptr<InterReachConsts> retval;
00044   retval = new InterReachConsts;
00045 
00046 
00047   // Iterate over the procedures in the call graph
00048   OA_ptr<CallGraph::NodesIteratorInterface> procIter
00049       = callGraph->getCallGraphNodesIterator();
00050   for ( ; procIter->isValid(); ++(*procIter)) { 
00051    
00052     OA_ptr<CallGraph::NodeInterface> Node = procIter->currentCallGraphNode();
00053     ProcHandle proc = Node->getProc();
00054 
00055     // if this procedure isn't defined then move on
00056     if (proc==ProcHandle(0)) { 
00057         continue;
00058     }
00059 
00060     //set currentProc()
00061     //mIR->currentProc(proc);
00062 
00063     // get Alias::Interface for this proc
00064     OA_ptr<Alias::Interface> alias;
00065     alias = interAlias->getAliasResults(proc);
00066 
00067     // get CFG for this proc
00068     OA_ptr<CFG::CFGInterface> cfg;
00069     cfg = eachCFG->getCFGResults(proc);
00070 
00071     // create ReachConsts manager
00072     OA_ptr<ManagerReachConstsStandard> rcman;
00073     rcman = new ReachConsts::ManagerReachConstsStandard(mIR);
00074 
00075     OA_ptr<ReachConsts::ReachConstsStandard> rcs 
00076         = rcman->performAnalysis(proc, cfg,
00077                 alias,interSE,algorithm);
00078 
00079     // put reachconsts results in InterReachConsts
00080     retval->mapProcToReachConsts(proc,rcs);
00081 
00082   }
00083  
00084   return retval;
00085 }
00086  
00087 
00088   } // end of namespace Activity
00089 } // end of namespace OA