Auto merge of #137586 - nnethercote:SetImpliedBits, r=bjorn3
Speed up target feature computation The LLVM backend calls `LLVMRustHasFeature` twice for every feature. In short-running rustc invocations, this accounts for a surprising amount of work. r? `@bjorn3`
This commit is contained in:
commit
ebf0cf75d3
9 changed files with 120 additions and 113 deletions
|
@ -190,7 +190,7 @@ pub(crate) fn provide(providers: &mut Providers) {
|
|||
},
|
||||
implied_target_features: |tcx, feature: Symbol| {
|
||||
let feature = feature.as_str();
|
||||
UnordSet::from(tcx.sess.target.implied_target_features(std::iter::once(feature)))
|
||||
UnordSet::from(tcx.sess.target.implied_target_features(feature))
|
||||
.into_sorted_stable_ord()
|
||||
.into_iter()
|
||||
.map(|s| Symbol::intern(s))
|
||||
|
|
|
@ -45,10 +45,13 @@ pub trait CodegenBackend {
|
|||
|
||||
fn print(&self, _req: &PrintRequest, _out: &mut String, _sess: &Session) {}
|
||||
|
||||
/// Returns the features that should be set in `cfg(target_features)`.
|
||||
/// Returns two feature sets:
|
||||
/// - The first has the features that should be set in `cfg(target_features)`.
|
||||
/// - The second is like the first, but also includes unstable features.
|
||||
///
|
||||
/// RUSTC_SPECIFIC_FEATURES should be skipped here, those are handled outside codegen.
|
||||
fn target_features_cfg(&self, _sess: &Session, _allow_unstable: bool) -> Vec<Symbol> {
|
||||
vec![]
|
||||
fn target_features_cfg(&self, _sess: &Session) -> (Vec<Symbol>, Vec<Symbol>) {
|
||||
(vec![], vec![])
|
||||
}
|
||||
|
||||
fn print_passes(&self) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue