Add -Zinput-stats

Emits loc, and node count - before and after expansion.

E.g.,

```
rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore
Lines of code:             32060
Pre-expansion node count:  120205
Post-expansion node count: 482749
```
This commit is contained in:
Nick Cameron 2015-11-11 18:26:14 +13:00
parent f1f5c04c07
commit f7dc917ba4
5 changed files with 218 additions and 26 deletions

View file

@ -510,7 +510,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"debug info emission level, 0 = no debug info, 1 = line tables only, \
2 = full debug info with variable and type information"),
opt_level: Option<usize> = (None, parse_opt_uint,
"Optimize with possible levels 0-3"),
"optimize with possible levels 0-3"),
debug_assertions: Option<bool> = (None, parse_opt_bool,
"explicitly enable the cfg(debug_assertions) directive"),
}
@ -527,6 +527,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"count where LLVM instrs originate"),
time_llvm_passes: bool = (false, parse_bool,
"measure time of each LLVM pass"),
input_stats: bool = (false, parse_bool,
"gather statistics about the input"),
trans_stats: bool = (false, parse_bool,
"gather trans statistics"),
asm_comments: bool = (false, parse_bool,
@ -544,56 +546,56 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
meta_stats: bool = (false, parse_bool,
"gather metadata statistics"),
print_link_args: bool = (false, parse_bool,
"Print the arguments passed to the linker"),
"print the arguments passed to the linker"),
gc: bool = (false, parse_bool,
"Garbage collect shared data (experimental)"),
"garbage collect shared data (experimental)"),
print_llvm_passes: bool = (false, parse_bool,
"Prints the llvm optimization passes being run"),
"prints the llvm optimization passes being run"),
ast_json: bool = (false, parse_bool,
"Print the AST as JSON and halt"),
"print the AST as JSON and halt"),
ast_json_noexpand: bool = (false, parse_bool,
"Print the pre-expansion AST as JSON and halt"),
"print the pre-expansion AST as JSON and halt"),
ls: bool = (false, parse_bool,
"List the symbols defined by a library crate"),
"list the symbols defined by a library crate"),
save_analysis: bool = (false, parse_bool,
"Write syntax and type analysis information in addition to normal output"),
"write syntax and type analysis information in addition to normal output"),
print_move_fragments: bool = (false, parse_bool,
"Print out move-fragment data for every fn"),
"print out move-fragment data for every fn"),
flowgraph_print_loans: bool = (false, parse_bool,
"Include loan analysis data in --unpretty flowgraph output"),
"include loan analysis data in --unpretty flowgraph output"),
flowgraph_print_moves: bool = (false, parse_bool,
"Include move analysis data in --unpretty flowgraph output"),
"include move analysis data in --unpretty flowgraph output"),
flowgraph_print_assigns: bool = (false, parse_bool,
"Include assignment analysis data in --unpretty flowgraph output"),
"include assignment analysis data in --unpretty flowgraph output"),
flowgraph_print_all: bool = (false, parse_bool,
"Include all dataflow analysis data in --unpretty flowgraph output"),
"include all dataflow analysis data in --unpretty flowgraph output"),
print_region_graph: bool = (false, parse_bool,
"Prints region inference graph. \
"prints region inference graph. \
Use with RUST_REGION_GRAPH=help for more info"),
parse_only: bool = (false, parse_bool,
"Parse only; do not compile, assemble, or link"),
"parse only; do not compile, assemble, or link"),
no_trans: bool = (false, parse_bool,
"Run all passes except translation; no output"),
"run all passes except translation; no output"),
treat_err_as_bug: bool = (false, parse_bool,
"Treat all errors that occur as bugs"),
"treat all errors that occur as bugs"),
no_analysis: bool = (false, parse_bool,
"Parse and expand the source, but run no analysis"),
"parse and expand the source, but run no analysis"),
extra_plugins: Vec<String> = (Vec::new(), parse_list,
"load extra plugins"),
unstable_options: bool = (false, parse_bool,
"Adds unstable command line options to rustc interface"),
"adds unstable command line options to rustc interface"),
print_enum_sizes: bool = (false, parse_bool,
"Print the size of enums and their variants"),
"print the size of enums and their variants"),
force_overflow_checks: Option<bool> = (None, parse_opt_bool,
"Force overflow checks on or off"),
"force overflow checks on or off"),
force_dropflag_checks: Option<bool> = (None, parse_opt_bool,
"Force drop flag checks on or off"),
"force drop flag checks on or off"),
trace_macros: bool = (false, parse_bool,
"For every macro invocation, print its name and arguments"),
"for every macro invocation, print its name and arguments"),
enable_nonzeroing_move_hints: bool = (false, parse_bool,
"Force nonzeroing move optimization on"),
"force nonzeroing move optimization on"),
keep_mtwt_tables: bool = (false, parse_bool,
"Don't clear the resolution tables after analysis"),
"don't clear the resolution tables after analysis"),
}
pub fn default_lib_output() -> CrateType {