Also hide the reg-alloc counters, and replace with a printing function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2549
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.
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);
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 );
#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 ---*/
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. */
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. */
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));
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));
VG_(free_UCodeBlock)(c1);
if (spill_reqd)
- VG_(translations_needing_spill)++;
+ n_translations_needing_spill++;
return c2;