Skip to main content

Module mir

Module mir 

Source
Expand description

A simplified version of rust mir.

Re-exportsΒ§

use std::fmt; πŸ”’
use std::rc::Rc; πŸ”’
use flux_arc_interner::List; πŸ”’
use flux_common::index::Idx; πŸ”’
use flux_common::index::IndexVec; πŸ”’
use itertools::Itertools; πŸ”’
use rustc_borrowck::consumers::BodyWithBorrowckFacts; πŸ”’
use rustc_borrowck::consumers::BorrowData; πŸ”’
use rustc_borrowck::consumers::BorrowIndex; πŸ”’
use rustc_data_structures::fx::FxIndexMap; πŸ”’
use rustc_data_structures::graph; πŸ”’
use rustc_data_structures::graph::DirectedGraph; πŸ”’
use rustc_data_structures::graph::StartNode; πŸ”’
use rustc_data_structures::graph::dominators::Dominators; πŸ”’
use rustc_data_structures::unord::UnordMap; πŸ”’
use rustc_hir as hir; πŸ”’
use rustc_hir::def_id::DefId; πŸ”’
use rustc_index::IndexSlice; πŸ”’
use rustc_macros::TyDecodable; πŸ”’
use rustc_macros::TyEncodable; πŸ”’
use rustc_middle::mir::Promoted; πŸ”’
use rustc_middle::mir::VarDebugInfoContents; πŸ”’
use rustc_middle::mir::WithRetag; πŸ”’
use rustc_span::Span; πŸ”’
use rustc_span::Symbol; πŸ”’
use super::ty::Const; πŸ”’
use super::ty::GenericArg; πŸ”’
use super::ty::GenericArgs; πŸ”’
use super::ty::Region; πŸ”’
use super::ty::Ty; πŸ”’
use crate::def_id_to_string; πŸ”’
use crate::ty::Binder; πŸ”’
use crate::ty::FnSig; πŸ”’
use crate::ty::region_to_string; πŸ”’

StructsΒ§

BasicBlockData
Body
BodyRoot
CallArgs
ConstOperand
The representation of constants in the mir is complicated. This struct is a thin wrapper around that representation. We don’t support all constants, but we ensure that at least the type of the constant is supported. Thus, we can always fallback to give a constant an unrefined type.
Instance
An Instance is the resolved call-target at a particular trait-call-site
LocalDecl
Place
PlaceRef
Statement
Terminator
BasicBlock
A node in the MIR control-flow graph.
FieldIdx
The source-order index of a field in a variant.
Local
Location
Location represents the position of the start of the statement; or, if statement_index equals the number of statements, then the start of the terminator.
SourceInfo
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.
SwitchTargets
UserTypeAnnotationIndex
VariantIdx
The source-order index of a variant in a type.

EnumsΒ§

AggregateKind
AssertKind
BinOp
BodyKind
Selects a particular [rustc_middle::mir::Body] within a [BodyWithBorrowckFacts].
CallKind
CastKind
NonDivergingIntrinsic
Operand
PlaceElem
PointerCast
Rvalue
Corresponds to https://doc.rust-lang.org/beta/nightly-rustc/rustc_middle/mir/enum.Rvalue.html
StatementKind
TerminatorKind
BorrowKind
FakeBorrowKind
FakeReadCause
The FakeReadCause describes the type of pattern why a FakeRead statement exists.
LocalKind
Classifies locals into categories. See Body::local_kind.
RawPtrKind
UnOp
UnwindAction
Action to be taken when a stack unwind happens.
Variance

ConstantsΒ§

FIRST_VARIANT
Equivalent to VariantIdx(0).
RETURN_PLACE
START_BLOCK

FunctionsΒ§

fmt_edges πŸ”’
The outgoing edges of a terminator, as rustc prints them (see its TerminatorKind::fmt): the successors, labeled, with a cleanup block as the unwind successor and any other unwind action after them (unwind continue, …): -> [return: bb1, unwind: bb2], -> [return: bb1, unwind continue]. A single successor and nothing else is printed unlabeled: -> bb2.
mk_fake_predecessors πŸ”’
The FalseEdge/imaginary_target edges mess up the is_join_point computation which creates spurious join points that lose information e.g. in match arms, the k+1-th arm has the k-th arm as a β€œfake” predecessor so we lose the assumptions specific to the k+1-th arm due to a spurious join. This code corrects for this problem by computing the number of β€œfake” predecessors and decreasing them from the total number of β€œpredecessors” returned by rustc. The option is to recompute β€œpredecessors” from scratch but we may miss some cases there. (see also is_join_point)

Type AliasesΒ§

LocalDecls