#pragma once #include "dvm.h" #include "utils.h" #include "../Distribution/Distribution.h" #include "../GraphCall/graph_calls.h" #include "../DynamicAnalysis/gcov_info.h" #include "module_utils.h" SgStatement* declaratedInStmt(SgSymbol *toFind, std::vector *allDecls = NULL, bool printInternal = true, SgStatement* scope = NULL); #include "DefUseList.h" #include "CommonBlock.h" std::string removeIncludeStatsAndUnparse(SgFile *file, const char *fileName, const char *fout, std::set &allIncludeFiles, bool outFree, const std::map> &moduleUsesByFile, const std::map& moduleDelcs, const std::map>& exctactedModuleStats, bool toString, bool renameIncludes, bool dontReplaceIncls); SgSymbol* findSymbolOrCreate(SgFile *file, const std::string toFind, SgType *type = NULL, SgStatement *scope = NULL); void recExpressionPrint(SgExpression *exp); void removeSubstrFromStr(std::string &str, const std::string &del); void tryToFindPrivateInAttributes(SgStatement* st, std::set& privatesVars, bool onlyReduction = false, bool onlyUsers = false); void fillNonDistrArraysAsPrivate(SgStatement *st, const std::map, std::pair> &declaredArrays, const std::map>> &declaratedArraysSt, std::set &privatesVars); DIST::Array* getArrayFromDeclarated(SgStatement *st, const std::string &arrayName); void initTags(); bool isDVM_stat(SgStatement *st); bool isSPF_stat(SgStatement *st); bool isEqExpressions(SgExpression *left, SgExpression *right, std::map &collection); void getCommonBlocksRef(std::map> &commonBlocks, SgStatement *start, SgStatement *end, const std::string *nameToSkip = NULL); int checkCommonInMainUnit(SgProject& project, std::map>& SPF_messages, const std::set& arrays, bool forDistrbuted); std::tuple getFromUniqTable(SgSymbol *symb); std::tuple getUniqName(const std::map> &commonBlocks, SgStatement *decl, SgSymbol *symb); SgStatement* findMainUnit(SgProject *proj, std::map>& SPF_messages); template const std::vector getAttributes(IN_TYPE st, const std::set dataType); template void deleteAttributes(IN_TYPE st, const std::set dataType); void constructDefUseStep1(SgFile *file, std::map> &defUseByFunctions, std::map> &allFuncInfo, std::vector &messages); void constructDefUseStep2(SgFile *file, std::map> &defUseByFunctions); std::set getAllDefVars(const std::string &funcName); std::set getAllUseVars(const std::string &funcName); const std::vector& getAllDefUseVarsList(const std::string &funcName); const std::vector getAllDefUseVarsList(const std::string &funcName, const std::string varName); int printDefUseSets(const char *fileName, const std::map> &defUseLists); int printCommonBlocks(const char *fileName, const std::map &commonBlocks); void groupDeclarations(SgFile *file); bool ifSymbolExists(SgFile *file, const std::string &symbName); int checkSymbNameAndCorrect(const std::string& symbName, int complite); std::string checkSymbNameAndCorrect(const std::string& symbName, const std::string complite = "_"); const CommonBlock* isArrayInCommon(const std::map &commonBlocks, const DIST::Array *array); std::vector fillArraysFromDir(Statement *st); void printSymbolTable(SgFile* file, std::string filter = "", const std::set& vars = {}); SgStatement* getFuncStat(SgStatement *st, const std::set additional = std::set()); std::map> createDefUseMapByPlace(); SgStatement* duplicateProcedure(SgStatement* toDup, const std::string* newName, bool withAttributes = false, bool withComment = false, bool withSameLines = true, bool dontInsert = false); SgExpression* makeExprList(const std::vector& items, bool withSort = true); std::string unparseProjectToString(SgFile* file, const int curr_regime); SgStatement* makeDeclaration(SgStatement* curr, const std::vector& s, std::vector* inits = NULL); std::vector makeDeclaration(const std::vector& symbolsToDeclare, SgStatement* where, std::vector* inits = NULL); int getNextFreeLabel(); void fillVisibleInUseVariables(SgStatement *useSt, std::map &vars); std::string preprocDataString(std::string data, bool full = true); std::map splitData(const std::set& dataStats); void extractComments(SgStatement* where, const std::string& what); void getVariables(SgExpression* ex, std::set& variables, const std::set variants); void getVariables(SgExpression* ex, std::set& variables, const std::set variants); template std::set getAllVariables(SgStatement* stFrom, SgStatement* stTo, const std::set& variants); SgProject* createProject(const char* proj_name, std::vector& parallelRegions, std::vector& subs_parallelRegions, std::map>& hiddenData, std::map& filesNameWithoutExt, std::map>& moduleUsesByFile, std::map& moduleDecls, std::map>>& exctactedModuleStats, bool printSymbTable); bool isArrayType(SgType* type); bool isArrayRef(SgExpression* ex); bool isStringArrayType(SgType* type); void moveLabelBefore(SgStatement* st, SgStatement* next = NULL); bool isEqSymbols(SgSymbol* sym1, SgSymbol* sym2); std::set getAllFilesInProject(); void LogIftoIfThen(SgStatement* stmt); void removeSpecialCommentsFromProject(SgFile* file); void getMaxMinBlockDistribution(SgFile* file, std::pair& min_max); void addPrivatesToArraysFromGUI(SgFile* file, const std::map, std::pair>& declaredArrays, const std::map& distrStateFromGUI); void shiftLines(SgProject* project, bool print = true); template static inline std::multimap setToMapWithSortByStr(const std::set& setIn) { std::multimap retMap; for (auto& elem : setIn) retMap.insert(make_pair(elem->identifier(), elem)); return retMap; }