Index: src/CodeTools/DeclStats.cc
===================================================================
--- src/CodeTools/DeclStats.cc	(revision 131dbb3d82aef2a9cc8891fa118693613534833d)
+++ src/CodeTools/DeclStats.cc	(revision 31868dae28110fe5b177f7170f13c7fde5505dd0)
@@ -130,4 +130,6 @@
 		std::unordered_set<std::string> seen_names;  ///< Stores manglenames already seen to avoid double-counting
 		Stats total;
+		/// Count of expressions with (depth, fanout)
+		std::map<std::pair<unsigned, unsigned>, unsigned> exprs_by_fanout_at_depth;
 
 		/// Update arg pack stats based on a declaration list
@@ -179,4 +181,15 @@
 			analyze( stats, seen, params, fnTy->get_parameters() );
 			analyze( stats, seen, returns, fnTy->get_returnVals() );
+		}
+
+		void analyzeExpr( UntypedExpr *expr, unsigned depth ) {
+			auto& args = expr->get_args();
+			unsigned fanout = args.size();
+			++exprs_by_fanout_at_depth[ std::make_pair(depth, fanout) ];
+			for ( Expression* arg : args ) {
+				if ( UntypedExpr *uearg = dynamic_cast<UntypedExpr*>(arg) ) {
+					analyzeExpr( uearg, depth+1 );
+				}
+			}
 		}
 
@@ -217,4 +230,8 @@
 		}
 
+		virtual void visit( UntypedExpr *expr ) {
+			analyzeExpr( expr, 0 );
+		}
+
 	private:
 		template<typename F>
@@ -297,4 +314,13 @@
 			printAllMap("n_distinct_types_" + name, [&extract](const Stats& stats) { return extract(stats).n_types; });
 			printAllMap("%_new_types_in_" + name, [&extract](const Stats& stats) { return extract(stats).p_new; });
+		}
+
+		void printPairMap( const std::string& name, 
+		                   const std::map<std::pair<unsigned, unsigned>, unsigned>& map ) {
+			for ( const auto& entry : map ) {
+				const auto& key = entry.first;
+				std::cout << "\"" << name << "\"," << key.first << "," << key.second << "," 
+				          << entry.second << std::endl;
+			}
 		}
 		
@@ -322,4 +348,7 @@
 			printAllPack("assn_params", [](const Stats& stats) { return stats.assn_params; });
 			printAllPack("assn_returns", [](const Stats& stats) { return stats.assn_returns; });
+			std::cout << std::endl;
+
+			printPairMap("exprs_by_depth+fanout", exprs_by_fanout_at_depth);
 		}
 	};
