summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMengchi Zhang <[email protected]>2019-06-12 18:49:58 -0400
committerMengchi Zhang <[email protected]>2019-06-12 18:49:58 -0400
commit5530b51c7c572d25717ad7f5d81196011dfcb540 (patch)
tree387fa0f7eac183bbc3bf8b8e87d1e85dcd8e1f0c /src
parentc146d3707216f235a1dde3bd978239fd55b111ed (diff)
Move symbol table globals
Signed-off-by: Mengchi Zhang <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/cuda-sim/ptx_parser.cc10
-rw-r--r--src/cuda-sim/ptx_parser.h7
2 files changed, 10 insertions, 7 deletions
diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc
index 7080ee9..32e12a1 100644
--- a/src/cuda-sim/ptx_parser.cc
+++ b/src/cuda-sim/ptx_parser.cc
@@ -52,12 +52,8 @@ static bool g_debug_ir_generation=false;
const char *g_filename;
// the program intermediate representation...
-static symbol_table *g_global_allfiles_symbol_table = NULL;
-static symbol_table *g_global_symbol_table = NULL;
std::map<std::string,symbol_table*> g_sym_name_to_symbol_table;
-static symbol_table *g_current_symbol_table = NULL;
static std::list<ptx_instruction*> g_instructions;
-static symbol *g_last_symbol = NULL;
int g_error_detected = 0;
@@ -128,7 +124,7 @@ symbol_table * gpgpu_context::init_parser( const char *ptx_filename )
g_filename = strdup(ptx_filename);
if (g_global_allfiles_symbol_table == NULL) {
g_global_allfiles_symbol_table = new symbol_table("global_allfiles", 0, NULL);
- g_global_symbol_table = g_current_symbol_table = g_global_allfiles_symbol_table;
+ ptx_parser->g_global_symbol_table = ptx_parser->g_current_symbol_table = g_global_allfiles_symbol_table;
}
/*else {
g_global_symbol_table = g_current_symbol_table = new symbol_table("global",0,g_global_allfiles_symbol_table);
@@ -163,7 +159,7 @@ symbol_table * gpgpu_context::init_parser( const char *ptx_filename )
ptx_in = ptx_get_in(ptx_parser->scanner);
ptx_lex_destroy(ptx_parser->scanner);
fclose(ptx_in);
- return g_global_symbol_table;
+ return ptx_parser->g_global_symbol_table;
}
static int g_entry_point;
@@ -331,7 +327,7 @@ void ptx_recognizer::set_variable_type()
g_extern_spec );
}
-bool check_for_duplicates( const char *identifier )
+bool ptx_recognizer::check_for_duplicates( const char *identifier )
{
const symbol *s = g_current_symbol_table->lookup(identifier);
return ( s != NULL );
diff --git a/src/cuda-sim/ptx_parser.h b/src/cuda-sim/ptx_parser.h
index 5293c2e..cc8fe18 100644
--- a/src/cuda-sim/ptx_parser.h
+++ b/src/cuda-sim/ptx_parser.h
@@ -56,6 +56,9 @@ class ptx_recognizer {
g_ident_add_uid = 0;
g_const_alloc = 1;
g_max_regs_per_thread = 0;
+ g_global_symbol_table = NULL;
+ g_current_symbol_table = NULL;
+ symbol *g_last_symbol = NULL;
}
// global list
yyscan_t scanner;
@@ -89,6 +92,9 @@ class ptx_recognizer {
int g_ident_add_uid;
unsigned g_const_alloc;
unsigned g_max_regs_per_thread;
+ symbol_table *g_global_symbol_table;
+ symbol_table *g_current_symbol_table;
+ symbol *g_last_symbol;
// member function list
void init_directive_state();
@@ -154,6 +160,7 @@ class ptx_recognizer {
//Jin: handle instructino group for cdp
void start_inst_group();
void end_inst_group();
+ bool check_for_duplicates( const char *identifier );
};