diff options
| author | Ralf Jung <post@ralfj.de> | 2020-06-19 14:29:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-19 14:29:20 +0200 |
| commit | 1dc6c3c4ad2d08cc8d8d414cd04cbf0350e2bb14 (patch) | |
| tree | 38f8f485a73ff92ce90afeb89552b67929d33bb4 /src/libcore | |
| parent | 7cc45183cac5a4cfea21ecf94aa397781b969ea4 (diff) | |
| parent | 36c9014ddd3e2ac6b6a0e9f623e791281c40473d (diff) | |
| download | rust-1dc6c3c4ad2d08cc8d8d414cd04cbf0350e2bb14.tar.gz rust-1dc6c3c4ad2d08cc8d8d414cd04cbf0350e2bb14.zip | |
Rollup merge of #73011 - richkadel:llvm-count-from-mir-pass, r=tmandry
first stage of implementing LLVM code coverage This PR replaces #70680 (WIP toward LLVM Code Coverage for Rust) since I am re-implementing the Rust LLVM code coverage feature in a different part of the compiler (in MIR pass(es) vs AST). This PR updates rustc with `-Zinstrument-coverage` option that injects the llvm intrinsic `instrprof.increment()` for code generation. This initial version only injects counters at the top of each function, and does not yet implement the required coverage map. Upcoming PRs will add the coverage map, and add more counters and/or counter expressions for each conditional code branch. Rust compiler MCP https://github.com/rust-lang/compiler-team/issues/278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation ***[I put together some development notes here, under a separate branch.](https://github.com/richkadel/rust/blob/cfa0b21d34ee64e4ebee226101bd2ef0c6757865/src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md)***
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 85076a573b5..2d3e1814661 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1941,6 +1941,13 @@ extern "rust-intrinsic" { /// /// Perma-unstable: do not use. pub fn miri_start_panic(payload: *mut u8) -> !; + + /// Internal placeholder for injecting code coverage counters when the "instrument-coverage" + /// option is enabled. The placeholder is replaced with `llvm.instrprof.increment` during code + /// generation. + #[cfg(not(bootstrap))] + #[lang = "count_code_region"] + pub fn count_code_region(index: u32); } // Some functions are defined here because they accidentally got made |
