Add a -Z query-threads compiler option
This commit is contained in:
parent
f7082dcafb
commit
aa6065bd70
@ -1067,6 +1067,8 @@ fn parse_optimization_fuel(slot: &mut Option<(String, u64)>, v: Option<&str>) ->
|
||||
"prints the llvm optimization passes being run"),
|
||||
ast_json: bool = (false, parse_bool, [UNTRACKED],
|
||||
"print the AST as JSON and halt"),
|
||||
query_threads: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
|
||||
"execute queries on a thread pool with N threads"),
|
||||
ast_json_noexpand: bool = (false, parse_bool, [UNTRACKED],
|
||||
"print the pre-expansion AST as JSON and halt"),
|
||||
ls: bool = (false, parse_bool, [UNTRACKED],
|
||||
@ -1663,6 +1665,10 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
|
||||
}
|
||||
}
|
||||
|
||||
if debugging_opts.query_threads == Some(0) {
|
||||
early_error(error_format, "Value for query threads must be a positive nonzero integer");
|
||||
}
|
||||
|
||||
if codegen_units == Some(0) {
|
||||
early_error(error_format, "Value for codegen units must be a positive nonzero integer");
|
||||
}
|
||||
|
@ -725,6 +725,12 @@ pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -
|
||||
ret
|
||||
}
|
||||
|
||||
/// Returns the number of query threads that should be used for this
|
||||
/// compilation
|
||||
pub fn query_threads(&self) -> usize {
|
||||
self.opts.debugging_opts.query_threads.unwrap_or(1)
|
||||
}
|
||||
|
||||
/// Returns the number of codegen units that should be used for this
|
||||
/// compilation
|
||||
pub fn codegen_units(&self) -> usize {
|
||||
|
Loading…
Reference in New Issue
Block a user