fixed implicit none

This commit is contained in:
ALEXks
2024-07-19 21:10:43 +03:00
parent 2e2ab128d2
commit c59ca7ccb6
10 changed files with 48 additions and 17 deletions

View File

@@ -2287,6 +2287,7 @@ static void createDeclarations(const map<SgStatement*, set<SgSymbol*>>& newSymbs
for (auto& elem : sortConstRefs(constRefs)) for (auto& elem : sortConstRefs(constRefs))
param->addConstant(elem); param->addConstant(elem);
param->setlineNumber(place->lineNumber());
place->insertStmtBefore(*param, *scope); place->insertStmtBefore(*param, *scope);
} }
@@ -2356,8 +2357,13 @@ static void createDeclarations(const map<SgStatement*, set<SgSymbol*>>& newSymbs
} }
if (newCommons.size()) if (newCommons.size())
{
for (auto& elem : newCommons) for (auto& elem : newCommons)
{
elem->setlineNumber(place->lineNumber());
place->insertStmtBefore(*elem, *scope); place->insertStmtBefore(*elem, *scope);
}
}
//insert SAVE //insert SAVE
if (saveRefs.size()) if (saveRefs.size())
@@ -2367,6 +2373,8 @@ static void createDeclarations(const map<SgStatement*, set<SgSymbol*>>& newSymbs
for (auto& s : saveRefs) for (auto& s : saveRefs)
refs.push_back(new SgVarRefExp(s.second)); refs.push_back(new SgVarRefExp(s.second));
save->setExpression(0, makeExprList(refs)); save->setExpression(0, makeExprList(refs));
save->setlineNumber(place->lineNumber());
place->insertStmtBefore(*save, *scope); place->insertStmtBefore(*save, *scope);
} }
@@ -2389,18 +2397,21 @@ static void createDeclarations(const map<SgStatement*, set<SgSymbol*>>& newSymbs
strcpy(value->thellnd->entry.string_val, dataS.c_str()); strcpy(value->thellnd->entry.string_val, dataS.c_str());
decl->setExpression(0, value); decl->setExpression(0, value);
decl->setlineNumber(place->lineNumber());
place->insertStmtBefore(*decl, *scope); place->insertStmtBefore(*decl, *scope);
} }
//insert ALLOCATABLE //insert ALLOCATABLE
if (allocatable.size()) if (allocatable.size())
{ {
SgStatement* save = new SgStatement(ALLOCATABLE_STMT); SgStatement* alloc_stat = new SgStatement(ALLOCATABLE_STMT);
vector<SgExpression*> refs; vector<SgExpression*> refs;
for (auto& s : allocatable) for (auto& s : allocatable)
refs.push_back(new SgVarRefExp(s)); refs.push_back(new SgVarRefExp(s));
save->setExpression(0, makeExprList(refs)); alloc_stat->setExpression(0, makeExprList(refs));
place->insertStmtBefore(*save, *scope);
alloc_stat->setlineNumber(place->lineNumber());
place->insertStmtBefore(*alloc_stat, *scope);
} }
} }
} }

View File

@@ -518,7 +518,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
{ {
bool res = DvmDirectiveChecker(file, dvmDirErrors, keepDvmDirectives, ignoreDvmChecker); bool res = DvmDirectiveChecker(file, dvmDirErrors, keepDvmDirectives, ignoreDvmChecker);
verifyOK &= res; verifyOK &= res;
if (dvmDirErrors.size() != 0 && ignoreDvmChecker == 0) if (dvmDirErrors.size() && ignoreDvmChecker == 0)
printDvmActiveDirsErrors(); printDvmActiveDirsErrors();
} }
else if (curr_regime == VERIFY_EQUIVALENCE) else if (curr_regime == VERIFY_EQUIVALENCE)
@@ -991,7 +991,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
else if (curr_regime == CONVERT_TO_C) else if (curr_regime == CONVERT_TO_C)
covertToC(file); covertToC(file);
else if (curr_regime == SET_IMPLICIT_NONE) else if (curr_regime == SET_IMPLICIT_NONE)
implicitCheck(file); implicitCheck(file, getObjectForFileFromMap(file_name, dvmDirErrors));
else if (curr_regime == INSERT_NO_DISTR_FLAGS_FROM_GUI) else if (curr_regime == INSERT_NO_DISTR_FLAGS_FROM_GUI)
addPrivatesToArraysFromGUI(file, declaredArrays, distrStateFromGUI); addPrivatesToArraysFromGUI(file, declaredArrays, distrStateFromGUI);
else if (curr_regime == REMOVE_DEAD_CODE) else if (curr_regime == REMOVE_DEAD_CODE)
@@ -1511,6 +1511,18 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
printParalleRegions("_parallelRegions.txt", parallelRegions); printParalleRegions("_parallelRegions.txt", parallelRegions);
} }
} }
if (curr_regime == SET_IMPLICIT_NONE)
{
size_t total_s = 0;
for (auto& err : dvmDirErrors)
total_s += err.second.size();
if (total_s && ignoreDvmChecker == 0)
{
printDvmActiveDirsErrors();
throw(-1);
}
}
else if (curr_regime == FILL_PAR_REGIONS) else if (curr_regime == FILL_PAR_REGIONS)
{ {
fillRegionIntervals(parallelRegions); fillRegionIntervals(parallelRegions);

View File

@@ -106,7 +106,7 @@ std::map<std::string, CommonBlock*> commonBlocks; // name -> commonBlock
std::map<std::string, std::vector<Messages>> SPF_messages; //file ->messages std::map<std::string, std::vector<Messages>> SPF_messages; //file ->messages
//for PARALLEL REGIONS + DVM_CHECKER //for PARALLEL REGIONS + DVM_CHECKER + SET_IMPLICIT_NONE
std::map<std::string, std::vector<int>> dvmDirErrors; // file->lines std::map<std::string, std::vector<int>> dvmDirErrors; // file->lines
// //

View File

@@ -92,6 +92,7 @@ void insertIntrinsicStat(const vector<FuncInfo*>& allFuncInfo)
SgStatement* intr = new SgStatement(INTRIN_STAT); SgStatement* intr = new SgStatement(INTRIN_STAT);
intr->setExpression(0, makeExprList(list)); intr->setExpression(0, makeExprList(list));
intr->setlineNumber(st->lineNumber());
st->insertStmtBefore(*intr, *func->funcPointer); st->insertStmtBefore(*intr, *func->funcPointer);
} }

View File

@@ -164,7 +164,8 @@ static vector<SgSymbol*> getVars(const set<string>& functionSymbs, set<SgSymbol*
return varsWithoutDecl; return varsWithoutDecl;
} }
static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map<SgStatement*, map<char, SgType*>>& typesByFunctions) static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map<SgStatement*, map<char, SgType*>>& typesByFunctions,
vector<int>& dvmDirErrorsLines)
{ {
set<SgSymbol*> allVars, allVarsConst; set<SgSymbol*> allVars, allVarsConst;
map<char, SgType*> types; map<char, SgType*> types;
@@ -238,6 +239,9 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
if (skip.count(st->variant())) if (skip.count(st->variant()))
continue; continue;
if (isDVM_stat(st))
dvmDirErrorsLines.push_back(st->lineNumber());
if (isDVM_stat(st) || isSPF_stat(st)) if (isDVM_stat(st) || isSPF_stat(st))
continue; continue;
@@ -354,7 +358,7 @@ static map<char, SgType*> FunctionImplicitCheck(SgStatement* function, const map
return types; return types;
} }
void implicitCheck(SgFile* file) void implicitCheck(SgFile* file, vector<int>& dvmDirErrorsLines)
{ {
map<SgStatement*, map<char, SgType*>> typesByFunctions; map<SgStatement*, map<char, SgType*>> typesByFunctions;
@@ -364,7 +368,7 @@ void implicitCheck(SgFile* file)
for (int func = 0; func < modulesAndFunctions.size(); ++func) for (int func = 0; func < modulesAndFunctions.size(); ++func)
{ {
SgStatement* function = modulesAndFunctions[func]; SgStatement* function = modulesAndFunctions[func];
typesByFunctions[function] = FunctionImplicitCheck(function, typesByFunctions); typesByFunctions[function] = FunctionImplicitCheck(function, typesByFunctions, dvmDirErrorsLines);
} }
typesByFunctions.clear(); typesByFunctions.clear();

View File

@@ -1,3 +1,5 @@
#pragma once #pragma once
void implicitCheck(SgFile* file); #include <vector>
void implicitCheck(SgFile* file, std::vector<int>& dvmDirErrorsLines);

View File

@@ -223,15 +223,15 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
Pass(PRIVATE_ANALYSIS_IR) <= Pass(LOOP_ANALYZER_NODIST); Pass(PRIVATE_ANALYSIS_IR) <= Pass(LOOP_ANALYZER_NODIST);
Pass(CORRECT_VAR_DECL) <= list({ VERIFY_DVM_DIRS, PREPROC_SPF, VERIFY_ENDDO, VERIFY_INCLUDE, PREPROC_ALLOCATES, CHECK_FUNC_TO_INCLUDE, FILL_PAR_REGIONS_LINES, CONVERT_ASSIGN_TO_LOOP, VERIFY_COMMON, VERIFY_EQUIVALENCE, PRINT_PAR_REGIONS_ERRORS, VERIFY_OPERATORS, VERIFY_FORMAT }) <= Pass(CODE_CHECKER_PASSES); Pass(CORRECT_VAR_DECL) <= list({ VERIFY_DVM_DIRS, VERIFY_OPERATORS, VERIFY_FORMAT, VERIFY_ENDDO, PREPROC_SPF, VERIFY_INCLUDE, PREPROC_ALLOCATES, CHECK_FUNC_TO_INCLUDE, FILL_PAR_REGIONS_LINES, CONVERT_ASSIGN_TO_LOOP, VERIFY_COMMON, VERIFY_EQUIVALENCE, PRINT_PAR_REGIONS_ERRORS }) <= Pass(CODE_CHECKER_PASSES);
list({ VERIFY_ENDDO, VERIFY_INCLUDE, PREPROC_SPF, PREPROC_ALLOCATES, GET_ALL_ARRAY_DECL, GCOV_PARSER }) <= list({ CALL_GRAPH, MACRO_EXPANSION, DEF_USE_STAGE1 }); list({ VERIFY_OPERATORS, VERIFY_ENDDO, VERIFY_INCLUDE, PREPROC_SPF, PREPROC_ALLOCATES, GET_ALL_ARRAY_DECL, GCOV_PARSER }) <= list({ CALL_GRAPH, MACRO_EXPANSION, DEF_USE_STAGE1 });
list({ VERIFY_ENDDO, VERIFY_INCLUDE, PREPROC_ALLOCATES, FILL_PARALLEL_REG_IR }) <= list({ GET_ALL_ARRAY_DECL, FILL_COMMON_BLOCKS, PARSE_OMP_DIRS }) <= Pass(PREPROC_SPF); list({ VERIFY_OPERATORS, VERIFY_ENDDO, VERIFY_INCLUDE, PREPROC_ALLOCATES, FILL_PARALLEL_REG_IR }) <= list({ GET_ALL_ARRAY_DECL, FILL_COMMON_BLOCKS, PARSE_OMP_DIRS }) <= Pass(PREPROC_SPF);
Pass(CHECK_PAR_REG_DIR) <= Pass(FILL_PARALLEL_REG_IR); Pass(CHECK_PAR_REG_DIR) <= Pass(FILL_PARALLEL_REG_IR);
list({ GET_ALL_ARRAY_DECL, CALL_GRAPH2, CODE_CHECKER_PASSES, SUBST_EXPR_RD, ARRAY_ACCESS_ANALYSIS_FOR_CORNER }) <= list({ LOOP_ANALYZER_NODIST, LOOP_ANALYZER_DATA_DIST_S0, LOOP_ANALYZER_DATA_DIST_S1, ONLY_ARRAY_GRAPH }); list({ CODE_CHECKER_PASSES, GET_ALL_ARRAY_DECL, CALL_GRAPH2, SUBST_EXPR_RD, ARRAY_ACCESS_ANALYSIS_FOR_CORNER }) <= list({ LOOP_ANALYZER_NODIST, LOOP_ANALYZER_DATA_DIST_S0, LOOP_ANALYZER_DATA_DIST_S1, ONLY_ARRAY_GRAPH });
list({ LOOP_ANALYZER_NODIST, REMOVE_OMP_DIRS }) <= Pass(INSERT_PARALLEL_DIRS_NODIST); list({ LOOP_ANALYZER_NODIST, REMOVE_OMP_DIRS }) <= Pass(INSERT_PARALLEL_DIRS_NODIST);
@@ -239,7 +239,7 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
Pass(LOOP_ANALYZER_DATA_DIST_S0) <= Pass(LOOP_ANALYZER_DATA_DIST_S1) <= Pass(LOOP_ANALYZER_DATA_DIST_S2) <= Pass(CREATE_TEMPLATE_LINKS) <= Pass(LOOP_ANALYZER_COMP_DIST); Pass(LOOP_ANALYZER_DATA_DIST_S0) <= Pass(LOOP_ANALYZER_DATA_DIST_S1) <= Pass(LOOP_ANALYZER_DATA_DIST_S2) <= Pass(CREATE_TEMPLATE_LINKS) <= Pass(LOOP_ANALYZER_COMP_DIST);
list({ VERIFY_ENDDO, VERIFY_FORMAT, SUBST_EXPR_RD, CONVERT_ASSIGN_TO_LOOP }) <= Pass(LOOP_GRAPH) <= Pass(CALL_GRAPH) <= Pass(CALL_GRAPH2); list({ VERIFY_OPERATORS, VERIFY_ENDDO, VERIFY_FORMAT, SUBST_EXPR_RD, CONVERT_ASSIGN_TO_LOOP }) <= Pass(LOOP_GRAPH) <= Pass(CALL_GRAPH) <= Pass(CALL_GRAPH2);
Pass(MACRO_EXPANSION) <= Pass(CALL_GRAPH); Pass(MACRO_EXPANSION) <= Pass(CALL_GRAPH);

View File

@@ -2724,7 +2724,7 @@ SgStatement* makeDeclaration(SgStatement* curr, const vector<SgSymbol*>& sIn, ve
decl->setFileName(place->fileName()); decl->setFileName(place->fileName());
decl->setFileId(place->getFileId()); decl->setFileId(place->getFileId());
decl->setProject(place->getProject()); decl->setProject(place->getProject());
decl->setlineNumber(getNextNegativeLineNumber()); decl->setlineNumber(place->lineNumber());
place->insertStmtBefore(*decl, *scope); place->insertStmtBefore(*decl, *scope);
} }

View File

@@ -1190,6 +1190,7 @@ objT& getObjectForFileFromMap(const char *fileName, map<string, objT> &mapObject
return it->second; return it->second;
} }
template vector<int>& getObjectForFileFromMap(const char* fileName, map<string, vector<int>>&);
template vector<Messages>& getObjectForFileFromMap(const char *fileName, map<string, vector<Messages>>&); template vector<Messages>& getObjectForFileFromMap(const char *fileName, map<string, vector<Messages>>&);
template vector<LoopGraph*>& getObjectForFileFromMap(const char *fileName, map<string, vector<LoopGraph*>>&); template vector<LoopGraph*>& getObjectForFileFromMap(const char *fileName, map<string, vector<LoopGraph*>>&);
template vector<FuncInfo*>& getObjectForFileFromMap(const char *fileName, map<string, vector<FuncInfo*>>&); template vector<FuncInfo*>& getObjectForFileFromMap(const char *fileName, map<string, vector<FuncInfo*>>&);

View File

@@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION_SPF "2352" #define VERSION_SPF "2355"