}
#endif // COUNT_RANGECHECKS
+#if COUNT_AST_OPERS
+
+ // Add up all the counts so that we can show percentages of total
+ unsigned gtc = 0;
+ for (unsigned op = 0; op < GT_COUNT; op++)
+ gtc += GenTree::s_gtNodeCounts[op];
+
+ if (gtc > 0)
+ {
+ unsigned rem_total = gtc;
+ unsigned rem_large = 0;
+ unsigned rem_small = 0;
+
+ unsigned tot_large = 0;
+ unsigned tot_small = 0;
+
+ fprintf(fout, "\nGenTree operator counts (approximate):\n\n");
+
+ for (unsigned op = 0; op < GT_COUNT; op++)
+ {
+ unsigned siz = GenTree::s_gtTrueSizes[op];
+ unsigned cnt = GenTree::s_gtNodeCounts[op];
+ double pct = 100.0 * cnt / gtc;
+
+ if (siz > TREE_NODE_SZ_SMALL)
+ tot_large += cnt;
+ else
+ tot_small += cnt;
+
+ // Let's not show anything below a threshold
+ if (pct >= 0.5)
+ {
+ fprintf(fout, " GT_%-17s %7u (%4.1lf%%) %3u bytes each\n",
+ GenTree::OpName((genTreeOps)op), cnt, pct, siz);
+ rem_total -= cnt;
+ }
+ else
+ {
+ if (siz > TREE_NODE_SZ_SMALL)
+ rem_large += cnt;
+ else
+ rem_small += cnt;
+ }
+ }
+ if (rem_total > 0)
+ {
+ fprintf(fout, " All other GT_xxx ... %7u (%4.1lf%%) ... %4.1lf%% small + %4.1lf%% large\n",
+ rem_total, 100.0 * rem_total / gtc, 100.0 * rem_small / gtc, 100.0 * rem_large / gtc);
+ }
+ fprintf(fout, " -----------------------------------------------------\n");
+ fprintf(fout, " Total ....... %11u --ALL-- ... %4.1lf%% small + %4.1lf%% large\n",
+ gtc, 100.0 * tot_small / gtc, 100.0 * tot_large / gtc);
+ fprintf(fout, "\n");
+ }
+
+#endif//COUNT_AST_OPERS
+
#if DISPLAY_SIZES
if (grossVMsize && grossNCsize)
#endif
-#if defined(DEBUG) || NODEBASH_STATS
+#if defined(DEBUG) || NODEBASH_STATS || COUNT_AST_OPERS
static const char* opNames[] = {
#define GTNODE(en, sn, st, cm, ok) #en,
/* static */
unsigned char GenTree::s_gtNodeSizes[GT_COUNT + 1];
-#if NODEBASH_STATS
+#if NODEBASH_STATS || COUNT_AST_OPERS
unsigned char GenTree::s_gtTrueSizes[GT_COUNT+1]
{
#include "gtlist.h"
};
-#endif//NODEBASH_STATS
+#endif // NODEBASH_STATS || COUNT_AST_OPERS
+
+#if COUNT_AST_OPERS
+LONG GenTree::s_gtNodeCounts[GT_COUNT+1] = {0};
+#endif // COUNT_AST_OPERS
/* static */
void GenTree::InitNodeSize()
public:
#if SMALL_TREE_NODES
static unsigned char s_gtNodeSizes[];
-#if NODEBASH_STATS
+#if NODEBASH_STATS || COUNT_AST_OPERS
static unsigned char s_gtTrueSizes[];
- static const char* s_gtNodeRawNames[];
#endif
+#if COUNT_AST_OPERS
+ static LONG s_gtNodeCounts[];
#endif
+#endif // SMALL_TREE_NODES
static void InitNodeSize();
static const char* NodeName(genTreeOps op);
#endif
-#if defined(DEBUG) || NODEBASH_STATS
+#if defined(DEBUG) || NODEBASH_STATS || COUNT_AST_OPERS
static const char* OpName(genTreeOps op);
#endif
#define MEASURE_PTRTAB_SIZE 0 // Collect stats about GC pointer table allocations.
#define EMITTER_STATS 0 // Collect stats on the emitter.
#define NODEBASH_STATS 0 // Collect stats on changed gtOper values in GenTree's.
+#define COUNT_AST_OPERS 0 // Display use counts for GenTree operators.
#define VERBOSE_SIZES 0 // Always display GC info sizes. If set, DISPLAY_SIZES must also be set.
#define VERBOSE_VERIFY 0 // Dump additional information when verifying code. Useful to debug verification bugs.