sanity_*_count don't need to be in vg_include.h.
Also hide the reg-alloc counters, and replace with a printing function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2549 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h
index 1467785..c6d45b7 100644
--- a/coregrind/vg_include.h
+++ b/coregrind/vg_include.h
@@ -1172,18 +1172,19 @@
extern UCodeBlock* VG_(alloc_UCodeBlock) ( void );
-extern void VG_(translate) ( ThreadId tid,
- Addr orig_addr,
- UInt* orig_size,
- Addr* trans_addr,
- UInt* trans_size,
- UShort jumps[VG_MAX_JUMPS]);
+extern void VG_(translate) ( ThreadId tid,
+ Addr orig_addr,
+ UInt* orig_size,
+ Addr* trans_addr,
+ UInt* trans_size,
+ UShort jumps[VG_MAX_JUMPS]);
-extern Bool VG_(saneUInstr) ( Bool beforeRA, Bool beforeLiveness,
- UInstr* u );
-extern void VG_(saneUCodeBlock) ( UCodeBlock* cb );
-extern Bool VG_(saneUCodeBlockCalls) ( UCodeBlock* cb );
+extern Bool VG_(saneUInstr) ( Bool beforeRA, Bool beforeLiveness,
+ UInstr* u );
+extern void VG_(saneUCodeBlock) ( UCodeBlock* cb );
+extern Bool VG_(saneUCodeBlockCalls) ( UCodeBlock* cb );
+extern void VG_(print_reg_alloc_stats) ( void );
/* ---------------------------------------------------------------------
Exports of vg_execontext.c.
@@ -1358,24 +1359,6 @@
extern UInt VG_(unchained_jumps_done);
-/* Counts pertaining to the register allocator. */
-
-/* total number of uinstrs input to reg-alloc */
-extern UInt VG_(uinstrs_prealloc);
-
-/* total number of uinstrs added due to spill code */
-extern UInt VG_(uinstrs_spill);
-
-/* number of bbs requiring spill code */
-extern UInt VG_(translations_needing_spill);
-
-/* total of register ranks over all translations */
-extern UInt VG_(total_reg_rank);
-
-/* Counts pertaining to internal sanity checking. */
-extern UInt VG_(sanity_fast_count);
-extern UInt VG_(sanity_slow_count);
-
/* Counts pertaining to the scheduler. */
extern UInt VG_(num_scheduling_events_MINOR);
extern UInt VG_(num_scheduling_events_MAJOR);
diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c
index b70eb5f..f1842fe 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -261,13 +261,7 @@
VG_(num_scheduling_events_MINOR),
VG_(tt_fast_misses));
- VG_(message)(Vg_DebugMsg,
- "reg-alloc: %d t-req-spill, "
- "%d+%d orig+spill uis, %d total-reg-r.",
- VG_(translations_needing_spill),
- VG_(uinstrs_prealloc),
- VG_(uinstrs_spill),
- VG_(total_reg_rank) );
+ VG_(print_reg_alloc_stats)();
VG_(message)(Vg_DebugMsg,
" sanity: %d cheap, %d expensive checks.",
sanity_fast_count, sanity_slow_count );
diff --git a/coregrind/vg_translate.c b/coregrind/vg_translate.c
index c3ac298..9f9be02 100644
--- a/coregrind/vg_translate.c
+++ b/coregrind/vg_translate.c
@@ -37,6 +37,23 @@
#define dis VG_(print_codegen)
+/*------------------------------------------------------------*/
+/*--- Reg-alloc stats ---*/
+/*------------------------------------------------------------*/
+
+static UInt n_uinstrs_prealloc; // # uinstrs input to reg-alloc
+static UInt n_uinstrs_spill; // # uinstrs added due to spill code
+static UInt n_translations_needing_spill; // # bbs requiring spill code
+static UInt n_total_reg_rank; // total of register ranks over all translations
+
+void VG_(print_reg_alloc_stats)(void)
+{
+ VG_(message)(Vg_DebugMsg,
+ "reg-alloc: %d t-req-spill, "
+ "%d+%d orig+spill uis, %d total-reg-r.",
+ n_translations_needing_spill,
+ n_uinstrs_prealloc, n_uinstrs_spill, n_total_reg_rank );
+}
/*------------------------------------------------------------*/
/*--- Basics ---*/
@@ -2086,7 +2103,7 @@
max_ss_no = j;
}
- VG_(total_reg_rank) += (max_ss_no+1);
+ n_total_reg_rank += (max_ss_no+1);
/* Show live ranges and assigned spill slot nos. */
@@ -2131,7 +2148,7 @@
for (i = 0; i < c1->used; i++) {
if (c1->instrs[i].opcode == NOP) continue;
- VG_(uinstrs_prealloc)++;
+ n_uinstrs_prealloc++;
# if 0
/* Check map consistency. Expensive but correct. */
@@ -2267,7 +2284,7 @@
uInstr2(c2, PUT, 4,
RealReg, VG_(rank_to_realreg)(r),
SpillNo, temp_info[real_to_temp[r]].spill_no);
- VG_(uinstrs_spill)++;
+ n_uinstrs_spill++;
spill_reqd = True;
if (dis)
VG_(pp_UInstr)(c2->used-1, &LAST_UINSTR(c2));
@@ -2284,7 +2301,7 @@
uInstr2(c2, GET, 4,
SpillNo, temp_info[tno].spill_no,
RealReg, VG_(rank_to_realreg)(r) );
- VG_(uinstrs_spill)++;
+ n_uinstrs_spill++;
spill_reqd = True;
if (dis)
VG_(pp_UInstr)(c2->used-1, &LAST_UINSTR(c2));
@@ -2316,7 +2333,7 @@
VG_(free_UCodeBlock)(c1);
if (spill_reqd)
- VG_(translations_needing_spill)++;
+ n_translations_needing_spill++;
return c2;