"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "projects/CodeThorn/src/CodeThornPasses.C" between
rose-0.11.53.0.tar.gz and rose-0.11.54.0.tar.gz

About: ROSE is a compiler infrastructure to build source-to-source program transformation and analysis tools for large-scale C, C++, UPC, Fortran, OpenMP, Java, Python and PHP applications.

CodeThornPasses.C  (rose-0.11.53.0):CodeThornPasses.C  (rose-0.11.54.0)
#include "sage3basic.h" #include "sage3basic.h"
#include "CodeThornPasses.h" #include "CodeThornPasses.h"
#include <iostream> #include <iostream>
using namespace CodeThorn::CodeThornLib; using namespace CodeThorn::CodeThornLib;
namespace CodeThorn { namespace CodeThorn {
// set to true for matching C++ ctor calls // set to true for matching C++ ctor calls
bool Pass::WITH_EXTENDED_NORMALIZED_CALL = false; //~ bool Pass::WITH_EXTENDED_NORMALIZED_CALL = false;
void Pass::normalization(CodeThornOptions& ctOpt, SgProject* root, TimingColle ctor& tc) { void Pass::normalization(CodeThornOptions& ctOpt, SgProject* root, TimingColle ctor& tc) {
tc.startTimer(); tc.startTimer();
if(ctOpt.status) cout<<"Phase: normalization"; if(ctOpt.status) cout<<"Phase: normalization";
if(ctOpt.status && ctOpt.normalizeLevel==0) cout<<" (skipped)"; if(ctOpt.status && ctOpt.normalizeLevel==0) cout<<" (skipped)";
if(ctOpt.status) cout<<endl; if(ctOpt.status) cout<<endl;
normalizationPass(ctOpt,root); normalizationPass(ctOpt,root);
tc.stopTimer(TimingCollector::normalization); tc.stopTimer(TimingCollector::normalization);
} }
skipping to change at line 39 skipping to change at line 39
CodeThorn::Labeler* Pass::createLabeler(CodeThornOptions& ctOpt, SgProject* ro ot, TimingCollector& tc, VariableIdMappingExtended* variableIdMapping) { CodeThorn::Labeler* Pass::createLabeler(CodeThornOptions& ctOpt, SgProject* ro ot, TimingCollector& tc, VariableIdMappingExtended* variableIdMapping) {
tc.startTimer(); tc.startTimer();
if(ctOpt.status) cout<<"Phase: program location labeling"<<endl; if(ctOpt.status) cout<<"Phase: program location labeling"<<endl;
const bool withCplusplus = ctOpt.extendedNormalizedCppFunctionCalls; const bool withCplusplus = ctOpt.extendedNormalizedCppFunctionCalls;
Labeler* labeler=CodeThorn::CodeThornLib::createLabeler(root,variableIdMappi ng,withCplusplus); Labeler* labeler=CodeThorn::CodeThornLib::createLabeler(root,variableIdMappi ng,withCplusplus);
tc.stopTimer(TimingCollector::labeler); tc.stopTimer(TimingCollector::labeler);
return labeler; return labeler;
} }
// not used #if 0
ClassHierarchyWrapper* Pass::createClassHierarchy(CodeThornOptions& ctOpt, SgP ClassHierarchyWrapper*
roject* root, TimingCollector& tc) { Pass::createClassHierarchy(CodeThornOptions& ctOpt, SgProject* root, TimingCol
lector& tc) {
tc.startTimer(); tc.startTimer();
if(ctOpt.status) cout<<"Phase: class hierarchy analysis"<<endl; if(ctOpt.status) cout<<"Phase: class hierarchy analysis"<<endl;
auto classHierarchy=new ClassHierarchyWrapper(root); ClassHierarchyWrapper* classHierarchy=new ClassHierarchyWrapper(root);
tc.stopTimer(TimingCollector::classHierarchyAnalysis); tc.stopTimer(TimingCollector::classHierarchyAnalysis);
return classHierarchy; return classHierarchy;
} }
#endif
CFAnalysis* Pass::createForwardIcfg(CodeThornOptions& ctOpt, SgProject* root, ClassAnalysis*
TimingCollector& tc, Labeler* labeler) { Pass::createClassAnalysis(CodeThornOptions& ctOpt, SgProject* root, TimingColl
ector& tc) {
if (!ctOpt.extendedNormalizedCppFunctionCalls)
return nullptr;
ASSERT_not_null(root);
tc.startTimer();
if(ctOpt.status) cout<<"Phase: class hierarchy analysis"<<endl;
ClassAnalysis* res=new ClassAnalysis(std::move(analyzeClasses(root)));
tc.stopTimer(TimingCollector::classHierarchyAnalysis);
return res;
}
VirtualFunctionAnalysis*
Pass::createVirtualFunctionAnalysis(CodeThornOptions& ctOpt, ClassAnalysis* cl
asses, TimingCollector& tc) {
if (!ctOpt.extendedNormalizedCppFunctionCalls)
return nullptr;
ASSERT_not_null(classes);
tc.startTimer();
if(ctOpt.status) cout<<"Phase: virtual function analysis"<<endl;
VirtualFunctionAnalysis* res=new VirtualFunctionAnalysis(std::move(analyzeVi
rtualFunctions(*classes)));
tc.stopTimer(TimingCollector::virtualFunctionAnalysis);
return res;
}
CFAnalysis* Pass::createForwardIcfg(CodeThornOptions& ctOpt, SgProject* root,
TimingCollector& tc, Labeler* labeler, ClassAnalysis* classAnalysis, VirtualFunc
tionAnalysis* virtualFunctions) {
// bool isForardIcfg=true; // bool isForardIcfg=true;
return Pass::createIcfg(ctOpt,root,tc,labeler,ICFG_forward); return Pass::createIcfg(ctOpt,root,tc,labeler,classAnalysis,virtualFunctions ,ICFG_forward);
} }
CFAnalysis* Pass::createBackwardIcfg(CodeThornOptions& ctOpt, SgProject* root, CFAnalysis* Pass::createBackwardIcfg(CodeThornOptions& ctOpt, SgProject* root,
TimingCollector& tc, Labeler* labeler) { TimingCollector& tc, Labeler* labeler, ClassAnalysis* classAnalysis, VirtualFun
return Pass::createIcfg(ctOpt,root,tc,labeler,ICFG_backward); ctionAnalysis* virtualFunctions) {
return Pass::createIcfg(ctOpt,root,tc,labeler,classAnalysis,virtualFunctions
,ICFG_backward);
} }
CFAnalysis* Pass::createIcfg(CodeThornOptions& ctOpt, SgProject* root, TimingC ollector& tc, Labeler* labeler, ICFGDirection icfgDirection) { CFAnalysis* Pass::createIcfg(CodeThornOptions& ctOpt, SgProject* root, TimingC ollector& tc, Labeler* labeler, ClassAnalysis* classAnalysis, VirtualFunctionAna lysis* virtualFunctions, ICFGDirection icfgDirection) {
tc.startTimer(); tc.startTimer();
CodeThorn::Pass::WITH_EXTENDED_NORMALIZED_CALL=ctOpt.extendedNormalizedCppFu
nctionCalls; // to be used without global var
CFAnalysis* cfanalyzer=new CFAnalysis(labeler); CFAnalysis* cfanalyzer=new CFAnalysis(labeler);
cfanalyzer->setInterProcedural(ctOpt.getInterProceduralFlag()); cfanalyzer->setInterProcedural(ctOpt.getInterProceduralFlag());
if(!ctOpt.extendedNormalizedCppFunctionCalls) { if(!ctOpt.extendedNormalizedCppFunctionCalls) {
if(ctOpt.status) cout<<"Phase: C ICFG construction"<<endl; if(ctOpt.status) cout<<"Phase: C ICFG construction"<<endl;
cfanalyzer->createCICFG(root); cfanalyzer->createCICFG(root);
} else { } else {
cfanalyzer->useCplusplus(true);
if(ctOpt.status) cout<<"Phase: C++ ICFG construction"<<endl; if(ctOpt.status) cout<<"Phase: C++ ICFG construction"<<endl;
cfanalyzer->createCppICFG(root); FunctionCallMapping2* funMap2 = new FunctionCallMapping2(labeler, classAna
lysis, virtualFunctions);
ASSERT_not_null(funMap2);
funMap2->computeFunctionCallMapping(root);
cfanalyzer->createCppICFG(root, funMap2);
} }
if(ctOpt.status) { if(ctOpt.status) {
cout<<"Phase: ICFG construction"<<endl; cout<<"Phase: ICFG construction"<<endl;
size_t icfgSize=cfanalyzer->getIcfgFlow()->size(); size_t icfgSize=cfanalyzer->getIcfgFlow()->size();
size_t interSize=cfanalyzer->getInterFlow()->size(); size_t interSize=cfanalyzer->getInterFlow()->size();
size_t intraSize=icfgSize-interSize; size_t intraSize=icfgSize-interSize;
cout<<" intra-procedural edges: " << intraSize<<endl; cout<<" intra-procedural edges: " << intraSize<<endl;
cout<<" inter-procedural edges: " << interSize <<endl; cout<<" inter-procedural edges: " << interSize <<endl;
cout<<" ICFG total edges: " << icfgSize <<endl; cout<<" ICFG total edges: " << icfgSize <<endl;
} }
 End of changes. 11 change blocks. 
16 lines changed or deleted 58 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)