improved and fixed FDVM, added ISNERT_INCLUDES pass

This commit is contained in:
ALEXks
2023-12-16 17:42:11 +03:00
parent 110970caa6
commit 1f3d9944b8
10 changed files with 613 additions and 775 deletions

View File

@@ -2532,7 +2532,10 @@ void ACC_ParallelLoopEnd(SgStatement *pardo)
} }
if (options.isOn(LOOP_ANALYSIS)) if (options.isOn(LOOP_ANALYSIS))
{
delete currentLoop; delete currentLoop;
currentLoop = NULL;
}
} }
if (options.isOn(RTC)) if (options.isOn(RTC))

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,12 @@
#include "dvm.h" #include "dvm.h"
#include "aks_structs.h" #include "aks_structs.h"
#include <vector>
#include <map>
#include <string>
using std::vector;
using std::string;
using std::map;
#define DEBUG_LV1 true #define DEBUG_LV1 true
#if 1 #if 1
@@ -16,22 +23,20 @@ SgExpression* findDirect(SgExpression *inExpr, int DIR)
if (inExpr) if (inExpr)
{ {
if (inExpr->variant() == DIR) if (inExpr->variant() == DIR)
{
return inExpr; return inExpr;
}
else else
{ {
if (inExpr->lhs()) if (inExpr->lhs())
temp = findDirect(inExpr->lhs(), DIR); temp = findDirect(inExpr->lhs(), DIR);
if(temp == NULL && inExpr->rhs()) if(temp == NULL && inExpr->rhs())
temp = findDirect(inExpr->rhs(), DIR); temp = findDirect(inExpr->rhs(), DIR);
} }
} }
return temp; return temp;
} }
static SgSymbol** fillDataOfArray(SgExpression* on, int& dimInPar) static vector<SgSymbol*> fillDataOfArray(SgExpression* on, int& dimInPar)
{ {
dimInPar = 0; dimInPar = 0;
SgExpression* temp = on; SgExpression* temp = on;
@@ -40,7 +45,8 @@ static SgSymbol** fillDataOfArray(SgExpression* on, int& dimInPar)
dimInPar++; dimInPar++;
temp = temp->rhs(); temp = temp->rhs();
} }
SgSymbol** symbInPar = new SgSymbol * [dimInPar];
vector<SgSymbol*> symbInPar(dimInPar);
temp = on; temp = on;
for (int i = 0; i < dimInPar; ++i) for (int i = 0; i < dimInPar; ++i)
{ {
@@ -50,20 +56,20 @@ static SgSymbol** fillDataOfArray(SgExpression* on, int& dimInPar)
return symbInPar; return symbInPar;
} }
SageArrayIdxs* GetIdxInParDir(const std::map<std::string, SgExpression*>& on, SgExpression *across, bool tie = false) static void printError()
{ {
SageArrayIdxs *ret = new SageArrayIdxs(); err("internal error in across", 424, first_do_par);
SageArrayIdxs *act = ret; exit(-1);
int allDim = 0; }
int dimInPar = 0;
SgSymbol** symbInPar = NULL; static vector<SageArrayIdxs> GetIdxInParDir(const map<string, SgExpression*>& on, SgExpression *across, bool tie = false)
ret->next = NULL; {
ret->array_expr = NULL; vector<SageArrayIdxs> ret;
ret->read_write = -1;
ret->dim = 0; int dimInPar = 0;
ret->symb = NULL; vector<SgSymbol*> symbInPar;
vector<SgExpression*> toAnalyze;
std::vector<SgExpression*> toAnalyze;
if (across->lhs()->variant() == EXPR_LIST) if (across->lhs()->variant() == EXPR_LIST)
toAnalyze.push_back(across->lhs()); toAnalyze.push_back(across->lhs());
else else
@@ -80,15 +86,12 @@ SageArrayIdxs* GetIdxInParDir(const std::map<std::string, SgExpression*>& on, Sg
across = toAnalyze[i]; across = toAnalyze[i];
while (across) while (across)
{ {
if (symbInPar == NULL) if (symbInPar.size() == 0)
{ {
if (on.size() == 0) if (on.size() == 0)
{ printError();
fprintf(stderr, "internal error in across convertion for GPU\n");
exit(-1);
}
else if (on.size() == 1) else if (on.size() == 1)
symbInPar = fillDataOfArray(on.begin()->second, dimInPar); symbInPar = fillDataOfArray(on.begin()->second, dimInPar);
} }
SgExpression *t = across->lhs(); SgExpression *t = across->lhs();
@@ -99,20 +102,14 @@ SageArrayIdxs* GetIdxInParDir(const std::map<std::string, SgExpression*>& on, Sg
if (t->variant() == ARRAY_REF) if (t->variant() == ARRAY_REF)
{ {
if (on.find(t->symbol()->identifier()) == on.end()) if (on.find(t->symbol()->identifier()) == on.end())
{ printError();
fprintf(stderr, "internal error in across convertion for GPU\n");
exit(-1);
}
else else
symbInPar = fillDataOfArray(on.find(t->symbol()->identifier())->second, dimInPar); symbInPar = fillDataOfArray(on.find(t->symbol()->identifier())->second, dimInPar);
} }
else if (t->variant() == ARRAY_OP) else if (t->variant() == ARRAY_OP)
{ {
if (on.find(t->lhs()->symbol()->identifier()) == on.end()) if (on.find(t->lhs()->symbol()->identifier()) == on.end())
{ printError();
fprintf(stderr, "internal error in across convertion for GPU\n");
exit(-1);
}
else else
symbInPar = fillDataOfArray(on.find(t->lhs()->symbol()->identifier())->second, dimInPar); symbInPar = fillDataOfArray(on.find(t->lhs()->symbol()->identifier())->second, dimInPar);
} }
@@ -134,53 +131,50 @@ SageArrayIdxs* GetIdxInParDir(const std::map<std::string, SgExpression*>& on, Sg
dim++; dim++;
tmp = tmp->rhs(); tmp = tmp->rhs();
} }
act->next = new SageArrayIdxs();
act = act->next; SageArrayIdxs act;
act->next = NULL;
act->symb = new SageSymbols*[dim]; act.symb.resize(dim);
act->dim = dim; act.dim = dim;
for (int i = 0; i < dim; ++i) for (int i = 0; i < dim; ++i)
{ {
act->symb[i] = new SageSymbols(); act.symb[i].across_left = t->lhs()->lhs()->valueInteger();
act->symb[i]->across_left = t->lhs()->lhs()->valueInteger(); act.symb[i].across_right = t->lhs()->rhs()->valueInteger();
act->symb[i]->across_right = t->lhs()->rhs()->valueInteger(); if (act.symb[i].across_left != 0 || act.symb[i].across_right != 0)
if (act->symb[i]->across_left != 0 || act->symb[i]->across_right != 0) act.symb[i].symb = symbInPar[i];
act->symb[i]->symb = symbInPar[i];
else if (i < dimInPar) else if (i < dimInPar)
act->symb[i]->symb = symbInPar[i]; act.symb[i].symb = symbInPar[i];
else else
act->symb[i]->symb = NULL; act.symb[i].symb = NULL;
act->symb[i]->next = NULL;
t = t->rhs(); t = t->rhs();
} }
allDim++; ret.push_back(act);
across = across->rhs(); across = across->rhs();
} }
} }
ret->dim = allDim;
return ret; return ret;
} }
SageAcrossInfo* GetLoopsWithParAndAcrDir() SageAcrossInfo GetLoopsWithParAndAcrDir()
{ {
SageAcrossInfo *q = NULL; SageAcrossInfo retVal;
SgStatement *temp = dvm_parallel_dir; SgStatement *temp = dvm_parallel_dir;
if (temp->variant() == DVM_PARALLEL_ON_DIR) if (temp->variant() == DVM_PARALLEL_ON_DIR)
{ {
SgExpression *t = findDirect(temp->expr(1), ACROSS_OP); SgExpression *t = findDirect(temp->expr(1), ACROSS_OP);
SgExpression *tie = findDirect(temp->expr(1), ACC_TIE_OP); SgExpression *tie = findDirect(temp->expr(1), ACC_TIE_OP);
std::map<std::string, SgExpression*> arrays; map<string, SgExpression*> arrays;
if (t != NULL) if (t != NULL)
{ {
q = new SageAcrossInfo();
if (temp->expr(0) && temp->expr(0)->lhs()) if (temp->expr(0) && temp->expr(0)->lhs())
{ {
arrays[temp->expr(0)->symbol()->identifier()] = temp->expr(0)->lhs(); arrays[temp->expr(0)->symbol()->identifier()] = temp->expr(0)->lhs();
q->idx = GetIdxInParDir(arrays, t); retVal.idxs = GetIdxInParDir(arrays, t);
} }
else if (tie) else if (tie)
{ {
SgExpression* list = tie->lhs(); SgExpression* list = tie->lhs();
@@ -189,34 +183,24 @@ SageAcrossInfo* GetLoopsWithParAndAcrDir()
arrays[list->lhs()->symbol()->identifier()] = list->lhs()->lhs(); arrays[list->lhs()->symbol()->identifier()] = list->lhs()->lhs();
list = list->rhs(); list = list->rhs();
} }
q->idx = GetIdxInParDir(arrays, t, true); retVal.idxs = GetIdxInParDir(arrays, t, true);
} }
else else
{ printError();
fprintf(stderr, "internal error in across convertion for GPU\n");
exit(-1);
}
q->next = NULL;
} }
} }
return q; return retVal;
} }
SageSymbols *GetSymbInParalell(int *n, SgExpression *first) vector<SageSymbols> GetSymbInParalell(SgExpression *first)
{ {
SageSymbols *retval; vector<SageSymbols> retval;
SageSymbols *p_t = new SageSymbols();
retval = p_t;
while(first) while(first)
{ {
SageSymbols *q = new SageSymbols(); SageSymbols q(first->lhs()->symbol(), -1, 0, 0);
q->len = -1; retval.push_back(q);
q->next = NULL;
q->symb = first->lhs()->symbol();
p_t->next = q;
p_t = q;
n[0]++;
first = first->rhs(); first = first->rhs();
} }
return retval->next; return retval;
} }

View File

@@ -4757,7 +4757,7 @@ void RedistributeArray(SgSymbol *das, int idisars, SgExpression *distr_rule_list
if_st = doIfThenConstrForRedis(headref_flag,stdis,iamv); /*08.05.17*/ if_st = doIfThenConstrForRedis(headref_flag,stdis,iamv); /*08.05.17*/
where = end_if = if_st->lexNext()->lexNext(); // reffer to ENDIF statement where = end_if = if_st->lexNext()->lexNext(); // reffer to ENDIF statement
i1 = ndvm; i1 = ndvm;
if(ACC_program) /*ACC*/ if(ACC_program || parloop_by_handler) /*ACC*/
where->insertStmtBefore(*Redistribute_H(headref,sign),*where->controlParent()); where->insertStmtBefore(*Redistribute_H(headref,sign),*where->controlParent());
amvref = (ia & TEMPLATE_BIT) ? headref : GetAMView( headref); amvref = (ia & TEMPLATE_BIT) ? headref : GetAMView( headref);
//inserting after ELSE //inserting after ELSE
@@ -4838,7 +4838,7 @@ void RedistributeArray(SgSymbol *das, int idisars, SgExpression *distr_rule_list
else { else {
SgExpression *amvref; SgExpression *amvref;
if(ACC_program) /*ACC*/ if(ACC_program || parloop_by_handler) /*ACC*/
where->insertStmtBefore(*Redistribute_H(headref,sign),*where->controlParent()); where->insertStmtBefore(*Redistribute_H(headref,sign),*where->controlParent());
amvref = (ia & TEMPLATE_BIT) ? headref : GetAMView( headref); amvref = (ia & TEMPLATE_BIT) ? headref : GetAMView( headref);
@@ -5108,7 +5108,7 @@ void RealignArray(SgSymbol *als, SgSymbol *tgs, int iaxis, int nr, SgExpression
return; return;
} }
iamv = ndvm; iamv = ndvm;
if(ACC_program ) /*ACC*/ if(ACC_program || parloop_by_handler) /*ACC*/
{ if( !(ia & POSTPONE_BIT) ) { if( !(ia & POSTPONE_BIT) )
doCallAfter(Realign_H(HeaderRef(als),new_sign)); doCallAfter(Realign_H(HeaderRef(als),new_sign));
else { else {

View File

@@ -2668,7 +2668,7 @@ SgStatement *RTL_GPU_Init()
SgCallStmt *call = new SgCallStmt(*fdvm[DVMH_INIT]); SgCallStmt *call = new SgCallStmt(*fdvm[DVMH_INIT]);
fmask[DVMH_INIT] = 2; fmask[DVMH_INIT] = 2;
call -> addArg(*DVM000(ndvm)); call -> addArg(*DVM000(ndvm));
if(!only_debug && ACC_program) if(!only_debug && (ACC_program || parloop_by_handler))
call -> addComment(OpenMpComment_InitFlags(ndvm)); call -> addComment(OpenMpComment_InitFlags(ndvm));
int flag = 1; int flag = 1;

View File

@@ -282,7 +282,7 @@ void EndOfParallelLoopNest(SgStatement *stmt, SgStatement *end_stmt, SgStatement
ConsistentArraysStart(cons_list); ConsistentArraysStart(cons_list);
if(iconsg) {//there is synchronous CONSISTENT clause in PARALLEL if(iconsg) {//there is synchronous CONSISTENT clause in PARALLEL
if(IN_COMPUTE_REGION || parloop_by_handler) /*ACC*/ if(IN_COMPUTE_REGION) /*ACC*/
// generating call statement: // generating call statement:
// call dvmh_handle_consistent(ConsistGroupRef) // call dvmh_handle_consistent(ConsistGroupRef)
doCallAfter(HandleConsistent(consgref)); doCallAfter(HandleConsistent(consgref));
@@ -2227,6 +2227,8 @@ SgExpression *MappingList(SgStatement *stmt, SgExpression *aref)
(el = new SgExprListExp(*e))->setRhs(arglist); (el = new SgExprListExp(*e))->setRhs(arglist);
arglist = el; arglist = el;
} }
(el = new SgExprListExp(*ConstRef(nt)))->setRhs(arglist); // add rank to axis list
arglist = el;
return arglist; return arglist;
} }

View File

@@ -1,80 +1,65 @@
#pragma once #pragma once
#include "acc_data.h" #include "acc_data.h"
struct SageStOp
{
SgForStmt *loop_op;
SgStatement *comment_op;
SageStOp *inner_loops;
SageStOp *next;
int count_inner_loops;
int line_code;
int numChList1;
int numChList2;
int depth;
int LoopNest;
};
struct SageSymbols struct SageSymbols
{ {
SgSymbol *symb; SageSymbols()
int len; {
SageSymbols *next; across_left = across_right = 0;
int across_left; len = -1;
int across_right; symb = NULL;
}
SageSymbols(SgSymbol* symb, int len, int across_left, int across_right) :
symb(symb), len(len), across_left(across_left), across_right(across_right)
{ }
SgSymbol *symb;
int len;
int across_left;
int across_right;
}; };
struct SageArrayIdxs struct SageArrayIdxs
{ {
SageSymbols **symb; std::vector<SageSymbols> symb;
int dim; int dim;
int read_write; int read_write;
SgExpression *array_expr; SgExpression *array_expr;
SageArrayIdxs *next;
};
struct Templates
{
SageSymbols *first;
int count;
int read_write;
int count_write_read;
Templates *next;
}; };
struct SageAcrossInfo struct SageAcrossInfo
{ {
SageStOp *Op; std::vector<SageArrayIdxs> idxs;
SageArrayIdxs *idx;
SageAcrossInfo *next;
}; };
struct ArgsForKernel struct ArgsForKernel
{ {
SgStatement *st_header; SgStatement *st_header;
std::list<SageSymbols*> symb; std::vector<SageSymbols> symb;
std::list<SageSymbols*> nSymb; std::vector<SageSymbols> nSymb;
std::list<SgSymbol*> sizeVars; std::vector<SgSymbol*> sizeVars;
std::list<SgSymbol*> acrossS; std::vector<SgSymbol*> acrossS;
std::list<SgSymbol*> notAcrS; std::vector<SgSymbol*> notAcrossS;
std::list<SgSymbol*> idxAcross; std::vector<SgSymbol*> idxAcross;
std::list<SgSymbol*> idxNotAcross; std::vector<SgSymbol*> idxNotAcross;
std::vector<SgSymbol*> otherVars;
std::vector<char*> arrayNames; std::vector<SgSymbol*> otherVars;
std::vector<SgSymbol*> otherVarsForOneTh; std::vector<char*> arrayNames;
std::vector<SgSymbol*> baseIdxsInKer; std::vector<SgSymbol*> otherVarsForOneTh;
SgSymbol *cond_; std::vector<SgSymbol*> baseIdxsInKer;
std::vector<SgSymbol*> steps; SgSymbol *cond_;
std::vector<SgSymbol*> steps;
}; };
/*struct GetXYInfo /*struct GetXYInfo
{ {
std::vector<SgExpression*> AllExp; std::vector<SgExpression*> AllExp;
SgSymbol *varName; SgSymbol *varName;
char *arrayName; char *arrayName;
long type; long type;
int placeF; int placeF;
int placeS; int placeS;
};*/ };*/
@@ -91,133 +76,132 @@ void getIdxs(char*, int&, int&);
struct ParamsForAllVariants struct ParamsForAllVariants
{ {
SgSymbol *s_adapter; SgSymbol *s_adapter;
SgSymbol *s_kernel_symb; SgSymbol *s_kernel_symb;
int loopV; int loopV;
int acrossV; int acrossV;
int allDims; int allDims;
SageSymbols **loopSymb; std::vector<SageSymbols> loopSymb;
SageSymbols **loopAcrossSymb; std::vector<SageSymbols> loopAcrossSymb;
char *nameOfNewSAdapter; char *nameOfNewSAdapter;
char *nameOfNewKernelSymb; char *nameOfNewKernelSymb;
int type; int type;
}; };
struct Bound struct Bound
{ {
int L; int L;
int R; int R;
bool exL; bool exL;
bool exR; bool exR;
bool ifDdot; bool ifDdot;
SgExpression *additionalExpr; SgExpression *additionalExpr;
}; };
struct BestPattern struct BestPattern
{ {
std::vector<int> what; std::vector<int> what;
std::vector<Bound> bounds; std::vector<Bound> bounds;
SgExpression *bestPatt; SgExpression *bestPatt;
int count_of_pattern; int count_of_pattern;
}; };
struct Pattern struct Pattern
{ {
int count_read_op; int count_read_op;
int count_write_op; int count_write_op;
SgExpression *symbs; SgExpression *symbs;
}; };
struct AnalyzeStat struct AnalyzeStat
{ {
SgSymbol *replaceSymbol; SgSymbol *replaceSymbol;
int ifHasDim; int ifHasDim;
SgSymbol *name_of_array; SgSymbol *name_of_array;
SgExpression *ex_name_of_array; SgExpression *ex_name_of_array;
std::vector<Pattern> patterns; std::vector<Pattern> patterns;
}; };
// <for oprimization> // <for oprimization>
struct acrossInfo struct acrossInfo
{ {
char *nameOfArray; char *nameOfArray;
SgSymbol *symbol; SgSymbol *symbol;
int allDim; int allDim;
int acrossPos; int acrossPos;
int widthL; int widthL;
int widthR; int widthR;
int acrossNum; int acrossNum;
std::vector<int> dims; std::vector<int> dims;
std::vector<SgSymbol*> symbs; std::vector<SgSymbol*> symbs;
}; };
struct newInfo struct newInfo
{ {
SgSymbol *newArray; SgSymbol *newArray;
std::vector<int> dimSize; std::vector<int> dimSize;
std::vector<SgStatement*> loadsBeforePlus; std::vector<SgStatement*> loadsBeforePlus;
std::vector<SgStatement*> loadsInForPlus; std::vector<SgStatement*> loadsInForPlus;
std::vector<SgStatement*> loadsBeforeMinus; std::vector<SgStatement*> loadsBeforeMinus;
std::vector<SgStatement*> loadsInForMinus; std::vector<SgStatement*> loadsInForMinus;
std::vector<SgStatement*> stores; std::vector<SgStatement*> stores;
std::vector<SgStatement*> swapsDown; std::vector<SgStatement*> swapsDown;
std::vector<SgStatement*> swapsUp; std::vector<SgStatement*> swapsUp;
}; };
// end <for oprimization> // end <for oprimization>
// block <gpuO1 lvl 2> // block <gpuO1 lvl 2>
struct Group struct Group
{ {
char *strOfmain; // char *strOfmain; //
SgExpression *mainPattern; SgExpression *mainPattern;
std::vector<SgExpression*> inGroup; std::vector<SgExpression*> inGroup;
std::vector<int> len; std::vector<int> len;
std::vector<int> sortLen; std::vector<int> sortLen;
newInfo replaceInfo; // replace info with all needed loads and swaps for optimization newInfo replaceInfo; // replace info with all needed loads and swaps for optimization
}; };
struct PositionGroup struct PositionGroup
{ {
std::map<std::string, SgExpression*> tableReplace; // table of mapping new private variables to distributed arrays for replacing in loop body std::map<std::string, SgExpression*> tableReplace; // table of mapping new private variables to distributed arrays for replacing in loop body
std::map<std::string, SgSymbol*> tableNewVars; // table of new private variables that is needed to add in cuda kernel std::map<std::string, SgSymbol*> tableNewVars; // table of new private variables that is needed to add in cuda kernel
int position; // position of fixed variable in distributed loop, index 0 corresponds to the first variable. int position; // position of fixed variable in distributed loop, index 0 corresponds to the first variable.
SgExpression *idxInPos; // SgExpression *idxInPos; //
std::vector<Group> allPosGr; // all groups of array access patterns with fixed loop variables, which is distributed std::vector<Group> allPosGr; // all groups of array access patterns with fixed loop variables, which is distributed
}; };
struct ArrayGroup struct ArrayGroup
{ {
SgSymbol *arrayName; // name of distribute array SgSymbol *arrayName; // name of distribute array
std::vector<PositionGroup> allGroups; // all groups, where one loop variable is fixed std::vector<PositionGroup> allGroups; // all groups, where one loop variable is fixed
}; };
// end of block <gpuO1 lvl 2> // end of block <gpuO1 lvl 2>
struct LoopInfo struct LoopInfo
{ {
std::vector<SgSymbol*> loopSymbols; std::vector<SgSymbol*> loopSymbols;
std::vector<SgExpression*> lowBounds; std::vector<SgExpression*> lowBounds;
std::vector<SgExpression*> highBounds; std::vector<SgExpression*> highBounds;
std::vector<SgExpression*> steps; std::vector<SgExpression*> steps;
int lineNumber; int lineNumber;
}; };
struct ArrayIntents struct ArrayIntents
{ {
std::vector<SgSymbol*> arrayList; std::vector<SgSymbol*> arrayList;
std::vector<int> intent; std::vector<int> intent;
}; };
struct AnalyzeReturnGpuO1 struct AnalyzeReturnGpuO1
{ {
std::vector<AnalyzeStat> allStat; std::vector<AnalyzeStat> allStat;
std::vector<BestPattern> bestPatterns; std::vector<BestPattern> bestPatterns;
std::vector<ArrayGroup> allArrayGroup; std::vector<ArrayGroup> allArrayGroup;
}; };
// functions // functions
SgExpression* findDirect(SgExpression*, int); SgExpression* findDirect(SgExpression*, int);
//SageArrayIdxs* GetIdxInParDir(SgExpression*, SgExpression*); SageAcrossInfo GetLoopsWithParAndAcrDir();
SageAcrossInfo* GetLoopsWithParAndAcrDir(); std::vector<SageSymbols> GetSymbInParalell(SgExpression*);
SageSymbols *GetSymbInParalell(int*, SgExpression*);
int GetIdxPlaceInParDir(SageSymbols*, SgSymbol*); int GetIdxPlaceInParDir(SageSymbols*, SgSymbol*);

View File

@@ -321,7 +321,8 @@ static string unparseProjectIfNeed(SgFile* file, const int curr_regime, const bo
//TODO: add freeForm for each file //TODO: add freeForm for each file
if (curr_regime == INSERT_INCLUDES && filesToInclude.find(file_name) != filesToInclude.end()) if (curr_regime == INSERT_INCLUDES && filesToInclude.find(file_name) != filesToInclude.end())
{ {
unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile, moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString, true); //, unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile,
moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString, true);
auto itI = filesToInclude.find(file_name); auto itI = filesToInclude.find(file_name);
for (auto& incl : itI->second) for (auto& incl : itI->second)
if (allIncludeFiles.find(incl) != allIncludeFiles.end()) if (allIncludeFiles.find(incl) != allIncludeFiles.end())
@@ -329,7 +330,8 @@ static string unparseProjectIfNeed(SgFile* file, const int curr_regime, const bo
} }
else else
{ {
unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile, moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString); unparseToBuf = removeIncludeStatsAndUnparse(file, file_name, fout_name.c_str(), allIncludeFiles, out_free_form == 1, moduleUsesByFile,
moduleDecls, getObjectForFileFromMap(file_name, exctactedModuleStats), toString);
// copy includes that have not changed // copy includes that have not changed
if (folderName != NULL) if (folderName != NULL)
@@ -995,6 +997,10 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
fileIt->second.insert(first->fileName()); fileIt->second.insert(first->fileName());
} }
} }
if (inlcudeAllFiles)
if (fileIt->second.size())
filesToInclude[file_name] = fileIt->second;
} }
else if (curr_regime == REMOVE_AND_CALC_SHADOW) else if (curr_regime == REMOVE_AND_CALC_SHADOW)
{ {
@@ -2825,6 +2831,8 @@ int main(int argc, char **argv)
debSh = 1; debSh = 1;
else if (string(curr_arg) == "-noLogo") else if (string(curr_arg) == "-noLogo")
noLogo = true; noLogo = true;
else if (string(curr_arg) == "-includeAll")
inlcudeAllFiles = true;
break; break;
default: default:
break; break;

View File

@@ -46,6 +46,7 @@ bool ignoreArrayDistributeState = false;
bool fullDepGraph = false; bool fullDepGraph = false;
bool noLogo = false; bool noLogo = false;
bool withTemplateInfo = false; bool withTemplateInfo = false;
bool inlcudeAllFiles = false; // for pass INSERT_INLCUDES
uint64_t currentAvailMemory = 0; uint64_t currentAvailMemory = 0;
int QUALITY; // quality of conflicts search in graph int QUALITY; // quality of conflicts search in graph
@@ -82,7 +83,7 @@ std::map<std::string, std::map<int, std::set<std::string>>> commentsToInclude;
// //
//for INSERT_INCLUDES //for INSERT_INCLUDES
std::map<std::string, std::set<std::string>> filesToInclude; std::map<std::string, std::set<std::string>> filesToInclude; // file -> includes
// //
//for PASSES DEPENDENSIES //for PASSES DEPENDENSIES

View File

@@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION_SPF "2256" #define VERSION_SPF "2257"