"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "projects/CodeThorn/src/CTAnalysis.C" between
rose-0.11.49.0.tar.gz and rose-0.11.50.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.

CTAnalysis.C  (rose-0.11.49.0):CTAnalysis.C  (rose-0.11.50.0)
skipping to change at line 645 skipping to change at line 645
case 0: case 0:
case 1: case 1:
this->runSolver(); this->runSolver();
break; break;
default: default:
cout<<"Error: unknown abstraction mode "<<_ctOpt.abstractionMode<<endl; cout<<"Error: unknown abstraction mode "<<_ctOpt.abstractionMode<<endl;
exit(1); exit(1);
} }
} }
} else { } else {
// intra-procedural analysis // intra-procedural analysis, each function is analyzed separately
// for intra-procedural analysis extract all start states from work list and
run in a loop
LabelSet entryLabels=getCFAnalyzer()->functionEntryLabels(*getFlow()); LabelSet entryLabels=getCFAnalyzer()->functionEntryLabels(*getFlow());
setTotalNumberOfFunctions(entryLabels.size());
ROSE_ASSERT(estateWorkListCurrent); ROSE_ASSERT(estateWorkListCurrent);
//if(_ctOpt.status) cout<<"STATUS: intra-procedural analysis: entryLabels: " <<entryLabels.size() //if(_ctOpt.status) cout<<"STATUS: intra-procedural analysis: entryLabels: " <<entryLabels.size()
// <<" initial work list length: "<<estateWorkListCurrent- >size()<<endl; // <<" initial work list length: "<<estateWorkListCurrent- >size()<<endl;
// intra-procedural analysis initial states // intra-procedural analysis initial states
//LabelSet entryLabels=getCFAnalyzer()->functionEntryLabels(*getFlow());
//getFlow()->setStartLabelSet(entryLabels);
//LabelSet startLabels=getFlow()->getStartLabelSet();
ROSE_ASSERT(!getModeLTLDriven()); ROSE_ASSERT(!getModeLTLDriven());
eraseWorkList(); eraseWorkList();
LabelSet startLabels=getCFAnalyzer()->functionEntryLabels(*getFlow()); LabelSet startLabels=getCFAnalyzer()->functionEntryLabels(*getFlow());
size_t numStartLabels=startLabels.size(); size_t numStartLabels=startLabels.size();
printStatusMessage("STATUS: intra-procedural analysis with "+std::to_string( numStartLabels)+" start functions.",true); printStatusMessage("STATUS: intra-procedural analysis with "+std::to_string( getTotalNumberOfFunctions())+" functions.",true);
long int fCnt=1; long int fCnt=1;
for(auto slab : startLabels) { for(auto slab : startLabels) {
getFlow()->setStartLabel(slab); getFlow()->setStartLabel(slab);
// initialize intra-procedural analysis with all function entry points // initialize intra-procedural analysis with all function entry points
if(_ctOpt.status) { if(_ctOpt.status) {
SgNode* node=getLabeler()->getNode(slab); SgNode* node=getLabeler()->getNode(slab);
string functionName=SgNodeHelper::getFunctionName(node); string functionName=SgNodeHelper::getFunctionName(node);
string fileName=SgNodeHelper::sourceFilenameToString(node); string fileName=SgNodeHelper::sourceFilenameToString(node);
#pragma omp critical (STATUS_MESSAGES) #pragma omp critical (STATUS_MESSAGES)
{ {
SAWYER_MESG(logger[INFO])<<"Intra-procedural analysis: initializing fun ction "<<fCnt++<<" of "<<numStartLabels<<": "<<fileName<<":"<<functionName<<endl ; SAWYER_MESG(logger[INFO])<<"Intra-procedural analysis: initializing fun ction "<<fCnt++<<" of "<<numStartLabels<<": "<<fileName<<":"<<functionName<<endl ;
} }
} }
EState initialEStateObj=createInitialEState(this->_root,slab); EState initialEStateObj=createInitialEState(this->_root,slab);
initialEStateObj.setLabel(slab); initialEStateObj.setLabel(slab);
//cout<<"DEBUG: initalEStateObj:"<<initialEStateObj.toString()<<endl;
//cout<<"DEBUG: create estate label:"<<slab.toString()<<endl;
const EState* initialEState=processNewOrExisting(initialEStateObj); const EState* initialEState=processNewOrExisting(initialEStateObj);
ROSE_ASSERT(initialEState); ROSE_ASSERT(initialEState);
variableValueMonitor.init(initialEState); variableValueMonitor.init(initialEState);
addToWorkList(initialEState); addToWorkList(initialEState);
this->runSolver(); this->runSolver();
if(this->isIncompleteSTGReady()) {
_statsIntraUnfinishedFunctions++;
} else {
_statsIntraFinishedFunctions++;
}
} }
} }
} }
VariableIdMappingExtended* CodeThorn::CTAnalysis::getVariableIdMapping() { VariableIdMappingExtended* CodeThorn::CTAnalysis::getVariableIdMapping() {
return _variableIdMapping; return _variableIdMapping;
} }
void CodeThorn::CTAnalysis::setVariableIdMapping(VariableIdMappingExtended* vid) { void CodeThorn::CTAnalysis::setVariableIdMapping(VariableIdMappingExtended* vid) {
_variableIdMapping=vid; _variableIdMapping=vid;
skipping to change at line 1320 skipping to change at line 1321
Label slab=getFlow()->getStartLabel(); Label slab=getFlow()->getStartLabel();
EState initialEStateObj=createInitialEState(root, slab); EState initialEStateObj=createInitialEState(root, slab);
const EState* initialEState=processNew(initialEStateObj); const EState* initialEState=processNew(initialEStateObj);
ROSE_ASSERT(initialEState); ROSE_ASSERT(initialEState);
variableValueMonitor.init(initialEState); variableValueMonitor.init(initialEState);
addToWorkList(initialEState); addToWorkList(initialEState);
SAWYER_MESG(logger[INFO]) << "INIT: start state inter-procedural (extremal value size): "<<initialEState->pstate()->stateSize()<<" variables."<<endl; SAWYER_MESG(logger[INFO]) << "INIT: start state inter-procedural (extremal value size): "<<initialEState->pstate()->stateSize()<<" variables."<<endl;
SAWYER_MESG(logger[TRACE]) << "INIT: start state inter-procedural (extrema l value): "<<initialEState->toString(getVariableIdMapping())<<endl; SAWYER_MESG(logger[TRACE]) << "INIT: start state inter-procedural (extrema l value): "<<initialEState->toString(getVariableIdMapping())<<endl;
postInitializeSolver(); // empty in this class, only overridden by IOAnaly zer for ltldriven analysis postInitializeSolver(); // empty in this class, only overridden by IOAnaly zer for ltldriven analysis
} else { } else {
// intra-procedural analysis initial states
//LabelSet entryLabels=getCFAnalyzer()->functionEntryLabels(*getFlow());
//getFlow()->setStartLabelSet(entryLabels);
//LabelSet startLabels=getFlow()->getStartLabelSet();
ROSE_ASSERT(!getModeLTLDriven()); ROSE_ASSERT(!getModeLTLDriven());
// deactivated initialization here, initialization is done in phase 2 for
each function separately
#if 0
LabelSet startLabels=getCFAnalyzer()->functionEntryLabels(*getFlow()); LabelSet startLabels=getCFAnalyzer()->functionEntryLabels(*getFlow());
getFlow()->setStartLabelSet(startLabels); getFlow()->setStartLabelSet(startLabels);
size_t numStartLabels=startLabels.size(); size_t numStartLabels=startLabels.size();
printStatusMessage("STATUS: intra-procedural analysis with "+std::to_strin g(numStartLabels)+" start functions.",true); printStatusMessage("STATUS: intra-procedural analysis with "+std::to_strin g(numStartLabels)+" start functions.",true);
long int fCnt=1; long int fCnt=1;
for(auto slab : startLabels) { for(auto slab : startLabels) {
// initialize intra-procedural analysis with all function entry points // initialize intra-procedural analysis with all function entry points
if(_ctOpt.status) { if(_ctOpt.status) {
SgNode* node=getLabeler()->getNode(slab); SgNode* node=getLabeler()->getNode(slab);
string functionName=SgNodeHelper::getFunctionName(node); string functionName=SgNodeHelper::getFunctionName(node);
string fileName=SgNodeHelper::sourceFilenameToString(node); string fileName=SgNodeHelper::sourceFilenameToString(node);
#pragma omp critical (STATUS_MESSAGES) #pragma omp critical (STATUS_MESSAGES)
{ {
SAWYER_MESG(logger[INFO])<<"Intra-procedural analysis: initializing f unction "<<fCnt++<<" of "<<numStartLabels<<": "<<fileName<<":"<<functionName<<en dl; SAWYER_MESG(logger[INFO])<<"Intra-procedural analysis: initializing f unction "<<fCnt++<<" of "<<numStartLabels<<": "<<fileName<<":"<<functionName<<en dl;
} }
} }
EState initialEStateObj=createInitialEState(root,slab); EState initialEStateObj=createInitialEState(root,slab);
initialEStateObj.setLabel(slab); initialEStateObj.setLabel(slab);
//cout<<"DEBUG: initalEStateObj:"<<initialEStateObj.toString()<<endl;
//cout<<"DEBUG: create estate label:"<<slab.toString()<<endl;
const EState* initialEState=processNewOrExisting(initialEStateObj); const EState* initialEState=processNewOrExisting(initialEStateObj);
ROSE_ASSERT(initialEState); ROSE_ASSERT(initialEState);
variableValueMonitor.init(initialEState); variableValueMonitor.init(initialEState);
addToWorkList(initialEState); addToWorkList(initialEState);
} }
} #endif
} // end of if
if(_ctOpt.rers.rersBinary) { if(_ctOpt.rers.rersBinary) {
//initialize the global variable arrays in the linked binary version of th e RERS problem //initialize the global variable arrays in the linked binary version of th e RERS problem
SAWYER_MESG(logger[DEBUG])<< "init of globals with arrays for "<< _ctOpt.t hreads << " threads. " << endl; SAWYER_MESG(logger[DEBUG])<< "init of globals with arrays for "<< _ctOpt.t hreads << " threads. " << endl;
RERS_Problem::rersGlobalVarsArrayInitFP(_ctOpt.threads); RERS_Problem::rersGlobalVarsArrayInitFP(_ctOpt.threads);
RERS_Problem::createGlobalVarAddressMapsFP(this); RERS_Problem::createGlobalVarAddressMapsFP(this);
} }
SAWYER_MESG(logger[INFO])<<"Initializing solver finished."<<endl; SAWYER_MESG(logger[INFO])<<"Initializing solver finished."<<endl;
} else { } else {
if(_ctOpt.status) cout<<"STATUS: skipping solver run."<<endl; if(_ctOpt.status) cout<<"STATUS: skipping solver run."<<endl;
skipping to change at line 1795 skipping to change at line 1795
} }
void CodeThorn::CTAnalysis::setAssertCondVarsSet(set<AbstractValue> acVars) { void CodeThorn::CTAnalysis::setAssertCondVarsSet(set<AbstractValue> acVars) {
_assertCondVarsSet=acVars; _assertCondVarsSet=acVars;
} }
long CodeThorn::CTAnalysis::analysisRunTimeInSeconds() { long CodeThorn::CTAnalysis::analysisRunTimeInSeconds() {
long result; long result;
#pragma omp critical(TIMER) #pragma omp critical(TIMER)
{ {
result = (long) (_analysisTimer.getTimeDurationAndKeepRunning().seconds()); result = (long) (_analysisTimer.getTimeDuration().seconds());
} }
return result; return result;
} }
CodeThorn::FunctionCallMapping* CodeThorn::CTAnalysis::getFunctionCallMapping() { CodeThorn::FunctionCallMapping* CodeThorn::CTAnalysis::getFunctionCallMapping() {
ROSE_ASSERT(getCFAnalyzer()); ROSE_ASSERT(getCFAnalyzer());
return getCFAnalyzer()->getFunctionCallMapping(); return getCFAnalyzer()->getFunctionCallMapping();
} }
CodeThorn::FunctionCallMapping2* CodeThorn::CTAnalysis::getFunctionCallMapping2( ) { CodeThorn::FunctionCallMapping2* CodeThorn::CTAnalysis::getFunctionCallMapping2( ) {
skipping to change at line 1899 skipping to change at line 1899
} }
VariableId CodeThorn::CTAnalysis::globalVarIdByName(std::string varName) { VariableId CodeThorn::CTAnalysis::globalVarIdByName(std::string varName) {
ROSE_ASSERT(getEStateTransferFunctions()); ROSE_ASSERT(getEStateTransferFunctions());
return getEStateTransferFunctions()->globalVarIdByName(varName); return getEStateTransferFunctions()->globalVarIdByName(varName);
} }
CodeThorn::EStateTransferFunctions* CodeThorn::CTAnalysis::getEStateTransferFunc tions() { CodeThorn::EStateTransferFunctions* CodeThorn::CTAnalysis::getEStateTransferFunc tions() {
return _estateTransferFunctions; return _estateTransferFunctions;
} }
std::string CodeThorn::CTAnalysis::internalAnalysisReportToString() {
stringstream ss;
if(_ctOpt.getIntraProceduralFlag()) {
uint32_t totalIntraFunctions=_statsIntraFinishedFunctions+_statsIntraUnfinis
hedFunctions;
ss<<"Intra-procedural analysis"<<endl;
ss<<"Number of finished functions : "<<_statsIntraFinishedFunctions<<endl;
ss<<"Number of canceled functions : "<<_statsIntraUnfinishedFunctions<<" (m
ax time: "<<_ctOpt.maxTime<<" seconds)"<<endl;
ss<<"Total number of functions : "<<totalIntraFunctions<<" ("<<getTotalN
umberOfFunctions()<<")"<<endl;
} else {
ss<<"Inter-procedural analysis"<<endl;
ss<<"Call string length: "<<_ctOpt.callStringLength<<endl;
}
return ss.str();
}
uint32_t CodeThorn::CTAnalysis::getTotalNumberOfFunctions() {
return _totalNumberOfFunctions;
}
void CodeThorn::CTAnalysis::setTotalNumberOfFunctions(uint32_t num) {
_totalNumberOfFunctions=num;
}
 End of changes. 12 change blocks. 
17 lines changed or deleted 17 lines changed or added

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