Skip to content

Commit 744d05c

Browse files
committed
Remove trait CoverageInfoMethods, since non-LLVM backends don't need it
These methods are only ever called from within `rustc_codegen_llvm`, so they can just be declared there as well.
1 parent d710bee commit 744d05c

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

Diff for: src/coverageinfo.rs

+1-34
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,11 @@
1-
use gccjit::RValue;
2-
use rustc_codegen_ssa::traits::{CoverageInfoBuilderMethods, CoverageInfoMethods};
3-
use rustc_hir::def_id::DefId;
1+
use rustc_codegen_ssa::traits::CoverageInfoBuilderMethods;
42
use rustc_middle::mir::Coverage;
53
use rustc_middle::ty::Instance;
64

75
use crate::builder::Builder;
8-
use crate::context::CodegenCx;
96

107
impl<'a, 'gcc, 'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
118
fn add_coverage(&mut self, _instance: Instance<'tcx>, _coverage: &Coverage) {
129
// TODO(antoyo)
1310
}
1411
}
15-
16-
impl<'gcc, 'tcx> CoverageInfoMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
17-
fn coverageinfo_finalize(&self) {
18-
// TODO(antoyo)
19-
}
20-
21-
fn get_pgo_func_name_var(&self, _instance: Instance<'tcx>) -> RValue<'gcc> {
22-
unimplemented!();
23-
}
24-
25-
/// Functions with MIR-based coverage are normally codegenned _only_ if
26-
/// called. LLVM coverage tools typically expect every function to be
27-
/// defined (even if unused), with at least one call to LLVM intrinsic
28-
/// `instrprof.increment`.
29-
///
30-
/// Codegen a small function that will never be called, with one counter
31-
/// that will never be incremented.
32-
///
33-
/// For used/called functions, the coverageinfo was already added to the
34-
/// `function_coverage_map` (keyed by function `Instance`) during codegen.
35-
/// But in this case, since the unused function was _not_ previously
36-
/// codegenned, collect the coverage `CodeRegion`s from the MIR and add
37-
/// them. The first `CodeRegion` is used to add a single counter, with the
38-
/// same counter ID used in the injected `instrprof.increment` intrinsic
39-
/// call. Since the function is never called, all other `CodeRegion`s can be
40-
/// added as `unreachable_region`s.
41-
fn define_unused_fn(&self, _def_id: DefId) {
42-
unimplemented!();
43-
}
44-
}

0 commit comments

Comments
 (0)