rustc_middle::mir - Rust (original) (raw)
Expand description
MIR datatypes and passes. See the rustc dev guide for more info.
pub use self::graphviz::[write_mir_graphviz](graphviz/fn.write%5Fmir%5Fgraphviz.html "fn rustc_middle::mir::graphviz::write_mir_graphviz");
pub use self:🦋:[PassWhere](pretty/enum.PassWhere.html "enum rustc_middle::mir:🦋:PassWhere");
pub use self:🦋:[create_dump_file](pretty/fn.create%5Fdump%5Ffile.html "fn rustc_middle::mir:🦋:create_dump_file");
pub use self:🦋:[display_allocation](pretty/fn.display%5Fallocation.html "fn rustc_middle::mir:🦋:display_allocation");
pub use self:🦋:[dump_enabled](pretty/fn.dump%5Fenabled.html "fn rustc_middle::mir:🦋:dump_enabled");
pub use self:🦋:[dump_mir](pretty/fn.dump%5Fmir.html "fn rustc_middle::mir:🦋:dump_mir");
pub use self:🦋:[write_mir_pretty](pretty/fn.write%5Fmir%5Fpretty.html "fn rustc_middle::mir:🦋:write_mir_pretty");
consts 🔒
Metadata from source code coverage analysis and instrumentation.
An interpreter for MIR used in CTFE and by miri.
query 🔒
Values computed by queries that use MIR.
Functionality for statements, operands, places, and things that appear in them.
syntax 🔒
This defines the syntax of MIR, i.e., the set of available MIR operations, and other definitions closely related to MIR semantics. This is in a dedicated file so that changes to this file can be reviewed more carefully. The intention is that this file only contains datatype declarations, no code.
Functionality for terminators and helper types that appear in terminators.
The MIR Visitor
A node in the MIR control-flow graph.
Data for a basic block, including a list of its statements.
BlockTailInfo
is attached to the LocalDecl
for temporaries created during evaluation of expressions in a block tail expression; that is, a block like { STMT_1; STMT_2; EXPR }
.
The lowered representation of a single function.
All the opaque types that are restricted to concrete types by this function. Unlike the value in TypeckResults
, this has unerased regions.
Evaluated Constants Represents the result of const evaluation via the eval_to_allocation
query. Not to be confused with ConstAllocation
, which directly refers to the underlying data! Here we indirect via an AllocId
.
The result of the mir_const_qualif
query.
Additional information carried by a MIR body when it is lowered from a coroutine. This information is modified as it is lowered during the StateTransform
MIR pass, so not all fields will be active at a given time. For example, the yield_ty
is taken out of the field after yields are turned into returns, and the coroutine_drop
body is only populated after the state transform pass.
The layout of coroutine state.
The constituent parts of a mir constant of kind ADT or array.
A MIR local.
Location
represents the position of the start of the statement; or, ifstatement_index
equals the number of statements, then the start of the terminator.
Where a specific mir::Body
comes from.
Places roughly correspond to a “location in memory.” Places in MIR are the same mathematical object as places in Rust. This of course means that what exactly they are is undecided and part of the Rust memory model. However, they will likely contain at least the following pieces of information in some form:
Grouped information about the source code origin of a MIR entity. Intended to be inspected by diagnostics and debuginfo. Most passes can work with it as a whole, within a single function.
A statement in a basic block, including information about its source code.
An unevaluated (potentially generic) constant used in MIR.
Encodes the effect of a user-supplied type annotation on the subcomponents of a pattern. The effect is determined by applying the given list of projections to some underlying base type. Often, the projection element list projs
is empty, in which case this directly encodes a type in base
. But in the case of complex patterns with subpatterns and bindings, we want to apply only a part of the type to a variable, in which case the projs
vector is used.
A collection of projections into user types.
Debug information pertaining to a user variable.
See MirPhase::Analysis.
Information about an assertion failure.
BackwardIncompatibleDropReason
List of places that are written to after a successful (non-unwind) return from a Call
, Yield
or InlineAsm
.
Represents how a TerminatorKind::Call was constructed. Used only for diagnostics.
Represents how a CastKind::PointerCoercion was constructed. Used only for diagnostics.
Constants
Represents a constant value in Rust. Scalar
and Slice
are optimizations for array length computations, enum discriminants and the pattern matching logic.
Outlives-constraints can be categorized to determine whether and why they are interesting (for error reporting). Order of variants indicates sort order of the category, thereby influencing diagnostic output.
DefLocation
represents the location of a definition - either an argument or an assignment within MIR body.
The FakeReadCause
describes the type of pattern why a FakeRead statement exists.
The macro that an inline assembly block was created by
Extra information about a some locals that’s used for diagnostics and for classifying variables into local variables, statics, etc, which is needed e.g. for borrow checking.
Classifies locals into categories. See Body::local_kind
.
Some item that needs to monomorphize successfully for a MIR body to be considered well-formed.
Represents the “flavors” of MIR.
An operand in MIR represents a “value” in Rust, the definition of which is undecided and part of the memory model. One proposal for a definition of values can be found on UCG.
Describes what kind of retag is to be performed.
See MirPhase::Runtime.
The various kinds of rvalues that can appear in MIR.
Rvalues
The various kinds of statements that can appear in MIR.
The various kinds of terminators, representing ways of exiting from a basic block.
Action to be taken when a stack unwind happens.
The reason we are terminating the process during unwinding.
Checks if the specified local
is used as the self
parameter of a method call in the provided BasicBlock
. If it is, then the DefId
of the called method is returned.
Type for MIR Assert
terminator error messages.
Types for locals
Alias for projections as they appear in places, where the base is a place and the index is a local.
Alias for projections as they appear in UserTypeProjection
, where we need neither the V
parameter for Index
nor the T
for Field
.