1
Fork 0

add -Zmin-function-alignment

This commit is contained in:
Folkert de Vries 2024-12-18 22:03:07 +01:00
parent a52085d9f6
commit 47573bf61e
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
8 changed files with 145 additions and 3 deletions

View file

@ -2891,6 +2891,7 @@ pub(crate) mod dep_tracking {
use std::num::NonZero;
use std::path::PathBuf;
use rustc_abi::Align;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::stable_hasher::Hash64;
use rustc_errors::LanguageIdentifier;
@ -3011,6 +3012,7 @@ pub(crate) mod dep_tracking {
InliningThreshold,
FunctionReturn,
WasmCAbi,
Align,
);
impl<T1, T2> DepTrackingHash for (T1, T2)

View file

@ -4,6 +4,7 @@ use std::num::{IntErrorKind, NonZero};
use std::path::PathBuf;
use std::str;
use rustc_abi::Align;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::profiling::TimePassesFormat;
use rustc_data_structures::stable_hasher::Hash64;
@ -455,6 +456,7 @@ mod desc {
pub(crate) const parse_wasm_c_abi: &str = "`legacy` or `spec`";
pub(crate) const parse_mir_include_spans: &str =
"either a boolean (`yes`, `no`, `on`, `off`, etc), or `nll` (default: `nll`)";
pub(crate) const parse_align: &str = "a number that is a power of 2 between 1 and 2^29";
}
pub mod parse {
@ -1533,6 +1535,21 @@ pub mod parse {
true
}
pub(crate) fn parse_align(slot: &mut Option<Align>, v: Option<&str>) -> bool {
let mut bytes = 0u64;
if !parse_number(&mut bytes, v) {
return false;
}
let Ok(align) = Align::from_bytes(bytes) else {
return false;
};
*slot = Some(align);
true
}
}
options! {
@ -1888,6 +1905,8 @@ options! {
"gather metadata statistics (default: no)"),
metrics_dir: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
"the directory metrics emitted by rustc are dumped into (implicitly enables default set of metrics)"),
min_function_alignment: Option<Align> = (None, parse_align, [TRACKED],
"align all functions to at least this many bytes. Must be a power of 2"),
mir_emit_retag: bool = (false, parse_bool, [TRACKED],
"emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
(default: no)"),