diff options
| -rw-r--r-- | libcuda/gpgpu_context.h | 2 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_parser.cc | 10 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_parser.h | 7 |
3 files changed, 12 insertions, 7 deletions
diff --git a/libcuda/gpgpu_context.h b/libcuda/gpgpu_context.h index b586e47..fa5d02b 100644 --- a/libcuda/gpgpu_context.h +++ b/libcuda/gpgpu_context.h @@ -7,11 +7,13 @@ class gpgpu_context { public: gpgpu_context() { + g_global_allfiles_symbol_table = NULL; api = new cuda_runtime_api(); ptxinfo = new ptxinfo_data(); ptx_parser = new ptx_recognizer(); } // global list + symbol_table *g_global_allfiles_symbol_table; // objects pointers for each file cuda_runtime_api* api; ptxinfo_data* ptxinfo; 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 ); }; |
