Files
SAPFOR/src/SapforData.h

183 lines
6.7 KiB
C++

#pragma once
#include <cstdint>
#include <vector>
#include <map>
#include <set>
#include <string>
#include "ParallelizationRegions/ParRegions.h"
#include "Distribution/Array.h"
#include "GraphCall/graph_calls.h"
#include "GraphLoop/graph_loops.h"
#include "Utils/AstWrapper.h"
#include "DynamicAnalysis/gcov_info.h"
#include "Sapfor.h"
#include "Utils/errors.h"
#include "DynamicAnalysis/createParallelRegions.h"
extern std::map<std::string, std::string> shortFileNames;
static int activeState = 0;
int staticShadowAnalysis = 0;
int staticPrivateAnalysis = 0;
int keepDvmDirectives = 0;
int keepFiles = 0;
int keepSpfDirs = 0;
int predictOn = 0;
//int consoleMode = 0; moved to utils.cpp
int genAllVars = 0; //generate ALL distribution variants
int genSpecificVar = -1; //generate specific distribution variant
int ignoreDvmChecker = 0; // temporary flag
int automaticDeprecateArrays = 0; // automatic change DIST status to NON_DIST of Array
int maxShadowWidth = 50; // in percent
int intervals_threshold = 100; // threshold for intervals
bool removeNestedIntervals = false; // nested intervals removal flag
int langOfMessages = 1; // 0 - ENG, 1 - RUS
int parallizeFreeLoops = 0; // parallize free calculations
int sharedMemoryParallelization = 0; // detected mpi calls
int ignoreIO = 0; // ignore io checker for arrays (DVM IO limitations)
int parseForInlining = 0; // special regime for files parsing for inliner
int dumpIR = 0; // allow dump IR after BUILD_IR pass
int dumpRD = 0; // allow dump RD with IR after BUILD_IR pass
int dumpLive = 0; // allow dump live variables after LIVE_VARIABLE_ANALYSIS pass
int debSh = 0; // shadow optimization debugging
bool ignoreArrayDistributeState = false;
bool fullDepGraph = false;
bool noLogo = false;
bool withTemplateInfo = false;
bool inlcudeAllFiles = false; // for pass INSERT_INLCUDES
bool runAsClient = false; // run console project as client for Visualizer
bool printSymbTable = false;
uint64_t currentAvailMemory = 0;
int QUALITY; // quality of conflicts search in graph
int SPEED; // speed of conflicts search in graph
std::map<DIST::Array*, std::tuple<int, std::string, std::string>> tableOfUniqNamesByArray;
std::vector<ParallelRegion*> parallelRegions;
std::map<std::pair<std::string, int>, std::set<SgStatement*>> usersDirectives;
// for LOOP_ANALYZER_DATA_DIST
std::map<std::tuple<int, std::string, std::string>, DIST::Array*> createdArrays;
std::map<std::tuple<int, std::string, std::string>, std::pair<DIST::Array*, DIST::ArrayAccessInfo*>> declaredArrays;
std::map<SgStatement*, std::set<std::tuple<int, std::string, std::string>>> declaratedArraysSt; // St -> set<KEY>
//for CALL_GRAPH
std::map<std::string, std::vector<FuncInfo*>> allFuncInfo; // file -> Info
std::map<DIST::Array*, std::set<DIST::Array*>> arrayLinksByFuncCalls;
//
//for LOOP_GRAPH
std::map<std::string, std::vector<LoopGraph*>> loopGraph; // file -> Info
std::map<LoopGraph*, depGraph*> depInfoForLoopGraph;
//
//for directive creator
std::map<std::string, std::vector<Directive*>> createdDirectives; //file -> directive to insert
//
//for directive inserter
std::map<std::string, std::map<int, std::set<std::string>>> commentsToInclude;
//
//for INSERT_INCLUDES
std::map<std::string, std::map<int, std::set<std::string>>> filesToInclude; // file -> includes [nearest line, include]
//
//for PASSES DEPENDENSIES
std::map<passes, std::vector<passes>> passesDependencies;
std::set<passes> passesIgnoreStateDone;
//
//for files info
std::map<std::string, int> lineInfo; // file -> lines count
std::map<std::string, std::pair<std::set<int>, std::set<int>>> dirsInfo; // file -> dirs <lines SPF, lines DVM> count
std::map<std::string, std::map<int, std::set<std::string>>> includeDependencies; // file -> includes [nearest line, include]
std::vector<std::string> filesCompilationOrder; // order of files for unite to one file
std::map<std::string, std::map<SgStatement*, std::vector<SgStatement*>>> exctactedModuleStats; // file -> hided excluded modules
//
//for FILL_COMMON_BLOCKS
std::map<std::string, CommonBlock*> commonBlocks; // name -> commonBlock
//
std::map<std::string, std::vector<Messages>> SPF_messages; //file ->messages
//for PARALLEL REGIONS + DVM_CHECKER + SET_IMPLICIT_NONE
std::map<std::string, std::vector<int>> dvmDirErrors; // file->lines
//
//for RESOLVE PARALLEL REGIONS
std::map<std::string, std::map<int, std::set<std::string>>> newCopyDeclToIncl; // file->[line, newDecls]
//
//for DEF USE
std::map<std::string, vector<DefUseList>> defUseByFunctions;
//
//for EXPR SUBSTITUTION and IR
std::map<std::string, std::vector<FuncInfo*>> allFuncInfo_IR; // file -> Info
map<FuncInfo*, vector<SAPFOR::BasicBlock*>> fullIR; // function -> basic blocks
std::vector<ParallelRegion*> subs_parallelRegions;
//
//for predictior statistic
std::map<std::string, PredictorStats> allPredictorStats;
//for DVM INTERVALS
std::map<std::string, std::vector<SpfInterval*>> intervals; // file -> intervals
std::vector<std::vector<long>> topologies; // current topologies
//
//for GCOV_PARSER
std::map<std::string, std::map<int, Gcov_info>> gCovInfo; // file -> [lines, info]
//
//for SPF CHANGING
std::tuple<std::string, int, int, int> inData; // file, startLine, endLine, del/add
std::map<std::string, std::string> outData; // file -> new unparsed text
//
//for SPF INLINE PROCEDURES
std::vector<std::tuple<std::string, std::string, int>> inDataProc; // [<proc, file, line>]
std::map<std::string, std::set<std::pair<std::string, int>>> inDataChains;
std::set<std::string> inDataChainsStart;
std::map<std::string, std::vector<SgStatement*>> hiddenData; // [<file -> all hidden stmts]
//
//module includes across all files, need to correct lines and out versions
std::map<std::string, std::set<std::string>> moduleUsesByFile; // file -> use module name
std::map<std::string, std::string> moduleDecls; // module -> file where declared
//
//for LOOPS_COMBINER
std::pair<std::string, int> inOnlyForloopOnPlace;
//
//cache for declaration arrays state switching
std::map<std::string, int> distrStateFromGUI;
//
//for PROCESS_IO
std::map<int, UserFiles> filesInfo; // information about open,close,write and read statements
//
//for FIND_PARAMETERS
std::set<std::tuple<std::string, int, std::string>> parametersOfProject; // [file, line, varname]
//
//for GET_MIN_MAX_BLOCK_DIST
std::pair<int, int> min_max_block = std::make_pair(-1, -1);
//
const char* passNames[EMPTY_PASS + 1];
const char* optionNames[EMPTY_OPTION + 1];
bool passNamesWasInit = false;
std::map<PTR_BFND, std::pair<std::string, int>> sgStats;
std::map<PTR_LLND, std::pair<std::string, int>> sgExprs;