Rollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses-for-that, r=cjgillot
Remove wrapper functions for some unstable options They are trivial and just forward to the option. Like most other options, we can just access it directly.
This commit is contained in:
commit
6689d2df08
@ -102,10 +102,10 @@ pub fn uwtable_attr(llcx: &llvm::Context) -> &Attribute {
|
||||
|
||||
pub fn frame_pointer_type_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
let mut fp = cx.sess().target.frame_pointer;
|
||||
let opts = &cx.sess().opts;
|
||||
// "mcount" function relies on stack pointer.
|
||||
// See <https://sourceware.org/binutils/docs/gprof/Implementation.html>.
|
||||
if cx.sess().instrument_mcount() || matches!(cx.sess().opts.cg.force_frame_pointers, Some(true))
|
||||
{
|
||||
if opts.unstable_opts.instrument_mcount || matches!(opts.cg.force_frame_pointers, Some(true)) {
|
||||
fp = FramePointer::Always;
|
||||
}
|
||||
let attr_value = match fp {
|
||||
@ -119,7 +119,7 @@ pub fn frame_pointer_type_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attr
|
||||
/// Tell LLVM what instrument function to insert.
|
||||
#[inline]
|
||||
fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
if cx.sess().instrument_mcount() {
|
||||
if cx.sess().opts.unstable_opts.instrument_mcount {
|
||||
// Similar to `clang -pg` behavior. Handled by the
|
||||
// `post-inline-ee-instrument` LLVM pass.
|
||||
|
||||
|
@ -203,7 +203,7 @@ pub fn target_machine_factory(
|
||||
sess.opts.unstable_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable);
|
||||
let emit_stack_size_section = sess.opts.unstable_opts.emit_stack_sizes;
|
||||
|
||||
let asm_comments = sess.asm_comments();
|
||||
let asm_comments = sess.opts.unstable_opts.asm_comments;
|
||||
let relax_elf_relocations =
|
||||
sess.opts.unstable_opts.relax_elf_relocations.unwrap_or(sess.target.relax_elf_relocations);
|
||||
|
||||
|
@ -81,10 +81,10 @@ fn llvm_arg_to_arg_name(full_arg: &str) -> &str {
|
||||
};
|
||||
// Set the llvm "program name" to make usage and invalid argument messages more clear.
|
||||
add("rustc -Cllvm-args=\"...\" with", true);
|
||||
if sess.time_llvm_passes() {
|
||||
if sess.opts.unstable_opts.time_llvm_passes {
|
||||
add("-time-passes", false);
|
||||
}
|
||||
if sess.print_llvm_passes() {
|
||||
if sess.opts.unstable_opts.print_llvm_passes {
|
||||
add("-debug-pass=Structure", false);
|
||||
}
|
||||
if sess.target.generate_arange_section
|
||||
|
@ -1899,7 +1899,7 @@ pub fn join(self, sess: &Session) -> (CodegenResults, FxHashMap<WorkProductId, W
|
||||
|
||||
// FIXME: time_llvm_passes support - does this use a global context or
|
||||
// something?
|
||||
if sess.codegen_units() == 1 && sess.time_llvm_passes() {
|
||||
if sess.codegen_units() == 1 && sess.opts.unstable_opts.time_llvm_passes {
|
||||
self.backend.print_pass_timings()
|
||||
}
|
||||
|
||||
|
@ -681,7 +681,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
|
||||
});
|
||||
|
||||
let mut total_codegen_time = Duration::new(0, 0);
|
||||
let start_rss = tcx.sess.time_passes().then(|| get_resident_set_size());
|
||||
let start_rss = tcx.sess.opts.unstable_opts.time_passes.then(|| get_resident_set_size());
|
||||
|
||||
// The non-parallel compiler can only translate codegen units to LLVM IR
|
||||
// on a single thread, leading to a staircase effect where the N LLVM
|
||||
@ -781,7 +781,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
|
||||
|
||||
// Since the main thread is sometimes blocked during codegen, we keep track
|
||||
// -Ztime-passes output manually.
|
||||
if tcx.sess.time_passes() {
|
||||
if tcx.sess.opts.unstable_opts.time_passes {
|
||||
let end_rss = get_resident_set_size();
|
||||
|
||||
print_time_passes_entry(
|
||||
|
@ -713,7 +713,7 @@ macro_rules! stat {
|
||||
let computed_total_bytes: usize = stats.iter().map(|(_, size)| size).sum();
|
||||
assert_eq!(total_bytes, computed_total_bytes);
|
||||
|
||||
if tcx.sess.meta_stats() {
|
||||
if tcx.sess.opts.unstable_opts.meta_stats {
|
||||
self.opaque.flush();
|
||||
|
||||
// Rewind and re-read all the metadata to count the zero bytes we wrote.
|
||||
|
@ -1214,7 +1214,6 @@ pub(crate) fn parse_proc_macro_execution_strategy(
|
||||
"only allow the listed language features to be enabled in code (space separated)"),
|
||||
always_encode_mir: bool = (false, parse_bool, [TRACKED],
|
||||
"encode MIR of all functions into the crate metadata (default: no)"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::asm_comments` instead of this field")]
|
||||
asm_comments: bool = (false, parse_bool, [TRACKED],
|
||||
"generate comments into the assembly (may change behavior) (default: no)"),
|
||||
assert_incr_state: Option<String> = (None, parse_opt_string, [UNTRACKED],
|
||||
@ -1363,7 +1362,6 @@ pub(crate) fn parse_proc_macro_execution_strategy(
|
||||
`=except-unused-generics`
|
||||
`=except-unused-functions`
|
||||
`=off` (default)"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::instrument_mcount` instead of this field")]
|
||||
instrument_mcount: bool = (false, parse_bool, [TRACKED],
|
||||
"insert function instrument code for mcount-based tracing (default: no)"),
|
||||
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
|
||||
@ -1392,7 +1390,6 @@ pub(crate) fn parse_proc_macro_execution_strategy(
|
||||
merge_functions: Option<MergeFunctions> = (None, parse_merge_functions, [TRACKED],
|
||||
"control the operation of the MergeFunctions LLVM pass, taking \
|
||||
the same values as the target option of the same name"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::meta_stats` instead of this field")]
|
||||
meta_stats: bool = (false, parse_bool, [UNTRACKED],
|
||||
"gather metadata statistics (default: no)"),
|
||||
mir_emit_retag: bool = (false, parse_bool, [TRACKED],
|
||||
@ -1469,7 +1466,6 @@ pub(crate) fn parse_proc_macro_execution_strategy(
|
||||
See #77382 and #74551."),
|
||||
print_fuel: Option<String> = (None, parse_opt_string, [TRACKED],
|
||||
"make rustc print the total optimization fuel used by a crate"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::print_llvm_passes` instead of this field")]
|
||||
print_llvm_passes: bool = (false, parse_bool, [UNTRACKED],
|
||||
"print the LLVM optimization passes being run (default: no)"),
|
||||
print_mono_items: Option<String> = (None, parse_opt_string, [UNTRACKED],
|
||||
@ -1583,10 +1579,8 @@ pub(crate) fn parse_proc_macro_execution_strategy(
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::threads` instead of this field")]
|
||||
threads: usize = (1, parse_threads, [UNTRACKED],
|
||||
"use a thread pool with N threads"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::time_llvm_passes` instead of this field")]
|
||||
time_llvm_passes: bool = (false, parse_bool, [UNTRACKED],
|
||||
"measure time of each LLVM pass (default: no)"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::time_passes` instead of this field")]
|
||||
time_passes: bool = (false, parse_bool, [UNTRACKED],
|
||||
"measure time of each rustc pass (default: no)"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::tls_model` instead of this field")]
|
||||
|
@ -976,34 +976,10 @@ pub fn verbose(&self) -> bool {
|
||||
self.opts.unstable_opts.verbose
|
||||
}
|
||||
|
||||
pub fn instrument_mcount(&self) -> bool {
|
||||
self.opts.unstable_opts.instrument_mcount
|
||||
}
|
||||
|
||||
pub fn time_passes(&self) -> bool {
|
||||
self.opts.unstable_opts.time_passes
|
||||
}
|
||||
|
||||
pub fn time_llvm_passes(&self) -> bool {
|
||||
self.opts.unstable_opts.time_llvm_passes
|
||||
}
|
||||
|
||||
pub fn meta_stats(&self) -> bool {
|
||||
self.opts.unstable_opts.meta_stats
|
||||
}
|
||||
|
||||
pub fn asm_comments(&self) -> bool {
|
||||
self.opts.unstable_opts.asm_comments
|
||||
}
|
||||
|
||||
pub fn verify_llvm_ir(&self) -> bool {
|
||||
self.opts.unstable_opts.verify_llvm_ir || option_env!("RUSTC_VERIFY_LLVM_IR").is_some()
|
||||
}
|
||||
|
||||
pub fn print_llvm_passes(&self) -> bool {
|
||||
self.opts.unstable_opts.print_llvm_passes
|
||||
}
|
||||
|
||||
pub fn binary_dep_depinfo(&self) -> bool {
|
||||
self.opts.unstable_opts.binary_dep_depinfo
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user