about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/traits
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-07-05 17:39:40 +1000
committerZalathar <Zalathar@users.noreply.github.com>2023-07-05 20:40:39 +1000
commit4169d0f756dde8b3e692610bddb3c948c5cd53ea (patch)
treecf8c7b11e9e37ade96a7b866049834347d66e1ae /compiler/rustc_codegen_ssa/src/traits
parent6dab6dc5fcd9655adfa7bfb3e59e5cae487184d2 (diff)
Narrow trait `CoverageInfoBuilderMethods` down to just one method
This effectively inlines most of `FunctionCx::codegen_coverage` into the LLVM
implementation of `CoverageInfoBuilderMethods`.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/traits')
-rw-r--r--compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs40
1 files changed, 6 insertions, 34 deletions
diff --git a/compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs b/compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs
index e77201cf0c8..75b125b3016 100644
--- a/compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs
+++ b/compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs
@@ -1,6 +1,6 @@
 use super::BackendTypes;
 use rustc_hir::def_id::DefId;
-use rustc_middle::mir::coverage::*;
+use rustc_middle::mir::Coverage;
 use rustc_middle::ty::Instance;
 
 pub trait CoverageInfoMethods<'tcx>: BackendTypes {
@@ -21,37 +21,9 @@ pub trait CoverageInfoMethods<'tcx>: BackendTypes {
 }
 
 pub trait CoverageInfoBuilderMethods<'tcx>: BackendTypes {
-    /// Returns true if the function source hash was added to the coverage map (even if it had
-    /// already been added, for this instance). Returns false *only* if `-C instrument-coverage` is
-    /// not enabled (a coverage map is not being generated).
-    fn set_function_source_hash(
-        &mut self,
-        instance: Instance<'tcx>,
-        function_source_hash: u64,
-    ) -> bool;
-
-    /// Returns true if the counter was added to the coverage map; false if `-C instrument-coverage`
-    /// is not enabled (a coverage map is not being generated).
-    fn add_coverage_counter(
-        &mut self,
-        instance: Instance<'tcx>,
-        index: CounterValueReference,
-        region: CodeRegion,
-    ) -> bool;
-
-    /// Returns true if the expression was added to the coverage map; false if
-    /// `-C instrument-coverage` is not enabled (a coverage map is not being generated).
-    fn add_coverage_counter_expression(
-        &mut self,
-        instance: Instance<'tcx>,
-        id: InjectedExpressionId,
-        lhs: ExpressionOperandId,
-        op: Op,
-        rhs: ExpressionOperandId,
-        region: Option<CodeRegion>,
-    ) -> bool;
-
-    /// Returns true if the region was added to the coverage map; false if `-C instrument-coverage`
-    /// is not enabled (a coverage map is not being generated).
-    fn add_coverage_unreachable(&mut self, instance: Instance<'tcx>, region: CodeRegion) -> bool;
+    /// Handle the MIR coverage info in a backend-specific way.
+    ///
+    /// This can potentially be a no-op in backends that don't support
+    /// coverage instrumentation.
+    fn add_coverage(&mut self, instance: Instance<'tcx>, coverage: &Coverage);
 }