fixed inliner, improved dead_code
This commit is contained in:
@@ -137,6 +137,11 @@ static map<string, SgExpression*> createMapOfArgs(SgStatement* tempHedr, SgExpre
|
|||||||
return vars;
|
return vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isAllocated(SgSymbol* s)
|
||||||
|
{
|
||||||
|
return (s->attributes() & ALLOCATABLE_BIT) || (s->attributes() & POINTER_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
static inline SgSymbol* createSymbAndDecl(const string& funcName, const string& varName, SgSymbol* newS, set<SgSymbol*>& newSymbols, SgType* type = NULL)
|
static inline SgSymbol* createSymbAndDecl(const string& funcName, const string& varName, SgSymbol* newS, set<SgSymbol*>& newSymbols, SgType* type = NULL)
|
||||||
{
|
{
|
||||||
SgSymbol* original = newS;
|
SgSymbol* original = newS;
|
||||||
@@ -208,7 +213,7 @@ static inline SgSymbol* createSymbAndDecl(const string& funcName, const string&
|
|||||||
{
|
{
|
||||||
createdByFunc[key][varName] = newS;
|
createdByFunc[key][varName] = newS;
|
||||||
count[0] = nextCount;
|
count[0] = nextCount;
|
||||||
if (original && (original->attributes() & ALLOCATABLE_BIT))
|
if (original && isAllocated(original))
|
||||||
linkToOrig[newS] = original;
|
linkToOrig[newS] = original;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -266,7 +271,7 @@ static vector<SgExpression*> getLowBounds(SgSymbol* arrayS)
|
|||||||
SgExpression* list = NULL;
|
SgExpression* list = NULL;
|
||||||
|
|
||||||
|
|
||||||
if (arrayS->attributes() & ALLOCATABLE_BIT)
|
if (isAllocated(arrayS))
|
||||||
{
|
{
|
||||||
SgSymbol* copyFrom = NULL;
|
SgSymbol* copyFrom = NULL;
|
||||||
if (linkToOrig.find(arrayS) == linkToOrig.end())
|
if (linkToOrig.find(arrayS) == linkToOrig.end())
|
||||||
@@ -332,7 +337,7 @@ static vector<SgExpression*> getLowBounds(SgSymbol* arrayS)
|
|||||||
|
|
||||||
static vector<SgExpression*> getBoundsExpression(SgSymbol* arrayS)
|
static vector<SgExpression*> getBoundsExpression(SgSymbol* arrayS)
|
||||||
{
|
{
|
||||||
if (arrayS->attributes() & ALLOCATABLE_BIT)
|
if (isAllocated(arrayS))
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||||
|
|
||||||
auto type = isSgArrayType(arrayS->type());
|
auto type = isSgArrayType(arrayS->type());
|
||||||
@@ -2163,7 +2168,7 @@ static void createDeclarations(const map<SgStatement*, set<SgSymbol*>>& newSymbs
|
|||||||
if (globalType != 1) // not in COMMON
|
if (globalType != 1) // not in COMMON
|
||||||
saveRefs[toDec->identifier()] = toDec;
|
saveRefs[toDec->identifier()] = toDec;
|
||||||
|
|
||||||
if (toDec->attributes() & ALLOCATABLE_BIT)
|
if (isAllocated(toDec))
|
||||||
allocatable.insert(toDec);
|
allocatable.insert(toDec);
|
||||||
|
|
||||||
if (toDec->attributes() & DATA_BIT)
|
if (toDec->attributes() & DATA_BIT)
|
||||||
|
|||||||
@@ -1172,9 +1172,9 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
|||||||
addPrivatesToArraysFromGUI(file, declaredArrays, distrStateFromGUI);
|
addPrivatesToArraysFromGUI(file, declaredArrays, distrStateFromGUI);
|
||||||
else if (curr_regime == REMOVE_DEAD_CODE_AND_UNPARSE)
|
else if (curr_regime == REMOVE_DEAD_CODE_AND_UNPARSE)
|
||||||
{
|
{
|
||||||
auto funcsForFile = getObjectForFileFromMap(file_name, allFuncInfo_IR);
|
auto funcsForFile = getObjectForFileFromMap(file_name, allFuncInfo);
|
||||||
for (auto& func : funcsForFile)
|
for (auto& func : funcsForFile)
|
||||||
removeDeadCode(func->funcPointer, allFuncInfo_IR, commonBlocks);
|
removeDeadCode(func->funcPointer, allFuncInfo, commonBlocks);
|
||||||
}
|
}
|
||||||
else if (curr_regime == TEST_PASS)
|
else if (curr_regime == TEST_PASS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
|
|||||||
|
|
||||||
Pass(REMOVE_OMP_DIRS) <= Pass(REMOVE_OMP_DIRS_TRANSFORM);
|
Pass(REMOVE_OMP_DIRS) <= Pass(REMOVE_OMP_DIRS_TRANSFORM);
|
||||||
|
|
||||||
Pass(BUILD_IR) <= Pass(REMOVE_DEAD_CODE_AND_UNPARSE);
|
Pass(CALL_GRAPH2) <= Pass(REMOVE_DEAD_CODE_AND_UNPARSE);
|
||||||
|
|
||||||
passesIgnoreStateDone.insert({ CREATE_PARALLEL_DIRS, INSERT_PARALLEL_DIRS, INSERT_SHADOW_DIRS, EXTRACT_PARALLEL_DIRS,
|
passesIgnoreStateDone.insert({ CREATE_PARALLEL_DIRS, INSERT_PARALLEL_DIRS, INSERT_SHADOW_DIRS, EXTRACT_PARALLEL_DIRS,
|
||||||
EXTRACT_SHADOW_DIRS, CREATE_REMOTES, UNPARSE_FILE, REMOVE_AND_CALC_SHADOW,
|
EXTRACT_SHADOW_DIRS, CREATE_REMOTES, UNPARSE_FILE, REMOVE_AND_CALC_SHADOW,
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2265"
|
#define VERSION_SPF "2267"
|
||||||
|
|||||||
@@ -1895,6 +1895,14 @@ int SPF_InsertPrivateFromGUI(void*& context, int winHandler, short* options, sho
|
|||||||
return simpleTransformPass(INSERT_NO_DISTR_FLAGS_FROM_GUI, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize);
|
return simpleTransformPass(INSERT_NO_DISTR_FLAGS_FROM_GUI, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SPF_RemoveDeadCode(void*& context, int winHandler, short* options, short* projName, short* folderName, short*& output,
|
||||||
|
int*& outputSize, short*& outputMessage, int*& outputMessageSize)
|
||||||
|
{
|
||||||
|
MessageManager::clearCache();
|
||||||
|
MessageManager::setWinHandler(winHandler);
|
||||||
|
return simpleTransformPass(REMOVE_DEAD_CODE_AND_UNPARSE, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void convertBackSlash(char *str, int strL)
|
static inline void convertBackSlash(char *str, int strL)
|
||||||
{
|
{
|
||||||
for (int z = 0; z < strL; ++z)
|
for (int z = 0; z < strL; ++z)
|
||||||
@@ -2607,6 +2615,8 @@ const wstring Sapfor_RunTransformation(const char* transformName_c, const char*
|
|||||||
retCode = SPF_SharedMemoryParallelization(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize);
|
retCode = SPF_SharedMemoryParallelization(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize);
|
||||||
else if (whichRun == "SPF_InsertPrivateFromGUI")
|
else if (whichRun == "SPF_InsertPrivateFromGUI")
|
||||||
retCode = SPF_InsertPrivateFromGUI(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize);
|
retCode = SPF_InsertPrivateFromGUI(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize);
|
||||||
|
else if (whichRun == "SPF_RemoveDeadCode")
|
||||||
|
retCode = SPF_RemoveDeadCode(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (showDebug)
|
if (showDebug)
|
||||||
|
|||||||
Reference in New Issue
Block a user