]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
sanity_*_count don't need to be in vg_include.h.
authorNicholas Nethercote <n.nethercote@gmail.com>
Mon, 2 Aug 2004 15:17:43 +0000 (15:17 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Mon, 2 Aug 2004 15:17:43 +0000 (15:17 +0000)
Also hide the reg-alloc counters, and replace with a printing function.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2549

coregrind/vg_include.h
coregrind/vg_main.c
coregrind/vg_translate.c

index 1467785093ca7777516c7bfbf086556b2ebf9388..c6d45b7d31f7abaf1677d762d913f00c403e582f 100644 (file)
@@ -1172,18 +1172,19 @@ struct _UCodeBlock {
 
 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_(bb_dechain_count);
 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);
index b70eb5fc63c27db8ba624e66e93252fd02f29b1d..f1842fe23499652527bb2f874faac75cd86985d9 100644 (file)
@@ -261,13 +261,7 @@ static void show_counts ( void )
                      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 );
index c3ac29849b244a377384e4eae5475d4c132cf781..9f9be027fc17a5b2947dd646b1fbf7ffb56af14c 100644 (file)
 
 #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 @@ UCodeBlock* vg_do_register_allocation ( UCodeBlock* c1 )
          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 @@ UCodeBlock* vg_do_register_allocation ( UCodeBlock* c1 )
    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 @@ UCodeBlock* vg_do_register_allocation ( UCodeBlock* c1 )
             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 @@ UCodeBlock* vg_do_register_allocation ( UCodeBlock* c1 )
             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 @@ UCodeBlock* vg_do_register_allocation ( UCodeBlock* c1 )
    VG_(free_UCodeBlock)(c1);
 
    if (spill_reqd) 
-      VG_(translations_needing_spill)++;
+      n_translations_needing_spill++;
 
    return c2;