remove intent(in)
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
#include "../Utils/SgUtils.h"
|
#include "../Utils/SgUtils.h"
|
||||||
#include "../Utils/utils.h"
|
#include "../Utils/utils.h"
|
||||||
@@ -498,6 +500,83 @@ static void replaceExprByExprInSt(SgStatement* st, SgExpression* from, SgExpress
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void deleteIntentIn(SgStatement* start, SgStatement* end)
|
||||||
|
{
|
||||||
|
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||||
|
{
|
||||||
|
if (st->expr(2)) {
|
||||||
|
int var = st->expr(2)->lhs()->variant();
|
||||||
|
if (var == 468)
|
||||||
|
st->setExpression(2, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void replaceIntentInWithIntentinOut(SgStatement* start, SgStatement* end)
|
||||||
|
{
|
||||||
|
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||||
|
{
|
||||||
|
if (st->expr(2)) {
|
||||||
|
int var = st->expr(2)->lhs()->variant();
|
||||||
|
if (var == 468)
|
||||||
|
st->expr(2)->lhs()->setVariant(470);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void findLocalDataNoIntentIn(SgStatement* start, SgStatement* end, vector<SgExpression*>& local,
|
||||||
|
map<string, SgStatement*>& localParams, set<string>& added)
|
||||||
|
{
|
||||||
|
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||||
|
{
|
||||||
|
if (st->variant() == PARAM_DECL)
|
||||||
|
{
|
||||||
|
auto decl = (SgParameterStmt*)st;
|
||||||
|
for (int z = 0; z < decl->numberOfConstants(); ++z)
|
||||||
|
localParams[decl->constant(z)->identifier()] = st;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (st->variant() == EXTERN_STAT)
|
||||||
|
for (SgExpression* ex = st->expr(0); ex; ex = ex->rhs())
|
||||||
|
added.insert(ex->lhs()->symbol()->identifier());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||||
|
if (st->variant() == VAR_DECL || st->variant() == VAR_DECL_90)
|
||||||
|
if (st->expr(2) && st->expr(2)->lhs()->variant() == 468) {
|
||||||
|
SgExpression* ex = st->expr(0);
|
||||||
|
while (ex)
|
||||||
|
{
|
||||||
|
if (ex->lhs())
|
||||||
|
if (ex->lhs()->variant() == VAR_REF)
|
||||||
|
added.insert(ex->lhs()->symbol()->identifier());
|
||||||
|
|
||||||
|
ex = ex->rhs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||||
|
{
|
||||||
|
//printf("line %d %s Var %s\n", st->lineNumber(), st->fileName(), tag[st->variant()]);
|
||||||
|
if (st->variant() == VAR_DECL || st->variant() == VAR_DECL_90)
|
||||||
|
findDecls(st->expr(0), local, localParams, added);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SgStatement* st = start; st != end; st = st->lexNext())
|
||||||
|
if (st->variant() == VAR_DECL || st->variant() == VAR_DECL_90)
|
||||||
|
if (st->expr(2) && st->expr(2)->lhs()->variant() == 468) {
|
||||||
|
SgExpression* ex = st->expr(0);
|
||||||
|
while (ex)
|
||||||
|
{
|
||||||
|
if (ex->lhs())
|
||||||
|
if (ex->lhs()->variant() == VAR_REF)
|
||||||
|
added.erase(ex->lhs()->symbol()->identifier());
|
||||||
|
|
||||||
|
ex = ex->rhs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void createCheckpoints(SgFile* file, const map<string, CommonBlock*>& commonBlocks, const map<int, UserFiles>& filesInfo,
|
void createCheckpoints(SgFile* file, const map<string, CommonBlock*>& commonBlocks, const map<int, UserFiles>& filesInfo,
|
||||||
const vector<FuncInfo*>& allFuncInfo)
|
const vector<FuncInfo*>& allFuncInfo)
|
||||||
{
|
{
|
||||||
@@ -566,14 +645,18 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
checkNull(lastDecl, convertFileName(__FILE__).c_str(), __LINE__);
|
checkNull(lastDecl, convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
SgStatement* firstExec = lastDecl->lexNext();
|
SgStatement* firstExec = lastDecl->lexNext();
|
||||||
|
|
||||||
|
//deleteIntentIn(func->lexNext(), firstExec);
|
||||||
|
//replaceIntentInWithIntentinOut(func->lexNext(), firstExec);
|
||||||
|
|
||||||
vector<SgExpression*> local;
|
vector<SgExpression*> local;
|
||||||
map<string, SgStatement*> localParams;
|
map<string, SgStatement*> localParams;
|
||||||
set<string> addedToList;
|
set<string> addedToList;
|
||||||
findLocalData(func->lexNext(), lastDecl, local, localParams, addedToList);
|
findLocalDataNoIntentIn(func->lexNext(), firstExec, local, localParams, addedToList);
|
||||||
const vector<SgStatement*> useOfMods = findUseOfModules(func->lexNext(), lastDecl);
|
const vector<SgStatement*> useOfMods = findUseOfModules(func->lexNext(), firstExec);
|
||||||
|
|
||||||
SgStatement* loadBlock = new SgStatement(IF_NODE);
|
SgStatement* loadBlock = new SgStatement(IF_NODE);
|
||||||
SgStatement* storeBlock = new SgStatement(IF_NODE);
|
SgStatement* storeBlock = new SgStatement(IF_NODE);
|
||||||
|
//std::cout << "##############################################################################" << std::endl;
|
||||||
|
|
||||||
point->insertStmtBefore(*loadBlock, *point->controlParent());
|
point->insertStmtBefore(*loadBlock, *point->controlParent());
|
||||||
point->insertStmtBefore(*storeBlock, *point->controlParent());
|
point->insertStmtBefore(*storeBlock, *point->controlParent());
|
||||||
@@ -587,22 +670,37 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
SgArrayRefExp* journal = new SgArrayRefExp(*files, *new SgValueExp(numOfFiles + 1));
|
SgArrayRefExp* journal = new SgArrayRefExp(*files, *new SgValueExp(numOfFiles + 1));
|
||||||
|
|
||||||
//give max len, dont insert
|
//give max len, dont insert
|
||||||
|
/* after store-block in func with cp:
|
||||||
|
spf_cp_files_0_26(1) = 'spf_cp_file_1_0_26'
|
||||||
|
spf_cp_files_0_26(2) = 'spf_cp_file_2_0_26'
|
||||||
|
spf_cp_files_0_26(3) = 'spf_cp_journal_0_26'
|
||||||
|
*/
|
||||||
int maxFileLen = insertInitNamesOfFiles(numOfFiles, additional, files, journal, NULL);
|
int maxFileLen = insertInitNamesOfFiles(numOfFiles, additional, files, journal, NULL);
|
||||||
|
|
||||||
vector<SgSymbol*> everyS;
|
vector<SgSymbol*> everyS;
|
||||||
vector<SgSymbol*> profS;
|
vector<SgSymbol*> profS;
|
||||||
vector<SgExpression*> initS;
|
vector<SgExpression*> initS;
|
||||||
|
|
||||||
string profSs = "spf_cp_prof_s" + additional;
|
string
|
||||||
string profEs = "spf_cp_prof_e" + additional;
|
profSs = "spf_cp_prof_s" + additional,
|
||||||
|
profEs = "spf_cp_prof_e" + additional;
|
||||||
|
|
||||||
profS.push_back(new SgSymbol(VARIABLE_NAME, profSs.c_str(), SgTypeFloat(), func));
|
profS.push_back(new SgSymbol(VARIABLE_NAME, profSs.c_str(), SgTypeFloat(), func));
|
||||||
profS.push_back(new SgSymbol(VARIABLE_NAME, profEs.c_str(), SgTypeFloat(), func));
|
profS.push_back(new SgSymbol(VARIABLE_NAME, profEs.c_str(), SgTypeFloat(), func));
|
||||||
|
|
||||||
SgSymbol* timeF = new SgSymbol(FUNCTION_NAME, "omp_get_wtime", SgTypeDouble(), func); // OR dvtime
|
SgSymbol* timeF = new SgSymbol(FUNCTION_NAME, "omp_get_wtime", SgTypeDouble(), func); // OR dvtime
|
||||||
|
|
||||||
|
//spf_cp_prof_s(e)_0_26 = omp_get_wtime()
|
||||||
SgStatement* profCallS = new SgAssignStmt(*new SgVarRefExp(profS[0]), *new SgFunctionCallExp(*timeF));
|
SgStatement* profCallS = new SgAssignStmt(*new SgVarRefExp(profS[0]), *new SgFunctionCallExp(*timeF));
|
||||||
SgStatement* profCallE = new SgAssignStmt(*new SgVarRefExp(profS[1]), *new SgFunctionCallExp(*timeF));
|
SgStatement* profCallE = new SgAssignStmt(*new SgVarRefExp(profS[1]), *new SgFunctionCallExp(*timeF));
|
||||||
|
|
||||||
|
/* beginning of store block :
|
||||||
|
* ! STORE CHECKPOINT
|
||||||
|
spf_cp_interval_0_26 = spf_cp_interval_0_26 + 1
|
||||||
|
if (spf_cp_interval_0_26 .ge. 1) then
|
||||||
|
spf_cp_interval_0_26 = 0
|
||||||
|
endif
|
||||||
|
*/
|
||||||
if (type == typeEvery::TIME)
|
if (type == typeEvery::TIME)
|
||||||
{
|
{
|
||||||
string everySs = "spf_cp_start" + additional;
|
string everySs = "spf_cp_start" + additional;
|
||||||
@@ -633,14 +731,31 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
everyS.push_back(new SgSymbol(VARIABLE_NAME, everyIs.c_str(), SgTypeInt(), func));
|
everyS.push_back(new SgSymbol(VARIABLE_NAME, everyIs.c_str(), SgTypeInt(), func));
|
||||||
initS.push_back(new SgValueExp(0));
|
initS.push_back(new SgValueExp(0));
|
||||||
SgAssignStmt* init = new SgAssignStmt(*new SgVarRefExp(everyS[0]), *new SgValueExp(0));
|
SgAssignStmt* init = new SgAssignStmt(*new SgVarRefExp(everyS[0]), *new SgValueExp(0));
|
||||||
|
//std::cout << "INIT::" << std::endl;
|
||||||
|
//init->unparsestdout();
|
||||||
|
//std::cout << "storeBlock before::" << std::endl;
|
||||||
|
//storeBlock->unparsestdout();
|
||||||
storeBlock->insertStmtAfter(*init, *storeBlock);
|
storeBlock->insertStmtAfter(*init, *storeBlock);
|
||||||
|
//std::cout << "storeBlock after init::" << std::endl;
|
||||||
|
//storeBlock->unparsestdout();
|
||||||
|
|
||||||
SgAssignStmt* inc = new SgAssignStmt(*new SgVarRefExp(everyS[0]), *new SgVarRefExp(everyS[0]) + *new SgValueExp(1));
|
SgAssignStmt* inc = new SgAssignStmt(*new SgVarRefExp(everyS[0]), *new SgVarRefExp(everyS[0]) + *new SgValueExp(1));
|
||||||
|
//std::cout << "INC::" << std::endl;
|
||||||
|
//init->unparsestdout();
|
||||||
|
//std::cout << "storeBlock->controlParent()::" << std::endl;
|
||||||
|
//storeBlock->controlParent()->unparsestdout();
|
||||||
storeBlock->insertStmtBefore(*inc, *storeBlock->controlParent());
|
storeBlock->insertStmtBefore(*inc, *storeBlock->controlParent());
|
||||||
inc->addComment("! STORE CHECKPOINT\n");
|
inc->addComment("! STORE CHECKPOINT\n");
|
||||||
|
//std::cout << "storeBlock after inc::" << std::endl;
|
||||||
|
//storeBlock->unparsestdout();
|
||||||
|
|
||||||
storeBlock->setExpression(0, *new SgVarRefExp(everyS[0]) >= *new SgValueExp(every));
|
storeBlock->setExpression(0, *new SgVarRefExp(everyS[0]) >= *new SgValueExp(every));
|
||||||
|
//std::cout << "storeBlock after setexpr::" << std::endl;
|
||||||
|
//storeBlock->unparsestdout();
|
||||||
|
//std::cout << "storeBlock->controlParent()::" << std::endl;
|
||||||
|
//storeBlock->controlParent()->unparsestdout();
|
||||||
}
|
}
|
||||||
|
//std::cout << "##############################################################################" << std::endl;
|
||||||
|
|
||||||
vector<SgSymbol*> loadS;
|
vector<SgSymbol*> loadS;
|
||||||
vector<SgExpression*> initLoadS;
|
vector<SgExpression*> initLoadS;
|
||||||
@@ -670,10 +785,18 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
loadS.push_back(new SgSymbol(VARIABLE_NAME, saveFS.c_str(), SgTypeInt(), func));
|
loadS.push_back(new SgSymbol(VARIABLE_NAME, saveFS.c_str(), SgTypeInt(), func));
|
||||||
initLoadS.push_back(new SgValueExp(0));
|
initLoadS.push_back(new SgValueExp(0));
|
||||||
|
|
||||||
|
//std::cout << "loadBlock->controlParent()::" << std::endl;
|
||||||
|
//loadBlock->controlParent()->unparsestdout();
|
||||||
loadBlock->setExpression(0, *new SgVarRefExp(loadS[0]) == *new SgValueExp(0));
|
loadBlock->setExpression(0, *new SgVarRefExp(loadS[0]) == *new SgValueExp(0));
|
||||||
SgAssignStmt* init = new SgAssignStmt(*new SgVarRefExp(loadS[0]), *new SgValueExp(1));
|
SgAssignStmt* init = new SgAssignStmt(*new SgVarRefExp(loadS[0]), *new SgValueExp(1));
|
||||||
|
//std::cout << "INIT::" << std::endl;
|
||||||
|
//init->unparsestdout();
|
||||||
insertToLoadS.push_back(init);
|
insertToLoadS.push_back(init);
|
||||||
|
|
||||||
|
//std::cout << "loadBlock->controlParent()::" << std::endl;
|
||||||
|
//loadBlock->controlParent()->unparsestdout();
|
||||||
|
//std::cout << "##############################################################################" << std::endl;
|
||||||
|
|
||||||
vector<SgExpression*> listSpec;
|
vector<SgExpression*> listSpec;
|
||||||
|
|
||||||
SgExpression& unitNull = SgAssignOp(*new SgKeywordValExp("unit"), *new SgKeywordValExp("*"));
|
SgExpression& unitNull = SgAssignOp(*new SgKeywordValExp("unit"), *new SgKeywordValExp("*"));
|
||||||
@@ -684,6 +807,7 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
SgExpression* iostat = new SgVarRefExp(loadS[2]);
|
SgExpression* iostat = new SgVarRefExp(loadS[2]);
|
||||||
SgExpression* fileIdx = new SgVarRefExp(loadS[1]);
|
SgExpression* fileIdx = new SgVarRefExp(loadS[1]);
|
||||||
|
|
||||||
|
// for first open journal file in load block
|
||||||
listSpec.push_back(&SgAssignOp(*new SgKeywordValExp("iostat"), *iostat));
|
listSpec.push_back(&SgAssignOp(*new SgKeywordValExp("iostat"), *iostat));
|
||||||
listSpec.push_back(&SgAssignOp(*new SgKeywordValExp("status"), *new SgValueExp("old")));
|
listSpec.push_back(&SgAssignOp(*new SgKeywordValExp("status"), *new SgValueExp("old")));
|
||||||
listSpec.push_back(&SgAssignOp(*new SgKeywordValExp("file"), *journal));
|
listSpec.push_back(&SgAssignOp(*new SgKeywordValExp("file"), *journal));
|
||||||
@@ -711,9 +835,17 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
insertToifLoadOk.push_back(open);
|
insertToifLoadOk.push_back(open);
|
||||||
|
|
||||||
SgIfStmt* ifLoadOk1 = new SgIfStmt(*iostat == *new SgValueExp(0), *new SgIOControlStmt(CLOSE_STAT, unit));
|
SgIfStmt* ifLoadOk1 = new SgIfStmt(*iostat == *new SgValueExp(0), *new SgIOControlStmt(CLOSE_STAT, unit));
|
||||||
|
//std::cout << "ifLoadOk1::" << std::endl;
|
||||||
|
//ifLoadOk1->unparsestdout();
|
||||||
|
|
||||||
|
|
||||||
insertToifLoadOk.push_back(ifLoadOk1);
|
insertToifLoadOk.push_back(ifLoadOk1);
|
||||||
|
/* from "! LOAD DATA FROM CHECKPOINT"
|
||||||
|
spf_cp_file_n_0_26 = spf_cp_file_n_0_26 + 1
|
||||||
|
if (spf_cp_file_n_0_26 .eq. 3) then
|
||||||
|
spf_cp_file_n_0_26 = 1
|
||||||
|
endif
|
||||||
|
*/
|
||||||
ifLoadOk1->insertStmtAfter(*new SgIfStmt(*fileIdx == *new SgValueExp(numOfFiles + 1), *new SgAssignStmt(*fileIdx, *new SgValueExp(1))), *ifLoadOk1);
|
ifLoadOk1->insertStmtAfter(*new SgIfStmt(*fileIdx == *new SgValueExp(numOfFiles + 1), *new SgAssignStmt(*fileIdx, *new SgValueExp(1))), *ifLoadOk1);
|
||||||
ifLoadOk1->insertStmtAfter(*new SgAssignStmt(*fileIdx, *fileIdx + *new SgValueExp(1)), *ifLoadOk1);
|
ifLoadOk1->insertStmtAfter(*new SgAssignStmt(*fileIdx, *fileIdx + *new SgValueExp(1)), *ifLoadOk1);
|
||||||
ifLoadOk1->addComment("! LOAD DATA FROM CHECKPOINT\n");
|
ifLoadOk1->addComment("! LOAD DATA FROM CHECKPOINT\n");
|
||||||
@@ -730,6 +862,7 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
//open all files
|
//open all files
|
||||||
if (createdModuleForIO)
|
if (createdModuleForIO)
|
||||||
{
|
{
|
||||||
|
//std::cout << "createdModuleForIO" << std::endl;
|
||||||
SgCallStmt* call = new SgCallStmt(*new SgSymbol(FUNCTION_NAME, iosNames[1].c_str()));
|
SgCallStmt* call = new SgCallStmt(*new SgSymbol(FUNCTION_NAME, iosNames[1].c_str()));
|
||||||
ifLoadOk1->insertStmtAfter(*call, *ifLoadOk1);
|
ifLoadOk1->insertStmtAfter(*call, *ifLoadOk1);
|
||||||
}
|
}
|
||||||
@@ -737,6 +870,7 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
//READ from modules
|
//READ from modules
|
||||||
for (auto& mod : moduleNames)
|
for (auto& mod : moduleNames)
|
||||||
{
|
{
|
||||||
|
//std::cout << "READ from modules" << std::endl;
|
||||||
SgCallStmt* call = new SgCallStmt(*new SgSymbol(FUNCTION_NAME, ("SPF_CP_" + mod).c_str()));
|
SgCallStmt* call = new SgCallStmt(*new SgSymbol(FUNCTION_NAME, ("SPF_CP_" + mod).c_str()));
|
||||||
call->addArg(*new SgValueExp(unitNum));
|
call->addArg(*new SgValueExp(unitNum));
|
||||||
call->addArg(*new SgValueExp(0));
|
call->addArg(*new SgValueExp(0));
|
||||||
@@ -746,11 +880,16 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
//READ DATA
|
//READ DATA
|
||||||
if (local.size())
|
if (local.size())
|
||||||
{
|
{
|
||||||
|
//std::cout << "READ DATA" << std::endl;
|
||||||
auto dataRead = new SgInputOutputStmt(READ_STAT, unit, *makeExprList(local, false));
|
auto dataRead = new SgInputOutputStmt(READ_STAT, unit, *makeExprList(local, false));
|
||||||
ifLoadOk1->insertStmtAfter(*dataRead, *ifLoadOk1);
|
ifLoadOk1->insertStmtAfter(*dataRead, *ifLoadOk1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ifLoadOk1->insertStmtAfter(profCallS->copy(), *ifLoadOk1);
|
ifLoadOk1->insertStmtAfter(profCallS->copy(), *ifLoadOk1);
|
||||||
|
//std::cout << "loadBlock->controlParent()::" << std::endl;
|
||||||
|
//loadBlock->controlParent()->unparsestdout();
|
||||||
|
|
||||||
|
// loadblock done (need to upload)
|
||||||
|
|
||||||
listSpec.clear();
|
listSpec.clear();
|
||||||
listSpec.push_back(&SgAssignOp(*new SgKeywordValExp("form"), *new SgValueExp("unformatted")));
|
listSpec.push_back(&SgAssignOp(*new SgKeywordValExp("form"), *new SgValueExp("unformatted")));
|
||||||
@@ -822,19 +961,41 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
assign->insertStmtBefore(*new SgIOControlStmt(CLOSE_STAT, unit), *ifStoreOk);
|
assign->insertStmtBefore(*new SgIOControlStmt(CLOSE_STAT, unit), *ifStoreOk);
|
||||||
|
|
||||||
ifStoreOk->insertStmtAfter(profCallS->copy(), *ifStoreOk);
|
ifStoreOk->insertStmtAfter(profCallS->copy(), *ifStoreOk);
|
||||||
|
// store-block done
|
||||||
|
|
||||||
|
// block after name of files and before first executable operator
|
||||||
SgStatement* copyForGoto = loadBlock->copyPtr();
|
SgStatement* copyForGoto = loadBlock->copyPtr();
|
||||||
|
//std::cout << "copyForGoto::" << std::endl;
|
||||||
|
//copyForGoto->unparsestdout();
|
||||||
copyForGoto->deleteLabel();
|
copyForGoto->deleteLabel();
|
||||||
|
//std::cout << "copyForGoto after delete label::" << std::endl;
|
||||||
|
//copyForGoto->unparsestdout();
|
||||||
|
//std::cout << "firstExec::" << std::endl;
|
||||||
|
//firstExec->unparsestdout();
|
||||||
firstExec->insertStmtBefore(*copyForGoto, *func);
|
firstExec->insertStmtBefore(*copyForGoto, *func);
|
||||||
|
//std::cout << "firstExec parent after insert::" << std::endl;
|
||||||
|
//firstExec->controlParent()->unparsestdout();
|
||||||
|
//loadBlock->controlParent()->unparsestdout();
|
||||||
insertInitNamesOfFiles(numOfFiles, additional, files, journal, copyForGoto, true);
|
insertInitNamesOfFiles(numOfFiles, additional, files, journal, copyForGoto, true);
|
||||||
|
//std::cout << "insert names of files::" << std::endl;
|
||||||
|
|
||||||
copyForGoto->insertStmtAfter(insertToLoadS[insertToLoadS.size() - 1]->copy(), *copyForGoto);
|
copyForGoto->insertStmtAfter(insertToLoadS[insertToLoadS.size() - 1]->copy(), *copyForGoto);
|
||||||
|
//std::cout << "copyForGoto::" << std::endl;
|
||||||
|
//copyForGoto->controlParent()->unparsestdout();
|
||||||
copyForGoto->insertStmtAfter(insertToLoadS[insertToLoadS.size() - 2]->copy(), *copyForGoto);
|
copyForGoto->insertStmtAfter(insertToLoadS[insertToLoadS.size() - 2]->copy(), *copyForGoto);
|
||||||
|
//std::cout << "copyForGoto::" << std::endl;
|
||||||
|
//copyForGoto->controlParent()->unparsestdout();
|
||||||
|
|
||||||
copyForGoto = copyForGoto->lexNext()->lexNext();
|
copyForGoto = copyForGoto->lexNext()->lexNext();
|
||||||
|
//std::cout << "copyForGoto after double lexnext::" << std::endl;
|
||||||
|
//copyForGoto->unparsestdout();
|
||||||
|
|
||||||
copyForGoto->insertStmtAfter(*new SgGotoStmt(*loadblockLab), *copyForGoto);
|
copyForGoto->insertStmtAfter(*new SgGotoStmt(*loadblockLab), *copyForGoto);
|
||||||
|
//std::cout << "copyForGoto::" << std::endl;
|
||||||
|
//copyForGoto->controlParent()->unparsestdout();
|
||||||
copyForGoto->insertStmtAfter(*new SgIOControlStmt(CLOSE_STAT, unit), *copyForGoto);
|
copyForGoto->insertStmtAfter(*new SgIOControlStmt(CLOSE_STAT, unit), *copyForGoto);
|
||||||
|
//std::cout << "copyForGoto::" << std::endl;
|
||||||
|
//copyForGoto->controlParent()->unparsestdout();
|
||||||
|
|
||||||
for (int z = insertToLoadS.size() - 1; z >= 0; --z)
|
for (int z = insertToLoadS.size() - 1; z >= 0; --z)
|
||||||
loadBlock->insertStmtAfter(*insertToLoadS[z], *loadBlock);
|
loadBlock->insertStmtAfter(*insertToLoadS[z], *loadBlock);
|
||||||
@@ -842,6 +1003,9 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
for (int z = insertToifLoadOk.size() - 1; z >= 0; --z)
|
for (int z = insertToifLoadOk.size() - 1; z >= 0; --z)
|
||||||
ifLoadOk->insertStmtAfter(*insertToifLoadOk[z], *ifLoadOk);
|
ifLoadOk->insertStmtAfter(*insertToifLoadOk[z], *ifLoadOk);
|
||||||
|
|
||||||
|
// load block added
|
||||||
|
|
||||||
|
//std::cout << "##############################################################################" << std::endl;
|
||||||
|
|
||||||
//TODO:
|
//TODO:
|
||||||
/*set<string> elemNotDeclHere;
|
/*set<string> elemNotDeclHere;
|
||||||
@@ -927,6 +1091,7 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
map<FuncInfo*, SgStatement*> processedFrom;
|
map<FuncInfo*, SgStatement*> processedFrom;
|
||||||
for (auto j = toProcess.begin(); j != toProcess.end(); j++)
|
for (auto j = toProcess.begin(); j != toProcess.end(); j++)
|
||||||
{
|
{
|
||||||
|
std::cout << "( " << (j->first)->funcName << " , " << (j->second)->funcName << " ) " << std::endl;
|
||||||
int callNum = 1;
|
int callNum = 1;
|
||||||
SgStatement* hedrTo = (j->first)->funcPointer->GetOriginal();
|
SgStatement* hedrTo = (j->first)->funcPointer->GetOriginal();
|
||||||
SgStatement* hedrFrom = (j->second)->funcPointer->GetOriginal();
|
SgStatement* hedrFrom = (j->second)->funcPointer->GetOriginal();
|
||||||
@@ -935,10 +1100,13 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
lastDecl = lastDecl->lexNext();
|
lastDecl = lastDecl->lexNext();
|
||||||
|
|
||||||
SgStatement* firstExec = lastDecl->lexNext();
|
SgStatement* firstExec = lastDecl->lexNext();
|
||||||
|
|
||||||
|
deleteIntentIn(hedrFrom->lexNext(), firstExec);
|
||||||
|
|
||||||
vector<SgExpression*> local;
|
vector<SgExpression*> local;
|
||||||
map<string, SgStatement*> localParams;
|
map<string, SgStatement*> localParams;
|
||||||
set<string> addedToList;
|
set<string> addedToList;
|
||||||
findLocalData(hedrFrom->lexNext(), lastDecl, local, localParams, addedToList);
|
findLocalData(hedrFrom->lexNext(), firstExec, local, localParams, addedToList);
|
||||||
if (!processedFrom.count(j->second))
|
if (!processedFrom.count(j->second))
|
||||||
{
|
{
|
||||||
SgSymbol* modS = moduleF->symbol();
|
SgSymbol* modS = moduleF->symbol();
|
||||||
@@ -1000,20 +1168,25 @@ void createCheckpoints(SgFile *file, const map<string, CommonBlock*>& commonBloc
|
|||||||
ifLoadOk->insertStmtAfter(*insertToifLoadOk[z], *ifLoadOk);
|
ifLoadOk->insertStmtAfter(*insertToifLoadOk[z], *ifLoadOk);
|
||||||
|
|
||||||
processedFrom[j->second] = ifLoadOk1->lexNext();
|
processedFrom[j->second] = ifLoadOk1->lexNext();
|
||||||
processedFrom[j->second]->unparsestdout();
|
//processedFrom[j->second]->unparsestdout();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SgStatement* read = new SgInputOutputStmt(READ_STAT, *makeExprList({ &frmt, &unit }, false), *new SgVarRefExp(loadS[3]));
|
SgStatement* read = new SgInputOutputStmt(READ_STAT, *makeExprList({ &frmt, &unit }, false), *new SgVarRefExp(loadS[3]));
|
||||||
gotoBlock->insertStmtAfter(*read, *gotoBlock);
|
gotoBlock->insertStmtAfter(*read, *gotoBlock);
|
||||||
processedFrom[j->second] = gotoBlock->lexNext();
|
processedFrom[j->second] = gotoBlock->lexNext();
|
||||||
|
firstExec->insertStmtBefore(*gotoBlock, *hedrFrom);
|
||||||
}
|
}
|
||||||
|
processedFrom[j->second]->unparsestdout();
|
||||||
|
//std::cout << "gotoblock: " << std::endl;
|
||||||
|
//gotoBlock->unparsestdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& callInfo : j->second->callsFromDetailed)
|
for (auto& callInfo : j->second->callsFromDetailed)
|
||||||
{
|
{
|
||||||
|
//std::cout << "callinfo name: " << callInfo.detailCallsFrom.first << std::endl;
|
||||||
auto& call = callInfo.pointerDetailCallsFrom;
|
auto& call = callInfo.pointerDetailCallsFrom;
|
||||||
|
//std::cout << "callinfo var: " << call.second << std::endl;
|
||||||
SgStatement* st = NULL;
|
SgStatement* st = NULL;
|
||||||
|
|
||||||
if (isSgFuncHedrStmt(hedrTo) && call.second == FUNC_CALL)
|
if (isSgFuncHedrStmt(hedrTo) && call.second == FUNC_CALL)
|
||||||
|
|||||||
Reference in New Issue
Block a user