Add new -Z dump-mir-spanview option

Similar to `-Z dump-mir-graphviz`, this adds the option to write
HTML+CSS files that allow users to analyze the spans associated with MIR
elements (by individual statement, just terminator, or overall basic
block).

This PR was split out from PR #76004, and exposes an API for spanview
HTML+CSS files that is also used to analyze code regions chosen for
coverage instrumentation (in a follow-on PR).

Rust compiler MCP rust-lang/compiler-team#278

Relevant issue: #34701 - Implement support for LLVMs code coverage
instrumentation
This commit is contained in:
Rich Kadel 2020-08-29 10:55:46 -07:00
parent 445f34bb14
commit 6b5869a0ae
11 changed files with 739 additions and 0 deletions

View file

@ -163,6 +163,21 @@ pub enum LtoCli {
Unspecified,
}
/// The different settings that the `-Z dump_mir_spanview` flag can have. `Statement` generates a
/// document highlighting each span of every statement (including terminators). `Terminator` and
/// `Block` highlight a single span per `BasicBlock`: the span of the block's `Terminator`, or a
/// computed span for the block, representing the entire range, covering the block's terminator and
/// all of its statements.
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
pub enum MirSpanview {
/// Default `-Z dump_mir_spanview` or `-Z dump_mir_spanview=statement`
Statement,
/// `-Z dump_mir_spanview=terminator`
Terminator,
/// `-Z dump_mir_spanview=block`
Block,
}
#[derive(Clone, PartialEq, Hash)]
pub enum LinkerPluginLto {
LinkerPlugin(PathBuf),