From 976ec40b2614fe4e935486ce8be932bf5e573447 Mon Sep 17 00:00:00 2001 From: Mengchi Zhang Date: Sun, 9 Jun 2019 21:36:23 -0400 Subject: Move ptx_parser vars Signed-off-by: Mengchi Zhang --- src/cuda-sim/ptx_parser.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/cuda-sim/ptx_parser.h') diff --git a/src/cuda-sim/ptx_parser.h b/src/cuda-sim/ptx_parser.h index fb1b7f2..b2388fa 100644 --- a/src/cuda-sim/ptx_parser.h +++ b/src/cuda-sim/ptx_parser.h @@ -29,6 +29,7 @@ #define ptx_parser_INCLUDED #include "../abstract_hardware_model.h" +#include "ptx_ir.h" extern const char *g_filename; extern int g_error_detected; @@ -44,7 +45,16 @@ class ptx_recognizer { scanner = NULL; g_size = -1; g_add_identifier_cached__identifier = NULL; + g_alignment_spec = -1; + g_var_type = NULL; + g_opcode = -1; + g_space_spec = undefined_space; + g_ptr_spec = undefined_space; + g_scalar_type_spec = -1; + g_vector_spec = -1; + g_extern_spec = 0; } + // global list yyscan_t scanner; #define LINEBUF_SIZE (4*1024) char linebuf[LINEBUF_SIZE]; @@ -53,7 +63,27 @@ class ptx_recognizer { char *g_add_identifier_cached__identifier; int g_add_identifier_cached__array_dim; int g_add_identifier_cached__array_ident; + int g_alignment_spec; + // variable declaration stuff: + type_info *g_var_type; + // instruction definition stuff: + const symbol *g_pred; + int g_neg_pred; + int g_pred_mod; + symbol *g_label; + int g_opcode; + std::list g_operands; + std::list g_options; + std::list g_wmma_options; + std::list g_scalar_type; + // type specifier stuff: + memory_space_t g_space_spec; + memory_space_t g_ptr_spec; + int g_scalar_type_spec; + int g_vector_spec; + int g_extern_spec; + // member function list void init_directive_state(); void init_instruction_state(); void start_function( int entry_point ); -- cgit v1.3 From dca532b090edcf3fb840a697a8a0919d301c3dd7 Mon Sep 17 00:00:00 2001 From: Mengchi Zhang Date: Sun, 9 Jun 2019 21:57:13 -0400 Subject: Add more vars for ptx_parser Signed-off-by: Mengchi Zhang --- src/cuda-sim/ptx_parser.cc | 5 ----- src/cuda-sim/ptx_parser.h | 8 ++++++++ 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/cuda-sim/ptx_parser.h') diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc index 84eec65..897beaf 100644 --- a/src/cuda-sim/ptx_parser.cc +++ b/src/cuda-sim/ptx_parser.cc @@ -49,7 +49,6 @@ void set_ptx_warp_size(const struct core_config * warp_size) static bool g_debug_ir_generation=false; const char *g_filename; -unsigned g_max_regs_per_thread = 0; // the program intermediate representation... static symbol_table *g_global_allfiles_symbol_table = NULL; @@ -341,10 +340,6 @@ bool check_for_duplicates( const char *identifier ) extern std::set g_globals; extern std::set g_constants; -int g_func_decl = 0; -int g_ident_add_uid = 0; -unsigned g_const_alloc = 1; - // Returns padding that needs to be inserted ahead of address to make it aligned to min(size, maxalign) /* * @param address the address in bytes diff --git a/src/cuda-sim/ptx_parser.h b/src/cuda-sim/ptx_parser.h index b2388fa..c52fe20 100644 --- a/src/cuda-sim/ptx_parser.h +++ b/src/cuda-sim/ptx_parser.h @@ -53,6 +53,10 @@ class ptx_recognizer { g_scalar_type_spec = -1; g_vector_spec = -1; g_extern_spec = 0; + g_func_decl = 0; + g_ident_add_uid = 0; + g_const_alloc = 1; + g_max_regs_per_thread = 0; } // global list yyscan_t scanner; @@ -82,6 +86,10 @@ class ptx_recognizer { int g_scalar_type_spec; int g_vector_spec; int g_extern_spec; + int g_func_decl; + int g_ident_add_uid; + unsigned g_const_alloc; + unsigned g_max_regs_per_thread; // member function list void init_directive_state(); -- cgit v1.3