dvm updated, fixed and improved dead_code pass

This commit is contained in:
ALEXks
2024-03-22 12:00:01 +03:00
parent 0f39f6474d
commit d27b9d1ed3
7 changed files with 64 additions and 80 deletions

View File

@@ -26,7 +26,6 @@ extern "C" void exit(int status);
#include "extcxx_low.h"
extern "C" int number_of_ll_node;
extern "C" PTR_SYMB last_file_symbol;
extern "C" PTR_SYMB FileLastSymbol(...);
#undef USER
@@ -1647,7 +1646,7 @@ SgFile &SgProject::file(int i)
#ifdef __SPF
SgStatement::setCurrProcessFile(pt->filename());
SgStatement::setCurrProcessLine(0);
last_file_symbol = FileLastSymbol(pt->filename());
last_file_symbol = file->cur_symb;
#endif
return *pt;
}
@@ -1775,13 +1774,13 @@ int SgFile::switchToFile(const std::string &name)
SgFile *file = &(CurrentProject->file(it->second.second));
current_file_id = it->second.second;
current_file = file;
SgStatement::setCurrProcessFile(file->filename());
SgStatement::setCurrProcessLine(0);
last_file_symbol = current_file->filept->cur_symb;
}
}
last_file_symbol = FileLastSymbol(name.c_str());
return it->second.second;
}

View File

@@ -83,12 +83,6 @@ int out_upper_case;
int out_line_unlimit;
int out_line_length; // out_line_length = 132 for -ffo mode; out_line_length = 72 for -uniForm mode
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 */
@@ -253,24 +247,6 @@ char* mymalloc(int size)
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 ********************************
* *
* based on the table info in include dir *.def *
@@ -1228,7 +1204,6 @@ int Init_Tool_Box()
number_of_ll_node = CUR_FILE_NUM_LLNDS() + 1;
number_of_bif_node = CUR_FILE_NUM_BIFS() + 1;
number_of_symb_node = CUR_FILE_NUM_SYMBS() + 1;
addFileSymbolList(CUR_FILE_NAME(), CUR_FILE_CUR_SYMB()); /* podd 01.03.24 */
if (CUR_FILE_NAME()) strcpy(Current_File_name, CUR_FILE_NAME());
if (ToolBOX_INIT)
return 0;

View File

@@ -82,7 +82,6 @@ extern "C" int out_upper_case;
extern "C" int out_line_unlimit;
extern "C" int out_line_length;
extern "C" PTR_SYMB last_file_symbol;
extern "C" PTR_SYMB FileLastSymbol(...);
Options options;
@@ -418,7 +417,7 @@ int main(int argc, char *argv[])
fout_name_info_C = ChangeFto_info_C(fout_name); /*ACC*/
//set the last symbol of file
last_file_symbol = FileLastSymbol(file->filename()); //for low_level.c and not only
last_file_symbol = file->filept->cur_symb; //for low_level.c and not only
initLibNames(); //for every file
InitDVM(file); //for every file
current_file = file; // global variable (used in SgTypeComplex)