Skip to content

Commit 12c691e

Browse files
committed
More accurate function naming
1 parent b75956d commit 12c691e

File tree

8 files changed

+13
-10
lines changed

8 files changed

+13
-10
lines changed

compiler/rustc_codegen_cranelift/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
249249
link_binary(sess, &crate::archive::ArArchiveBuilderBuilder, &codegen_results, outputs)
250250
}
251251

252-
fn implemented_intrinsics(&self) -> &'static [Symbol] {
252+
fn overridden_intrinsics(&self) -> &'static [Symbol] {
253253
&[]
254254
}
255255
}

compiler/rustc_codegen_gcc/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl CodegenBackend for GccCodegenBackend {
244244
target_features(sess, allow_unstable, &self.target_info)
245245
}
246246

247-
fn implemented_intrinsics(&self) -> &'static [Symbol] {
247+
fn overridden_intrinsics(&self) -> &'static [Symbol] {
248248
&[sym::is_val_statically_known]
249249
}
250250
}

compiler/rustc_codegen_llvm/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ impl CodegenBackend for LlvmCodegenBackend {
403403
link_binary(sess, &LlvmArchiveBuilderBuilder, &codegen_results, outputs)
404404
}
405405

406-
fn implemented_intrinsics(&self) -> &'static [Symbol] {
406+
fn overridden_intrinsics(&self) -> &'static [Symbol] {
407407
&[sym::is_val_statically_known]
408408
}
409409
}

compiler/rustc_codegen_ssa/src/traits/backend.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ pub trait CodegenBackend {
112112
outputs: &OutputFilenames,
113113
) -> Result<(), ErrorGuaranteed>;
114114

115-
/// Returns the list of intrinsics that should not use their fallback body
116-
fn implemented_intrinsics(&self) -> &'static [Symbol];
115+
/// Returns the list of intrinsics that the backend has custom codegen logic for
116+
/// and should thus not use their default (pure Rust) bodies.
117+
/// This only works for `rustc_intrinsic` intrinsics, not `extern "rust-intrinsic"`
118+
/// intrinsics.
119+
fn overridden_intrinsics(&self) -> &'static [Symbol];
117120
}
118121

119122
pub trait ExtraBackendMethods:

compiler/rustc_interface/src/queries.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ impl<'tcx> Queries<'tcx> {
165165
feed.crate_name(crate_name);
166166

167167
let feed = tcx.feed_unit_query();
168-
feed.intrinsics_implemented_by_backend(
169-
self.compiler.codegen_backend.implemented_intrinsics(),
168+
feed.intrinsics_overridden_by_backend(
169+
self.compiler.codegen_backend.overridden_intrinsics(),
170170
);
171171
feed.features_query(tcx.arena.alloc(rustc_expand::config::features(
172172
sess,

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2105,7 +2105,7 @@ rustc_queries! {
21052105
desc { "looking up enabled feature gates" }
21062106
}
21072107

2108-
query intrinsics_implemented_by_backend(_: ()) -> &'static [Symbol] {
2108+
query intrinsics_overridden_by_backend(_: ()) -> &'static [Symbol] {
21092109
feedable
21102110
desc { "list of intrinsics with default bodies supported by the codegen backend" }
21112111
}

compiler/rustc_middle/src/ty/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ pub fn intrinsic(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<Symbol> {
15491549
.ident()
15501550
.unwrap()
15511551
.name;
1552-
tcx.intrinsics_implemented_by_backend(()).contains(&name).then_some(name)
1552+
tcx.intrinsics_overridden_by_backend(()).contains(&name).then_some(name)
15531553
} else {
15541554
None
15551555
}

tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl CodegenBackend for TheBackend {
8989
Ok(())
9090
}
9191

92-
fn implemented_intrinsics(&self) -> &'static [Symbol] {
92+
fn overridden_intrinsics(&self) -> &'static [Symbol] {
9393
&[]
9494
}
9595
}

0 commit comments

Comments
 (0)