Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for BasicBlock #76732

Merged
merged 5 commits into from
Sep 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,19 @@ pub struct VarDebugInfo<'tcx> {
// BasicBlock

rustc_index::newtype_index! {
/// The unit of the MIR [control-flow graph][CFG].
camelid marked this conversation as resolved.
Show resolved Hide resolved
///
/// There is no branching (e.g., `if`s, function calls, etc.) within a basic block, which makes
RalfJung marked this conversation as resolved.
Show resolved Hide resolved
camelid marked this conversation as resolved.
Show resolved Hide resolved
/// it easier to do [data-flow analyses] and optimizations. Basic blocks consist of a series of
/// [statements][`Statement`], ending with a [terminator][`Terminator`]. Basic blocks can have
/// multiple predecessors and successors.
///
/// Read more about basic blocks in the [rustc-dev-guide][guide-mir].
camelid marked this conversation as resolved.
Show resolved Hide resolved
///
/// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg
/// [data-flow analyses]:
/// https://rustc-dev-guide.rust-lang.org/appendix/background.html#what-is-a-dataflow-analysis
/// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
pub struct BasicBlock {
derive [HashStable]
DEBUG_FORMAT = "bb{}",
Expand All @@ -1092,6 +1105,7 @@ impl BasicBlock {
///////////////////////////////////////////////////////////////////////////
// BasicBlockData and Terminator

/// See [`BasicBlock`] for documentation on what basic blocks are at a high level.
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable)]
pub struct BasicBlockData<'tcx> {
/// List of statements in this block.
Expand Down