From 6c6d66936df49c3d69ff37f24a82d218b965c059 Mon Sep 17 00:00:00 2001 From: Lingzhe Chester Cai Date: Thu, 21 Mar 2024 01:12:26 -0500 Subject: [PATCH] git11 fix, moved global variable either to static or to the pespective .c file --- src/cmp_model.c | 5 +++++ src/cmp_model.h | 1 - src/debug/memview.c | 10 +++++----- src/dumb_model.c | 1 + src/dumb_model.h | 1 - src/dvfs/perf_pred.c | 2 +- src/frontend/pin_trace_fe.c | 2 +- src/icache_stage.c | 6 ++++++ src/icache_stage.h | 7 ------- src/pin/pin_lib/decoder.cc | 2 +- src/pin/pin_lib/uop_generator.c | 2 -- src/prefetcher/l2l1pref.c | 2 +- src/prefetcher/l2way_pref.c | 2 +- 13 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/cmp_model.c b/src/cmp_model.c index 7739d723..a8d13941 100644 --- a/src/cmp_model.c +++ b/src/cmp_model.c @@ -61,6 +61,11 @@ static void cmp_istreams(void); static void cmp_cores(void); static void warmup_uncore(uns proc_id, Addr addr, Flag write); +/**************************************************************************************/ +/* Global vars */ + +Cmp_Model cmp_model; + /**************************************************************************************/ /* cmp_init */ diff --git a/src/cmp_model.h b/src/cmp_model.h index 7e40d490..45a0f10d 100644 --- a/src/cmp_model.h +++ b/src/cmp_model.h @@ -71,7 +71,6 @@ typedef struct Cmp_Model_struct { /**************************************************************************************/ /* Global vars */ -Cmp_Model cmp_model; extern Cmp_Model cmp_model; /**************************************************************************************/ diff --git a/src/debug/memview.c b/src/debug/memview.c index 83e2059d..8e6161a9 100644 --- a/src/debug/memview.c +++ b/src/debug/memview.c @@ -66,11 +66,11 @@ typedef struct Proc_Info_struct { /**************************************************************************************/ /* Global Variables */ -FILE* trace; -Bank_Info* bank_infos; -Proc_Info* proc_infos; -Trigger* start_trigger; -Mem_Req_Type* req_types; +static FILE* trace; +static Bank_Info* bank_infos; +static Proc_Info* proc_infos; +static Trigger* start_trigger; +static Mem_Req_Type* req_types; /**************************************************************************************/ /* Local Prototypes */ diff --git a/src/dumb_model.c b/src/dumb_model.c index 8080aa6e..45362e98 100644 --- a/src/dumb_model.c +++ b/src/dumb_model.c @@ -70,6 +70,7 @@ static Flag dumb_req_done(Mem_Req* req); static Proc_Info* infos; static Counter req_num; static uns64 page_num_mask; +Dumb_Model dumb_model; /**************************************************************************************/ /* dumb_init */ diff --git a/src/dumb_model.h b/src/dumb_model.h index 0e3f88a0..34b03341 100644 --- a/src/dumb_model.h +++ b/src/dumb_model.h @@ -42,7 +42,6 @@ typedef struct Dumb_Model_struct { /**************************************************************************************/ /* Global vars */ -Dumb_Model dumb_model; extern Dumb_Model dumb_model; /**************************************************************************************/ diff --git a/src/dvfs/perf_pred.c b/src/dvfs/perf_pred.c index 80ff7ae6..4bf11c37 100644 --- a/src/dvfs/perf_pred.c +++ b/src/dvfs/perf_pred.c @@ -112,7 +112,7 @@ enum { static Counter chip_cycle_count; static Stat_Mon* stat_mon; -Proc_Info* proc_infos; +static Proc_Info* proc_infos; /* static function prototypes */ static void critical_access_plot(uns proc_id, Mem_Req_Type type, uns req_ret, diff --git a/src/frontend/pin_trace_fe.c b/src/frontend/pin_trace_fe.c index 8b2a9032..8229a316 100644 --- a/src/frontend/pin_trace_fe.c +++ b/src/frontend/pin_trace_fe.c @@ -52,7 +52,7 @@ /**************************************************************************************/ /* Global Variables */ -char* trace_files[MAX_NUM_PROCS]; +static char* trace_files[MAX_NUM_PROCS]; ctype_pin_inst* next_pi; diff --git a/src/icache_stage.c b/src/icache_stage.c index cf65aeb0..fa9cbe7d 100644 --- a/src/icache_stage.c +++ b/src/icache_stage.c @@ -72,6 +72,12 @@ extern Memory* mem; extern Rob_Stall_Reason rob_stall_reason; extern Rob_Block_Issue_Reason rob_block_issue_reason; + +static Pb_Data* ic_pb_data; // cmp cne is fine for cmp now assuming homogeneous cmp +// But decided to use array for future use + + + /**************************************************************************************/ /* Local prototypes */ diff --git a/src/icache_stage.h b/src/icache_stage.h index 98dda971..09b8d1da 100644 --- a/src/icache_stage.h +++ b/src/icache_stage.h @@ -98,13 +98,6 @@ typedef struct Icache_Data_struct { } Icache_Data; -/**************************************************************************************/ -/* Global Variables */ - -Pb_Data* ic_pb_data; // cmp cne is fine for cmp now assuming homogeneous cmp -// But decided to use array for future use - - /**************************************************************************************/ /* External Variables */ diff --git a/src/pin/pin_lib/decoder.cc b/src/pin/pin_lib/decoder.cc index 6c90de30..3d036949 100644 --- a/src/pin/pin_lib/decoder.cc +++ b/src/pin/pin_lib/decoder.cc @@ -137,7 +137,7 @@ ctype_pin_inst* pin_decoder_get_latest_inst() { } void pin_decoder_print_unknown_opcodes() { - for(const auto opcode : unknown_opcodes) { + for(const auto &opcode : unknown_opcodes) { (*glb_err_ostream) << opcode << std::endl; } } diff --git a/src/pin/pin_lib/uop_generator.c b/src/pin/pin_lib/uop_generator.c index 65b45304..5fd8c787 100644 --- a/src/pin/pin_lib/uop_generator.c +++ b/src/pin/pin_lib/uop_generator.c @@ -99,8 +99,6 @@ typedef struct Trace_Uop_struct Trace_Uop; extern int op_type_delays[NUM_OP_TYPES]; extern uns NEW_INST_TABLE_SIZE; // TODO: what is this? -char* trace_files[MAX_NUM_PROCS]; - char dbg_print_buf[1024]; Trace_Uop*** trace_uop_bulk; diff --git a/src/prefetcher/l2l1pref.c b/src/prefetcher/l2l1pref.c index 60d556c6..990d5b86 100644 --- a/src/prefetcher/l2l1pref.c +++ b/src/prefetcher/l2l1pref.c @@ -59,7 +59,7 @@ extern Memory* mem; extern Dcache_Stage* dc; -Cache* l1_cache; +static Cache* l1_cache; /***************************************************************************************/ /* Local Prototypes */ diff --git a/src/prefetcher/l2way_pref.c b/src/prefetcher/l2way_pref.c index 1e8471fb..199d5bea 100644 --- a/src/prefetcher/l2way_pref.c +++ b/src/prefetcher/l2way_pref.c @@ -64,7 +64,7 @@ L2way_Rec** l2way_table; L1pref_Req* l1pref_req_queue; static Counter l1pref_send_no; static Counter l1pref_req_no; -Cache* l1_cache; +static Cache* l1_cache; /**************************************************************************************/