Compare commits
3 Commits
1d82af702e
...
968491ee29
| Author | SHA1 | Date | |
|---|---|---|---|
| 968491ee29 | |||
|
|
11888f2ff9 | ||
| ed34da415a |
@@ -54,6 +54,7 @@ int getLastLabelId();
|
|||||||
int isItInSection();
|
int isItInSection();
|
||||||
int Init_Tool_Box();
|
int Init_Tool_Box();
|
||||||
void Message();
|
void Message();
|
||||||
|
|
||||||
PTR_BFND rec_num_near_search();
|
PTR_BFND rec_num_near_search();
|
||||||
PTR_BFND Redo_Bif_Next_Chain_Internal();
|
PTR_BFND Redo_Bif_Next_Chain_Internal();
|
||||||
PTR_SYMB duplicateSymbol();
|
PTR_SYMB duplicateSymbol();
|
||||||
@@ -82,6 +83,12 @@ int out_upper_case;
|
|||||||
int out_line_unlimit;
|
int out_line_unlimit;
|
||||||
int out_line_length; // out_line_length = 132 for -ffo mode; out_line_length = 72 for -uniForm mode
|
int out_line_length; // out_line_length = 132 for -ffo mode; out_line_length = 72 for -uniForm mode
|
||||||
PTR_SYMB last_file_symbol;
|
PTR_SYMB last_file_symbol;
|
||||||
|
struct file_symbol {
|
||||||
|
char *fname;
|
||||||
|
PTR_SYMB last_symb;
|
||||||
|
struct file_symbol *next;
|
||||||
|
} ;
|
||||||
|
struct file_symbol *file_last_symbol = NULL;
|
||||||
|
|
||||||
static int CountNullBifNext = 0; /* for internal debugging */
|
static int CountNullBifNext = 0; /* for internal debugging */
|
||||||
|
|
||||||
@@ -94,7 +101,6 @@ enum typenode node_code_kind[LAST_CODE];
|
|||||||
char info_type[LAST_CODE][MAXFIELDTYPE];
|
char info_type[LAST_CODE][MAXFIELDTYPE];
|
||||||
char info_symb[LAST_CODE][MAXFIELDSYMB];
|
char info_symb[LAST_CODE][MAXFIELDSYMB];
|
||||||
char general_info[LAST_CODE][MAXFIELDSYMB];
|
char general_info[LAST_CODE][MAXFIELDSYMB];
|
||||||
|
|
||||||
/*static struct bif_stack_level *stack_level = NULL;*/
|
/*static struct bif_stack_level *stack_level = NULL;*/
|
||||||
/*static struct bif_stack_level *current_level = NULL;*/
|
/*static struct bif_stack_level *current_level = NULL;*/
|
||||||
|
|
||||||
@@ -247,6 +253,24 @@ char* mymalloc(int size)
|
|||||||
return pt1;
|
return pt1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PTR_SYMB FileLastSymbol(char *file_name)
|
||||||
|
{
|
||||||
|
struct file_symbol *fsl;
|
||||||
|
for(fsl=file_last_symbol; fsl; fsl=fsl->next)
|
||||||
|
if(!strcmp(file_name, fsl->fname))
|
||||||
|
return fsl->last_symb;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addFileSymbolList(char *file_name, PTR_SYMB symb)
|
||||||
|
{
|
||||||
|
struct file_symbol *fsl;
|
||||||
|
fsl = (struct file_symbol *) xmalloc(sizeof (struct file_symbol));
|
||||||
|
fsl->last_symb = symb;
|
||||||
|
fsl->fname = file_name;
|
||||||
|
fsl->next = file_last_symbol;
|
||||||
|
file_last_symbol = fsl;
|
||||||
|
}
|
||||||
/***************** Provides infos on nodes ********************************
|
/***************** Provides infos on nodes ********************************
|
||||||
* *
|
* *
|
||||||
* based on the table info in include dir *.def *
|
* based on the table info in include dir *.def *
|
||||||
@@ -549,6 +573,7 @@ void Message(char *s, int l)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* A set of functions for dealing with a free list for low_level node */
|
/* A set of functions for dealing with a free list for low_level node */
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
@@ -1203,14 +1228,13 @@ int Init_Tool_Box()
|
|||||||
number_of_ll_node = CUR_FILE_NUM_LLNDS() + 1;
|
number_of_ll_node = CUR_FILE_NUM_LLNDS() + 1;
|
||||||
number_of_bif_node = CUR_FILE_NUM_BIFS() + 1;
|
number_of_bif_node = CUR_FILE_NUM_BIFS() + 1;
|
||||||
number_of_symb_node = CUR_FILE_NUM_SYMBS() + 1;
|
number_of_symb_node = CUR_FILE_NUM_SYMBS() + 1;
|
||||||
last_file_symbol = CUR_FILE_CUR_SYMB(); /* podd 23.06.15 */
|
addFileSymbolList(CUR_FILE_NAME(), CUR_FILE_CUR_SYMB()); /* podd 01.03.24 */
|
||||||
|
|
||||||
if (CUR_FILE_NAME()) strcpy(Current_File_name, CUR_FILE_NAME());
|
if (CUR_FILE_NAME()) strcpy(Current_File_name, CUR_FILE_NAME());
|
||||||
if (ToolBOX_INIT)
|
if (ToolBOX_INIT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ToolBOX_INIT = 1;
|
ToolBOX_INIT = 1;
|
||||||
|
|
||||||
make_a_malloc_stack();
|
make_a_malloc_stack();
|
||||||
|
|
||||||
/* initialisation des noeuds */
|
/* initialisation des noeuds */
|
||||||
|
|||||||
@@ -736,10 +736,11 @@ void Init_Unparser()
|
|||||||
/* set the first tabulation */
|
/* set the first tabulation */
|
||||||
TabNumber = 1;
|
TabNumber = 1;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
{
|
else
|
||||||
if (Parser_Initiated != C_Initialized)
|
{
|
||||||
{
|
if (Parser_Initiated != C_Initialized)
|
||||||
|
{
|
||||||
#define DEFNODECODE(SYM, NAME, TYPE, LENGTH, NT) Unparse_Def[SYM].str = create_unp_str( NAME);
|
#define DEFNODECODE(SYM, NAME, TYPE, LENGTH, NT) Unparse_Def[SYM].str = create_unp_str( NAME);
|
||||||
#include"unparseC++.def"
|
#include"unparseC++.def"
|
||||||
#undef DEFNODECODE
|
#undef DEFNODECODE
|
||||||
@@ -747,12 +748,15 @@ void Init_Unparser()
|
|||||||
#define DEFNODECODE(SYM, NAME, TYPE, LENGTH, NT) Unparse_Def[SYM].fct = NULL;
|
#define DEFNODECODE(SYM, NAME, TYPE, LENGTH, NT) Unparse_Def[SYM].fct = NULL;
|
||||||
#include"unparseC++.def"
|
#include"unparseC++.def"
|
||||||
#undef DEFNODECODE
|
#undef DEFNODECODE
|
||||||
Parser_Initiated = C_Initialized;
|
Parser_Initiated = C_Initialized;
|
||||||
/* init precedence table of operators for C++ */
|
/* set the first tabulation */
|
||||||
for(i=BIT_COMPLEMENT_OP - EQ_OP; i<=RSHIFT_ASSGN_OP-EQ_OP;i++)
|
TabNumber = 0;
|
||||||
precedence_C[i] = precedence2_C[i-BIT_COMPLEMENT_OP+EQ_OP];
|
|
||||||
}
|
/* init precedence table of operators for C++ */
|
||||||
}
|
for(i=BIT_COMPLEMENT_OP - EQ_OP; i<=RSHIFT_ASSGN_OP-EQ_OP;i++)
|
||||||
|
precedence_C[i] = precedence2_C[i-BIT_COMPLEMENT_OP+EQ_OP];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* initialize the number of flag */
|
/* initialize the number of flag */
|
||||||
|
|||||||
@@ -83,11 +83,14 @@ void InitializeACC()
|
|||||||
type_CudaIndexType = NULL;
|
type_CudaIndexType = NULL;
|
||||||
type_with_len_DvmType = NULL;
|
type_with_len_DvmType = NULL;
|
||||||
declaration_cmnt = NULL;
|
declaration_cmnt = NULL;
|
||||||
|
indexType_int = indexType_long = indexType_llong = NULL;
|
||||||
dvmh_targets = options.isOn(NO_CUDA) ? HOST_DEVICE : HOST_DEVICE | CUDA_DEVICE;
|
dvmh_targets = options.isOn(NO_CUDA) ? HOST_DEVICE : HOST_DEVICE | CUDA_DEVICE;
|
||||||
|
|
||||||
SpecialSymbols.insert(std::pair<char, const char*>('\n', "\\n\"\n\""));
|
SpecialSymbols.insert(std::pair<char, const char*>('\n', "\\n\"\n\""));
|
||||||
SpecialSymbols.insert(std::pair<char, const char*>('"', "\\\""));
|
SpecialSymbols.insert(std::pair<char, const char*>('"', "\\\""));
|
||||||
SpecialSymbols.insert(std::pair<char, const char*>('\\', "\\\\"));
|
SpecialSymbols.insert(std::pair<char, const char*>('\\', "\\\\"));
|
||||||
|
|
||||||
|
InitializeAcrossACC();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *filenameACC()
|
char *filenameACC()
|
||||||
|
|||||||
@@ -40,15 +40,13 @@ void DeclarationCreateReductionBlocksAcross(int, SgExpression*);
|
|||||||
AnalyzeReturnGpuO1 analyzeLoopBody(int type);
|
AnalyzeReturnGpuO1 analyzeLoopBody(int type);
|
||||||
|
|
||||||
// local static variables
|
// local static variables
|
||||||
static SgSymbol *red_first;
|
static SgSymbol *red_first = NULL;
|
||||||
static bool declaration_include = true;
|
|
||||||
static bool createBodyKernel = false;
|
static bool createBodyKernel = false;
|
||||||
static bool createConvert_XY = true;
|
static bool createConvert_XY = true;
|
||||||
static const int numLoopVars = 16;
|
static const int numLoopVars = 16;
|
||||||
static bool ifReadLvlMode = false;
|
static bool ifReadLvlMode = false;
|
||||||
static vector <stack <SgStatement*> > copyOfBody;
|
static vector <stack <SgStatement*> > copyOfBody;
|
||||||
static vector<SgSymbol*> allRegNames;
|
static vector<SgSymbol*> allRegNames;
|
||||||
static unsigned countOfCopies;
|
|
||||||
static vector<ParamsForAllVariants> allVariants;
|
static vector<ParamsForAllVariants> allVariants;
|
||||||
|
|
||||||
static const char *funcDvmhConvXYfortVer = " attributes(device) subroutine dvmh_convert_XY_int(x,y,Rx,Ry,slash,idx)\n implicit none\n integer ,value:: x\n integer ,value:: y\n integer ,value:: Rx\n integer ,value:: Ry\n integer ,value:: slash\n integer ,device:: idx \n \n if(slash .eq. 0) then\n if(Rx .eq. Ry) then\n if(x + y .lt. Rx) then\n idx = y + (1+x+y)*(x+y)/2\n else\n idx = Rx*(Rx-1)+x-(2*Rx-x-y-1)*(2*Rx-x-y-2)/2\n endif \n elseif(Rx .lt. Ry) then\n if(x + y .lt. Rx) then\n idx = y + ((1+x+y)*(x+y)) / 2\n elseif(x + y .lt. Ry) then\n idx = ((1+Rx)*Rx) / 2 + Rx - x - 1 + Rx * (x+y-Rx)\n else\n idx = Rx*Ry-Ry+y-(((Rx+Ry-y-x-1)*(Rx+Ry-y-x-2))/2)\n endif\n else\n if(x + y .lt. Ry) then\n idx = x + (1+x+y)*(x+y) / 2\n elseif(x + y .lt. Rx) then\n idx = (1+Ry)*Ry/2 + (Ry-y-1) + Ry * (x+y-Ry)\n else\n idx = Rx*Ry-Rx+x-((Rx+Ry-y-x-1)*(Rx+Ry-y-x-2)/2)\n endif\n endif\n else\n if(Rx .eq. Ry) then\n if(x + Rx-1-y .lt. Rx) then\n idx = Rx-1-y + (x+Rx-y)*(x+Rx-1-y)/2\n else\n idx = Rx*(Rx-1) + x - (Rx-x+y)*(Rx-x+y-1)/2\n endif\n elseif(Rx .lt. Ry) then\n if(x + Ry-1-y .lt. Rx) then \n idx = Ry-1-y + ((x+Ry-y)*(x+Ry-1-y)) / 2\n elseif(x + Ry-1-y .lt. Ry) then\n idx = ((1+Rx)*Rx)/2+Rx-x-1+Rx*(x+Ry-1-y-Rx)\n else\n idx = Rx*Ry-1-y-(((Rx+y-x)*(Rx+y-x-1))/2)\n endif\n else\n if(x + Ry-1-y .lt. Ry) then\n idx = x + (1+x+Ry-1-y)*(x+Ry-1-y)/2\n elseif(x + Ry-1-y .lt. Rx) then\n idx = (1+Ry)*Ry/2 + y + Ry * (x-y-1)\n else\n idx = Rx*Ry-Rx+x-((Rx+y-x)*(Rx+y-x-1)/2)\n endif\n endif\n endif\n end subroutine\n";
|
static const char *funcDvmhConvXYfortVer = " attributes(device) subroutine dvmh_convert_XY_int(x,y,Rx,Ry,slash,idx)\n implicit none\n integer ,value:: x\n integer ,value:: y\n integer ,value:: Rx\n integer ,value:: Ry\n integer ,value:: slash\n integer ,device:: idx \n \n if(slash .eq. 0) then\n if(Rx .eq. Ry) then\n if(x + y .lt. Rx) then\n idx = y + (1+x+y)*(x+y)/2\n else\n idx = Rx*(Rx-1)+x-(2*Rx-x-y-1)*(2*Rx-x-y-2)/2\n endif \n elseif(Rx .lt. Ry) then\n if(x + y .lt. Rx) then\n idx = y + ((1+x+y)*(x+y)) / 2\n elseif(x + y .lt. Ry) then\n idx = ((1+Rx)*Rx) / 2 + Rx - x - 1 + Rx * (x+y-Rx)\n else\n idx = Rx*Ry-Ry+y-(((Rx+Ry-y-x-1)*(Rx+Ry-y-x-2))/2)\n endif\n else\n if(x + y .lt. Ry) then\n idx = x + (1+x+y)*(x+y) / 2\n elseif(x + y .lt. Rx) then\n idx = (1+Ry)*Ry/2 + (Ry-y-1) + Ry * (x+y-Ry)\n else\n idx = Rx*Ry-Rx+x-((Rx+Ry-y-x-1)*(Rx+Ry-y-x-2)/2)\n endif\n endif\n else\n if(Rx .eq. Ry) then\n if(x + Rx-1-y .lt. Rx) then\n idx = Rx-1-y + (x+Rx-y)*(x+Rx-1-y)/2\n else\n idx = Rx*(Rx-1) + x - (Rx-x+y)*(Rx-x+y-1)/2\n endif\n elseif(Rx .lt. Ry) then\n if(x + Ry-1-y .lt. Rx) then \n idx = Ry-1-y + ((x+Ry-y)*(x+Ry-1-y)) / 2\n elseif(x + Ry-1-y .lt. Ry) then\n idx = ((1+Rx)*Rx)/2+Rx-x-1+Rx*(x+Ry-1-y-Rx)\n else\n idx = Rx*Ry-1-y-(((Rx+y-x)*(Rx+y-x-1))/2)\n endif\n else\n if(x + Ry-1-y .lt. Ry) then\n idx = x + (1+x+Ry-1-y)*(x+Ry-1-y)/2\n elseif(x + Ry-1-y .lt. Rx) then\n idx = (1+Ry)*Ry/2 + y + Ry * (x-y-1)\n else\n idx = Rx*Ry-Rx+x-((Rx+y-x)*(Rx+y-x-1)/2)\n endif\n endif\n endif\n end subroutine\n";
|
||||||
@@ -58,6 +56,17 @@ static const char* fermiPreprocDir = "CUDA_FERMI_ARCH";
|
|||||||
// local variables
|
// local variables
|
||||||
SgStatement *kernelScope, *block;
|
SgStatement *kernelScope, *block;
|
||||||
|
|
||||||
|
void InitializeAcrossACC()
|
||||||
|
{
|
||||||
|
red_first = NULL;
|
||||||
|
createBodyKernel = false;
|
||||||
|
createConvert_XY = true;
|
||||||
|
ifReadLvlMode = false;
|
||||||
|
copyOfBody.clear();
|
||||||
|
allRegNames.clear();
|
||||||
|
allVariants.clear();
|
||||||
|
}
|
||||||
|
|
||||||
static inline int pow(int n)
|
static inline int pow(int n)
|
||||||
{
|
{
|
||||||
int tmp = 1;
|
int tmp = 1;
|
||||||
@@ -716,9 +725,6 @@ ArgsForKernel *Create_C_Adapter_Function_Across(SgSymbol *sadapter)
|
|||||||
{
|
{
|
||||||
if (allVariants[i].acrossV != 1)
|
if (allVariants[i].acrossV != 1)
|
||||||
ifOne = false;
|
ifOne = false;
|
||||||
|
|
||||||
if ((unsigned)allVariants[i].acrossV == countOfCopies + 1)
|
|
||||||
countOfCopies++;
|
|
||||||
}
|
}
|
||||||
// set global if true
|
// set global if true
|
||||||
if (ifOne)
|
if (ifOne)
|
||||||
@@ -1787,11 +1793,8 @@ vector<ArgsForKernel> Create_C_Adapter_Function_Across_variants(SgSymbol *sadapt
|
|||||||
st_end = st_hedr->lexNext();
|
st_end = st_hedr->lexNext();
|
||||||
fe = st_hedr->expr(0);
|
fe = st_hedr->expr(0);
|
||||||
first_exec = st_end;
|
first_exec = st_end;
|
||||||
if (declaration_include)
|
if (declaration_cmnt == NULL)
|
||||||
{
|
|
||||||
declaration_cmnt = "#include <cstdio>\n#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))\n#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))";
|
declaration_cmnt = "#include <cstdio>\n#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))\n#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))";
|
||||||
declaration_include = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mywarn(" end: create fuction header ");
|
mywarn(" end: create fuction header ");
|
||||||
mywarn("start: create dummy argument list ");
|
mywarn("start: create dummy argument list ");
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ extern "C" int out_upper_case;
|
|||||||
extern "C" int out_line_unlimit;
|
extern "C" int out_line_unlimit;
|
||||||
extern "C" int out_line_length;
|
extern "C" int out_line_length;
|
||||||
extern "C" PTR_SYMB last_file_symbol;
|
extern "C" PTR_SYMB last_file_symbol;
|
||||||
|
extern "C" PTR_SYMB FileLastSymbol(...);
|
||||||
|
|
||||||
Options options;
|
Options options;
|
||||||
|
|
||||||
@@ -99,7 +100,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
FILE *fout = NULL;
|
FILE *fout = NULL;
|
||||||
FILE *fout_cuf = NULL, *fout_C_cu = NULL, *fout_info = NULL; /*ACC*/
|
FILE *fout_cuf = NULL, *fout_C_cu = NULL, *fout_info = NULL; /*ACC*/
|
||||||
const char *fout_name = "out.DVMH.f";
|
const char *fout_name = NULL;
|
||||||
char *fout_name_cuf; /*ACC*/
|
char *fout_name_cuf; /*ACC*/
|
||||||
char *fout_name_C_cu; /*ACC*/
|
char *fout_name_C_cu; /*ACC*/
|
||||||
char *fout_name_info_C; /*ACC*/
|
char *fout_name_info_C; /*ACC*/
|
||||||
@@ -389,22 +390,22 @@ int main(int argc, char *argv[])
|
|||||||
ProjectStructure(project);
|
ProjectStructure(project);
|
||||||
Private_Vars_Project_Analyzer();
|
Private_Vars_Project_Analyzer();
|
||||||
//----------------------------
|
//----------------------------
|
||||||
|
|
||||||
initVariantNames(); //for project
|
initVariantNames(); //for project
|
||||||
initIntrinsicFunctionNames(); //for project
|
initIntrinsicFunctionNames(); //for project
|
||||||
initSupportedVars(); // for project, acc_f2c.cpp
|
initSupportedVars(); // for project, acc_f2c.cpp
|
||||||
initF2C_FunctionCalls(); // for project, acc_f2c.cpp
|
initF2C_FunctionCalls(); // for project, acc_f2c.cpp
|
||||||
for(int id=project.numberOfFiles()-1; id >= 0; id--)
|
for(int id=project.numberOfFiles()-1; id >= 0; id--)
|
||||||
{
|
{
|
||||||
file = &(project.file(id)); //file->unparsestdout();
|
file = &(project.file(id)); //file->unparsestdout();
|
||||||
fin_name = new char[strlen(project.fileName(id))+2];
|
fin_name = new char[strlen(project.fileName(id))+2];
|
||||||
sprintf(fin_name, "%s%s", project.fileName(id), " ");
|
sprintf(fin_name, "%s%s", project.fileName(id), " ");
|
||||||
//fin_name = strcat(project.fileName(0)," ");
|
//fin_name = strcat(project.fileName(0)," ");
|
||||||
// for call of function 'tpoint'
|
// for call of function 'tpoint'
|
||||||
//added one symbol to input-file name
|
//added one symbol to input-file name
|
||||||
//printf("%s",fin_name); //!!! debug
|
//printf("%s",fin_name); //!!! debug
|
||||||
if(a_mode || project.numberOfFiles()>1)
|
if(!fout_name)
|
||||||
fout_name = doOutFileName(file->filename()); //project.fileName(id);
|
fout_name = doOutFileName(file->filename());
|
||||||
else if (fout_name && source_name && !strcmp(source_name, fout_name))
|
else if (fout_name && source_name && !strcmp(source_name, fout_name))
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "Output file has the same name as source file\n");
|
(void)fprintf(stderr, "Output file has the same name as source file\n");
|
||||||
@@ -417,7 +418,7 @@ int main(int argc, char *argv[])
|
|||||||
fout_name_info_C = ChangeFto_info_C(fout_name); /*ACC*/
|
fout_name_info_C = ChangeFto_info_C(fout_name); /*ACC*/
|
||||||
|
|
||||||
//set the last symbol of file
|
//set the last symbol of file
|
||||||
last_file_symbol = CUR_FILE_CUR_SYMB(); //LastSymbolOfFile(file)->thesymb; //for low_level.c
|
last_file_symbol = FileLastSymbol(file->filename()); //for low_level.c and not only
|
||||||
initLibNames(); //for every file
|
initLibNames(); //for every file
|
||||||
InitDVM(file); //for every file
|
InitDVM(file); //for every file
|
||||||
current_file = file; // global variable (used in SgTypeComplex)
|
current_file = file; // global variable (used in SgTypeComplex)
|
||||||
@@ -542,6 +543,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fout_name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v_print)
|
if (v_print)
|
||||||
|
|||||||
@@ -1004,6 +1004,7 @@ SgStatement *doIfThenConstrForLoop_GPU(SgExpression *ref,SgStatement *endhost,Sg
|
|||||||
SgStatement *doIfThenConstrForLoop_GPU(SgExpression *ref,SgStatement *endhost,SgStatement *dowhile);
|
SgStatement *doIfThenConstrForLoop_GPU(SgExpression *ref,SgStatement *endhost,SgStatement *dowhile);
|
||||||
SgSymbol *KernelSymbol(SgStatement *st_do);
|
SgSymbol *KernelSymbol(SgStatement *st_do);
|
||||||
void Blocks_Off_Symbol();
|
void Blocks_Off_Symbol();
|
||||||
|
void InitializeACC();
|
||||||
void InitializeAcrossACC();
|
void InitializeAcrossACC();
|
||||||
void InitializeInFuncACC();
|
void InitializeInFuncACC();
|
||||||
SgSymbol *GPUModuleSymb(SgStatement *global_st);
|
SgSymbol *GPUModuleSymb(SgStatement *global_st);
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ extern "C" int out_upper_case;
|
|||||||
extern "C" int out_line_unlimit;
|
extern "C" int out_line_unlimit;
|
||||||
extern "C" int out_line_length;
|
extern "C" int out_line_length;
|
||||||
extern "C" PTR_SYMB last_file_symbol;
|
extern "C" PTR_SYMB last_file_symbol;
|
||||||
|
extern "C" PTR_SYMB FileLastSymbol(...);
|
||||||
|
|
||||||
static int convertFile(int argc, char* argv[], const string& fileToConv,
|
static int convertFile(int argc, char* argv[], const set<string>& filesInProj, const set<string>& moduleDeclsInFiles)
|
||||||
const set<string>& filesInProj, const set<string>& moduleDeclsInFiles)
|
|
||||||
{
|
{
|
||||||
FILE* fout = NULL;
|
FILE* fout = NULL;
|
||||||
FILE* fout_cuf = NULL, * fout_C_cu = NULL, * fout_info = NULL; /*ACC*/
|
FILE* fout_cuf = NULL, * fout_C_cu = NULL, * fout_info = NULL; /*ACC*/
|
||||||
const char* fout_name = "out.DVMH.f";
|
const char* fout_name = NULL;
|
||||||
char* fout_name_cuf; /*ACC*/
|
char* fout_name_cuf; /*ACC*/
|
||||||
char* fout_name_C_cu; /*ACC*/
|
char* fout_name_C_cu; /*ACC*/
|
||||||
char* fout_name_info_C; /*ACC*/
|
char* fout_name_info_C; /*ACC*/
|
||||||
@@ -54,7 +54,8 @@ static int convertFile(int argc, char* argv[], const string& fileToConv,
|
|||||||
while ((argc > 1) && (*argv)[0] == '-')
|
while ((argc > 1) && (*argv)[0] == '-')
|
||||||
{
|
{
|
||||||
if ((*argv)[1] == 'o' && ((*argv)[2] == '\0')) {
|
if ((*argv)[1] == 'o' && ((*argv)[2] == '\0')) {
|
||||||
fout_name = argv[1];
|
if (filesInProj.size() == 1)
|
||||||
|
fout_name = argv[1];
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
@@ -307,7 +308,8 @@ static int convertFile(int argc, char* argv[], const string& fileToConv,
|
|||||||
static int id = 0;
|
static int id = 0;
|
||||||
|
|
||||||
vector<char*> filesList;
|
vector<char*> filesList;
|
||||||
filesList.push_back((char*)fileToConv.c_str());
|
for (auto& file : filesInProj)
|
||||||
|
filesList.push_back((char*)file.c_str());
|
||||||
|
|
||||||
SgProject project((proj_name + to_string(id++)).c_str(), filesList.data(), filesList.size());
|
SgProject project((proj_name + to_string(id++)).c_str(), filesList.data(), filesList.size());
|
||||||
|
|
||||||
@@ -317,7 +319,7 @@ static int convertFile(int argc, char* argv[], const string& fileToConv,
|
|||||||
removeExecutableFromModuleDeclaration(&(project.file(z)), filesInProj, tmp);
|
removeExecutableFromModuleDeclaration(&(project.file(z)), filesInProj, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
SgFile* file;
|
SgFile* file = NULL;
|
||||||
addNumberOfFileToAttribute(&project);
|
addNumberOfFileToAttribute(&project);
|
||||||
|
|
||||||
//----------------------------
|
//----------------------------
|
||||||
@@ -331,23 +333,27 @@ static int convertFile(int argc, char* argv[], const string& fileToConv,
|
|||||||
initF2C_FunctionCalls(); // for project, acc_f2c.cpp
|
initF2C_FunctionCalls(); // for project, acc_f2c.cpp
|
||||||
for (int id = project.numberOfFiles() - 1; id >= 0; id--)
|
for (int id = project.numberOfFiles() - 1; id >= 0; id--)
|
||||||
{
|
{
|
||||||
file = &(project.file(id)); //file->unparsestdout();
|
file = &(project.file(id));
|
||||||
fin_name = new char[strlen(project.fileName(id)) + 2];
|
fin_name = new char[strlen(project.fileName(id)) + 2];
|
||||||
sprintf(fin_name, "%s%s", project.fileName(id), " ");
|
sprintf(fin_name, "%s%s", project.fileName(id), " ");
|
||||||
fout_name = doOutFileName(file->filename()); //project.fileName(id);
|
|
||||||
|
if (fout_name == NULL)
|
||||||
|
fout_name = doOutFileName(file->filename());
|
||||||
|
|
||||||
if (fout_name && source_name && !strcmp(source_name, fout_name))
|
if (fout_name && source_name && !strcmp(source_name, fout_name))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Output file has the same name as source file\n");
|
fprintf(stderr, "Output file has the same name as source file\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("convert %d to %s\n", id, fout_name);
|
||||||
|
|
||||||
fout_name_cuf = ChangeFtoCuf(fout_name); /*ACC*/
|
fout_name_cuf = ChangeFtoCuf(fout_name); /*ACC*/
|
||||||
fout_name_C_cu = ChangeFto_C_Cu(fout_name); /*ACC*/
|
fout_name_C_cu = ChangeFto_C_Cu(fout_name); /*ACC*/
|
||||||
fout_name_info_C = ChangeFto_info_C(fout_name); /*ACC*/
|
fout_name_info_C = ChangeFto_info_C(fout_name); /*ACC*/
|
||||||
|
|
||||||
//set the last symbol of file
|
//set the last symbol of file
|
||||||
last_file_symbol = CUR_FILE_CUR_SYMB();
|
last_file_symbol = FileLastSymbol(file->filename());
|
||||||
initLibNames(); //for every file
|
initLibNames(); //for every file
|
||||||
InitDVM(file); //for every file
|
InitDVM(file); //for every file
|
||||||
current_file = file; // global variable (used in SgTypeComplex)
|
current_file = file; // global variable (used in SgTypeComplex)
|
||||||
@@ -402,7 +408,22 @@ static int convertFile(int argc, char* argv[], const string& fileToConv,
|
|||||||
UnparseTo_CufAndCu_Files(file, fout_cuf, fout_C_cu, fout_info);
|
UnparseTo_CufAndCu_Files(file, fout_cuf, fout_C_cu, fout_info);
|
||||||
|
|
||||||
const string fileN = file->filename();
|
const string fileN = file->filename();
|
||||||
hideUnnecessary(file, fileN, moduleDeclsInFiles, true);
|
set<SgStatement*> toRemove;
|
||||||
|
|
||||||
|
for (SgStatement* st = file->firstStatement(); st; st = st->lexNext())
|
||||||
|
{
|
||||||
|
if (st->fileName() != fileN)
|
||||||
|
{
|
||||||
|
if (st->variant() == MODULE_STMT && moduleDeclsInFiles.find(st->fileName()) != moduleDeclsInFiles.end())
|
||||||
|
{
|
||||||
|
toRemove.insert(st);
|
||||||
|
st = st->lastNodeOfStmt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& toRem : toRemove)
|
||||||
|
toRem->extractStmt();
|
||||||
|
|
||||||
if (unparse_functions)
|
if (unparse_functions)
|
||||||
UnparseFunctionsOfFile(file, fout);
|
UnparseFunctionsOfFile(file, fout);
|
||||||
@@ -434,7 +455,7 @@ static int convertFile(int argc, char* argv[], const string& fileToConv,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fout_name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v_print)
|
if (v_print)
|
||||||
@@ -467,11 +488,11 @@ void convertFiles(int argc, char* argv[], const char* proj_name)
|
|||||||
|
|
||||||
const string fileText = readFileToStr(proj_name);
|
const string fileText = readFileToStr(proj_name);
|
||||||
vector<string> files;
|
vector<string> files;
|
||||||
set<string> filesinSet;
|
set<string> filesInSet;
|
||||||
splitString(fileText, '\n', files);
|
splitString(fileText, '\n', files);
|
||||||
|
|
||||||
for (auto& file : files)
|
for (auto& file : files)
|
||||||
filesinSet.insert(file);
|
filesInSet.insert(file);
|
||||||
|
|
||||||
map<string, set<string>> moduleUsesByFile;
|
map<string, set<string>> moduleUsesByFile;
|
||||||
map<string, string> moduleDecls;
|
map<string, string> moduleDecls;
|
||||||
@@ -482,9 +503,9 @@ void convertFiles(int argc, char* argv[], const char* proj_name)
|
|||||||
moduleDeclsInFiles.insert(elem.second);
|
moduleDeclsInFiles.insert(elem.second);
|
||||||
|
|
||||||
int codes = 0;
|
int codes = 0;
|
||||||
for (auto& file : files)
|
//for (auto& file : files)
|
||||||
{
|
{
|
||||||
codes += convertFile(args_v.size() - 1, args_v.data(), file, filesinSet, moduleDeclsInFiles);
|
codes += convertFile(args_v.size(), args_v.data(), filesInSet, moduleDeclsInFiles);
|
||||||
|
|
||||||
cur_node = node_list = NULL;
|
cur_node = node_list = NULL;
|
||||||
InitializeTable();
|
InitializeTable();
|
||||||
|
|||||||
@@ -212,7 +212,8 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
|
|||||||
|
|
||||||
Pass(BUILD_IR) <= Pass(SUBST_EXPR_RD) <= Pass(SUBST_EXPR_RD_AND_UNPARSE);
|
Pass(BUILD_IR) <= Pass(SUBST_EXPR_RD) <= Pass(SUBST_EXPR_RD_AND_UNPARSE);
|
||||||
|
|
||||||
list({ LOOP_ANALYZER_DATA_DIST_S1, SUBST_EXPR_RD } ) <= Pass(PRIVATE_REMOVING_ANALYSIS) <= Pass(REVERT_SUBST_EXPR_RD) <= Pass(PRIVATE_REMOVING);
|
list({ LOOP_ANALYZER_DATA_DIST_S1, SUBST_EXPR_RD } ) <= Pass(PRIVATE_REMOVING_ANALYSIS);
|
||||||
|
list({ PRIVATE_REMOVING_ANALYSIS, REVERT_SUBST_EXPR_RD }) <= Pass(PRIVATE_REMOVING);
|
||||||
|
|
||||||
Pass(RESTORE_LOOP_FROM_ASSIGN) <= list({ SUBST_EXPR_AND_UNPARSE, SUBST_EXPR_RD_AND_UNPARSE });
|
Pass(RESTORE_LOOP_FROM_ASSIGN) <= list({ SUBST_EXPR_AND_UNPARSE, SUBST_EXPR_RD_AND_UNPARSE });
|
||||||
|
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ static int reverseVar(SgStatement* st)
|
|||||||
static map<SgStatement*, map<int, set<string>>> insertedIncludes;
|
static map<SgStatement*, map<int, set<string>>> insertedIncludes;
|
||||||
static set<SgFile*> genVersionDone;
|
static set<SgFile*> genVersionDone;
|
||||||
|
|
||||||
set<int> hideUnnecessary(SgFile* file, const string& fileN, const set<string>& moduleDeclsInFiles, bool dontReplaceIncludes)
|
static set<int> hideUnnecessary(SgFile* file, const string& fileN, const set<string>& moduleDeclsInFiles, bool dontReplaceIncludes)
|
||||||
{
|
{
|
||||||
set<int> changedVars;
|
set<int> changedVars;
|
||||||
for (SgStatement* st = file->firstStatement(); st; st = st->lexNext())
|
for (SgStatement* st = file->firstStatement(); st; st = st->lexNext())
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ SgStatement* declaratedInStmt(SgSymbol *toFind, std::vector<SgStatement*> *allDe
|
|||||||
#include "DefUseList.h"
|
#include "DefUseList.h"
|
||||||
#include "CommonBlock.h"
|
#include "CommonBlock.h"
|
||||||
|
|
||||||
std::set<int> hideUnnecessary(SgFile* file, const std::string& fileN, const std::set<std::string>& moduleDeclsInFiles, const bool dontReplaceIncludes);
|
|
||||||
std::string removeIncludeStatsAndUnparse(SgFile *file, const char *fileName, const char *fout, std::set<std::string> &allIncludeFiles, bool outFree, const std::map<std::string, std::set<std::string>> &moduleUsesByFile, const std::map<std::string, std::string>& moduleDelcs, const std::map<SgStatement*, std::vector<SgStatement*>>& exctactedModuleStats, bool toString, bool dontReplaceIncls = false);
|
std::string removeIncludeStatsAndUnparse(SgFile *file, const char *fileName, const char *fout, std::set<std::string> &allIncludeFiles, bool outFree, const std::map<std::string, std::set<std::string>> &moduleUsesByFile, const std::map<std::string, std::string>& moduleDelcs, const std::map<SgStatement*, std::vector<SgStatement*>>& exctactedModuleStats, bool toString, bool dontReplaceIncls = false);
|
||||||
SgSymbol* findSymbolOrCreate(SgFile *file, const std::string toFind, SgType *type = NULL, SgStatement *scope = NULL);
|
SgSymbol* findSymbolOrCreate(SgFile *file, const std::string toFind, SgType *type = NULL, SgStatement *scope = NULL);
|
||||||
void recExpressionPrint(SgExpression *exp);
|
void recExpressionPrint(SgExpression *exp);
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2286"
|
#define VERSION_SPF "2287"
|
||||||
|
|||||||
Reference in New Issue
Block a user