diff --git a/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp b/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp index a37d947..5716f4f 100644 --- a/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp @@ -264,7 +264,6 @@ static SgValueExp* zeroExpr = NULL; static vector getLowBounds(SgSymbol* arrayS) { - if (oneExpr == NULL) oneExpr = new SgValueExp(1); @@ -314,6 +313,8 @@ static vector getLowBounds(SgSymbol* arrayS) if (consistInAllocates != 1) list = NULL; + if (list == NULL) + __spf_print(1, "find for %s, consistInAllocates = %d", arrayS->identifier(), consistInAllocates); checkNull(list, convertFileName(__FILE__).c_str(), __LINE__); } else @@ -365,10 +366,20 @@ static SgArrayRefExp* addressPass(SgArrayRefExp* result, SgArrayRefExp* arrayExp { checkNull(boundsOld[z], convertFileName(__FILE__).c_str(), __LINE__); checkNull(boundsNew[z], convertFileName(__FILE__).c_str(), __LINE__); + SgExpression* shift = NULL; + SgExpression& baseShift = (boundsNew[z]->copy() - boundsOld[z]->copy()); + + if (arrayExpNew->subscript(z) && + !isEqExpressions(arrayExpNew->subscript(z), boundsNew[z], collection)) + { + shift = &(arrayExpNew->subscript(z)->copy() - boundsNew[z]->copy()); + } + + SgExpression& oldSub = arrayExpOld->subscript(z)->copy(); if (isEqExpressions(boundsOld[z], boundsNew[z], collection)) - result->addSubscript(arrayExpOld->subscript(z)->copy()); + result->addSubscript(shift ? (oldSub + *shift) : oldSub); else - result->addSubscript(arrayExpOld->subscript(z)->copy() + (boundsNew[z]->copy() - boundsOld[z]->copy())); + result->addSubscript(shift ? (oldSub + baseShift + *shift) : (oldSub + baseShift)); } return result; } @@ -454,12 +465,19 @@ static SgExpression* doReplace(SgExpression* oldExp, SgExpression* newExp, mapunparsestdout(); - //arrayExpNew->unparsestdout(); - //printf("\n"); + /*arrayExpOld->unparsestdout(); + arrayExpNew->unparsestdout(); + printf("\n");*/ auto boundsOld = getLowBounds(oldExp->symbol()); auto boundsNew = getLowBounds(newExp->symbol()); + + /*for (auto& elem : boundsOld) + elem->unparsestdout(); + printf("--\n"); + for (auto& elem : boundsNew) + elem->unparsestdout(); + printf("--\n");*/ const int numOldSubs = arrayExpOld->numberOfSubscripts(); const int numNewSubs = arrayExpNew->numberOfSubscripts(); @@ -508,7 +526,6 @@ static SgExpression* doReplace(SgExpression* oldExp, SgExpression* newExp, mapaddSubscript(arrayExpNew->subscript(boundsOld.size() + z)->copy()); - retVal = result; } else diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp index 6a16906..fd45c3b 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp @@ -3080,11 +3080,15 @@ static set applyModuleDeclsForFile(FileInfo *forFile, const map included; for (auto& incl : toIncl) { if (included.find(incl) == included.end()) + { include += " include '" + incl + "'\n"; + includeCount++; + } included.insert(incl); } @@ -3117,8 +3121,8 @@ static set applyModuleDeclsForFile(FileInfo *forFile, const mapfileName.c_str()); @@ -4161,7 +4165,7 @@ SgProject* createProject(const char* proj_name, } } filterModuleUse(moduleUsesByFile, moduleDecls); - + map shifts; //shiftLines if modules included const string shiftInfo = "!SPF NUM FILES"; @@ -4200,7 +4204,6 @@ SgProject* createProject(const char* proj_name, for (int z = 0; z < project->numberOfFiles(); ++z) { SgFile* file = &(project->file(z)); - for (SgStatement* st = file->firstStatement()->lexNext(); st; st = st->lexNext()) { string currF = st->fileName(); diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index 231d077..0bc7431 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/version.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2271" +#define VERSION_SPF "2273"