|
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; |
4 | 2 | use rustc_middle::mir::Coverage;
|
5 | 3 | use rustc_middle::ty::Instance;
|
6 | 4 |
|
7 | 5 | use crate::builder::Builder;
|
8 |
| -use crate::context::CodegenCx; |
9 | 6 |
|
10 | 7 | impl<'a, 'gcc, 'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
|
11 | 8 | fn add_coverage(&mut self, _instance: Instance<'tcx>, _coverage: &Coverage) {
|
12 | 9 | // TODO(antoyo)
|
13 | 10 | }
|
14 | 11 | }
|
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