summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMengchi Zhang <[email protected]>2019-06-12 19:13:55 -0400
committerMengchi Zhang <[email protected]>2019-06-12 19:13:55 -0400
commite5447646aaca133f2cc5cbafcaf7aeef4b384c62 (patch)
treeada059a62e896440245e7c5de9e7c69ed3c24406
parent5530b51c7c572d25717ad7f5d81196011dfcb540 (diff)
Add some vars in ptx_parser
Signed-off-by: Mengchi Zhang <[email protected]>
-rw-r--r--src/cuda-sim/ptx.l3
-rw-r--r--src/cuda-sim/ptx_parser.cc5
-rw-r--r--src/cuda-sim/ptx_parser.h5
3 files changed, 6 insertions, 7 deletions
diff --git a/src/cuda-sim/ptx.l b/src/cuda-sim/ptx.l
index 2546a99..18952a9 100644
--- a/src/cuda-sim/ptx.l
+++ b/src/cuda-sim/ptx.l
@@ -452,14 +452,13 @@ breakaddr TC; yylval->int_value = BREAKADDR_OP; return OPCODE;
<INITIAL,NOT_OPCODE,IN_FUNC_DECL>. TC; ptx_error(yyscanner, recognizer, (const char*)NULL);
%%
-extern int g_error_detected;
extern const char *g_filename;
int ptx_error( yyscan_t yyscanner, ptx_recognizer* recognizer, const char *s )
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
int i;
- g_error_detected = 1;
+ recognizer->g_error_detected = 1;
fflush(stdout);
if( s != NULL )
printf("%s:%u Syntax error:\n\n", g_filename, yylineno );
diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc
index 32e12a1..a01d1e3 100644
--- a/src/cuda-sim/ptx_parser.cc
+++ b/src/cuda-sim/ptx_parser.cc
@@ -53,10 +53,6 @@ const char *g_filename;
// the program intermediate representation...
std::map<std::string,symbol_table*> g_sym_name_to_symbol_table;
-static std::list<ptx_instruction*> g_instructions;
-
-int g_error_detected = 0;
-
#define PTX_PARSE_DPRINTF(...) \
if( g_debug_ir_generation ) { \
@@ -67,7 +63,6 @@ int g_error_detected = 0;
fflush(stdout); \
}
-static unsigned g_entry_func_param_index=0;
static function_info *g_func_info = NULL;
static std::map<unsigned,std::string> g_ptx_token_decode;
static operand_info g_return_var;
diff --git a/src/cuda-sim/ptx_parser.h b/src/cuda-sim/ptx_parser.h
index cc8fe18..c4e0b89 100644
--- a/src/cuda-sim/ptx_parser.h
+++ b/src/cuda-sim/ptx_parser.h
@@ -59,6 +59,8 @@ class ptx_recognizer {
g_global_symbol_table = NULL;
g_current_symbol_table = NULL;
symbol *g_last_symbol = NULL;
+ g_error_detected = 0;
+ g_entry_func_param_index=0;
}
// global list
yyscan_t scanner;
@@ -95,6 +97,9 @@ class ptx_recognizer {
symbol_table *g_global_symbol_table;
symbol_table *g_current_symbol_table;
symbol *g_last_symbol;
+ std::list<ptx_instruction*> g_instructions;
+ int g_error_detected;
+ unsigned g_entry_func_param_index;
// member function list
void init_directive_state();