about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/coverageinfo/mapgen.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-229/+0
2020-08-18Moved coverage counter injection from BasicBlock to Statement.Rich Kadel-9/+11
2020-08-10Merge branch 'master' into feature/incorporate-tracingpawanbisht62-14/+5
2020-08-09rustc_codegen_llvm: use IndexSet in CoverageMapGeneratorJosh Stone-14/+5
2020-08-06Merge branch 'master' into feature/incorporate-tracingpawanbisht62-12/+12
2020-08-06Incorporate tracing cratebishtpawan-1/+1
2020-08-04Completes support for coverage in external cratesRich Kadel-12/+12
The prior PR corrected for errors encountered when trying to generate the coverage map on source code inlined from external crates (including macros and generics) by avoiding adding external DefIds to the coverage map. This made it possible to generate a coverage report including external crates, but the external crate coverage was incomplete (did not include coverage for the DefIds that were eliminated. The root issue was that the coverage map was converting Span locations to source file and locations, using the SourceMap for the current crate, and this would not work for spans from external crates (compliled with a different SourceMap). The solution was to convert the Spans to filename and location during MIR generation instead, so precompiled external crates would already have the correct source code locations embedded in their MIR, when imported into another crate.
2020-07-29Moved structs/enums with repr(C) to LLVM types into ffi.rs cratesRich Kadel-2/+3
Some were in librustc_codegen_llvm, but others are not tied to LLVM, so I put them in a new crate: librustc_codegen_ssa/coverageinfo/ffi.rs
2020-07-28Refactor MIR coverage instrumentationRich Kadel-4/+4
Lays a better foundation for injecting more counters in each function.
2020-07-25Fixed coverage map issues; better aligned with LLVM APIsRich Kadel-154/+115
Found some problems with the coverage map encoding when testing with more than one counter per function. While debugging, I realized some better ways to structure the Rust implementation of the coverage mapping generator. I refactored somewhat, resulting in less code overall, expanded coverage of LLVM Coverage Map capabilities, and much closer alignment with LLVM data structures, APIs, and naming. This should be easier to follow and easier to maintain.
2020-07-17Generating the coverage mapRich Kadel-0/+274
rustc now generates the coverage map and can support (limited) coverage report generation, at the function level. Example: $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \ $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs $ LLVM_PROFILE_FILE="main.profraw" ./main called $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main 1| 1|pub fn will_be_called() { 2| 1| println!("called"); 3| 1|} 4| | 5| 0|pub fn will_not_be_called() { 6| 0| println!("should not have been called"); 7| 0|} 8| | 9| 1|fn main() { 10| 1| let less = 1; 11| 1| let more = 100; 12| 1| 13| 1| if less < more { 14| 1| will_be_called(); 15| 1| } else { 16| 1| will_not_be_called(); 17| 1| } 18| 1|}