Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
cwh_stats.cxx
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 /* ====================================================================
00037  * ====================================================================
00038  *
00039  *
00040  * Revision history:
00041  *  dd-mmm-95 - Original Version
00042  *
00043  * Description: Accumulates and prints statistics about the
00044  *              conversion. Essentially a bunch of counters,
00045  *              and associated strings.
00046  *
00047  *              Counters for TYs are defined,
00048  *              but there's no reason others couldn't be
00049  *              added. Enums and macros in cwh_stats.h
00050  *              define the counter groups and cwh_stats.i contains
00051  *              the local definitions and strings.
00052  *
00053  * ====================================================================
00054  * ====================================================================
00055  */
00056 
00057 static char *source_file = __FILE__;
00058 
00059 #ifdef _KEEP_RCS_ID
00060 #endif /* _KEEP_RCS_ID */
00061 
00062 
00063 /* sgi includes */
00064 
00065 #include "defs.h"
00066 #include "stab.h"
00067 #include "tracing.h"
00068 
00069 /* conversion includes */
00070 
00071 #include "cwh_stats.h"
00072 #include "cwh_stats.i"
00073 
00074 /*================================================================
00075  *
00076  * cwh_stats_print
00077  *
00078  * Top level routine to print stats. Calls one routine 
00079  * for each group of items to print. Pass in the PU's ST.
00080  *
00081  * Only TY details are printed just now.
00082  *
00083  * invoked via -ttIRB:16 
00084  *
00085  * ================================================================
00086  */
00087 extern void 
00088 cwh_stats_print(ST * st) 
00089 {
00090   CTR * cp ;
00091 
00092   fprintf (TFile,"\n%s (last TY id %d) ",ST_name(st),SYMTAB_last_type_id(Global_Symtab));
00093 
00094   if (ST_pu_is_nested_func(st)) 
00095     fprintf (TFile," (internal) ");
00096 
00097   fprintf (TFile," \n \n");
00098 
00099   cwh_stats_print_details(&ty_c) ;
00100 
00101 }
00102 
00103 /*================================================================
00104  *
00105  * cwh_stats_print_details
00106  *
00107  * Walk through array  of counters 
00108  *
00109  * a) print the values
00110  * b) save current values to compute increments per PU.
00111  * c) sum the values.
00112  *
00113  * ================================================================
00114  */
00115 static void 
00116 cwh_stats_print_details( CTR * cp ) 
00117 {
00118 
00119   int sum,i,val ;
00120   sum = 0 ;
00121 
00122   fprintf (TFile,CTR_misc_str(cp,0));
00123 
00124   for (i = 0 ; i < CTR_num(cp) ; i ++) {
00125 
00126     val = CTR_count(cp,i);
00127 
00128     if (CTR_add_to_sum(cp,i))
00129       sum += val ;
00130 
00131     if (val != 0) 
00132       fprintf (TFile,CTR_str(cp,i),val,val-CTR_saved(cp,i));
00133 
00134     CTR_saved(cp,i) = val;
00135   
00136   }
00137 
00138   fprintf (TFile,CTR_misc_str(cp,1));
00139   fprintf (TFile,CTR_misc_str(cp,2),sum,sum-CTR_saved_sum(cp)) ;
00140   CTR_saved_sum(cp) = sum;
00141 
00142 }
00143 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines