Struct rustc::mir::Mir
[−]
[src]
pub struct Mir<'tcx> { pub visibility_scopes: IndexVec<VisibilityScope, VisibilityScopeData>, pub promoted: IndexVec<Promoted, Mir<'tcx>>, pub return_ty: Ty<'tcx>, pub local_decls: IndexVec<Local, LocalDecl<'tcx>>, pub arg_count: usize, pub upvar_decls: Vec<UpvarDecl>, pub spread_arg: Option<Local>, pub span: Span, // some fields omitted }
rustc_private
)Lowered representation of a single function.
Fields
visibility_scopes: IndexVec<VisibilityScope, VisibilityScopeData>
rustc_private
)List of visibility (lexical) scopes; these are referenced by statements
and used (eventually) for debuginfo. Indexed by a VisibilityScope
.
promoted: IndexVec<Promoted, Mir<'tcx>>
rustc_private
)Rvalues promoted from this function, such as borrows of constants. Each of them is the Mir of a constant with the fn's type parameters in scope, but a separate set of locals.
return_ty: Ty<'tcx>
rustc_private
)Return type of the function.
local_decls: IndexVec<Local, LocalDecl<'tcx>>
rustc_private
)Declarations of locals.
The first local is the return value pointer, followed by arg_count
locals for the function arguments, followed by any user-declared
variables and temporaries.
arg_count: usize
rustc_private
)Number of arguments this function takes.
Starting at local 1, arg_count
locals will be provided by the caller
and can be assumed to be initialized.
If this MIR was built for a constant, this will be 0.
upvar_decls: Vec<UpvarDecl>
rustc_private
)Names and capture modes of all the closure upvars, assuming the first argument is either the closure or a reference to it.
spread_arg: Option<Local>
rustc_private
)Mark an argument local (which must be a tuple) as getting passed as its individual components at the LLVM level.
This is used for the "rust-call" ABI.
span: Span
rustc_private
)A span representing this MIR, for error reporting
Methods
impl<'tcx> Mir<'tcx>
[src]
fn new(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
visibility_scopes: IndexVec<VisibilityScope, VisibilityScopeData>,
promoted: IndexVec<Promoted, Mir<'tcx>>,
return_ty: Ty<'tcx>,
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
arg_count: usize,
upvar_decls: Vec<UpvarDecl>,
span: Span)
-> Self
visibility_scopes: IndexVec<VisibilityScope, VisibilityScopeData>,
promoted: IndexVec<Promoted, Mir<'tcx>>,
return_ty: Ty<'tcx>,
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
arg_count: usize,
upvar_decls: Vec<UpvarDecl>,
span: Span)
-> Self
rustc_private
)fn basic_blocks(&self) -> &IndexVec<BasicBlock, BasicBlockData<'tcx>>
rustc_private
)fn basic_blocks_mut(&mut self)
-> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>>
-> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>>
rustc_private
)fn predecessors(&self) -> Ref<IndexVec<BasicBlock, Vec<BasicBlock>>>
rustc_private
)fn predecessors_for(&self, bb: BasicBlock) -> Ref<Vec<BasicBlock>>
rustc_private
)fn dominators(&self) -> Dominators<BasicBlock>
rustc_private
)fn local_kind(&self, local: Local) -> LocalKind
rustc_private
)fn temps_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a
rustc_private
)Returns an iterator over all temporaries.
fn vars_iter<'a>(&'a self) -> impl Iterator<Item=Local> + 'a
rustc_private
)Returns an iterator over all user-declared locals.
fn args_iter(&self) -> impl Iterator<Item=Local>
rustc_private
)Returns an iterator over all function arguments.
fn vars_and_temps_iter(&self) -> impl Iterator<Item=Local>
rustc_private
)Returns an iterator over all user-defined variables and compiler-generated temporaries (all locals that are neither arguments nor the return pointer).
fn make_statement_nop(&mut self, location: Location)
rustc_private
)Changes a statement to a nop. This is both faster than deleting instructions and avoids
invalidating statement indices in Location
s.
Trait Implementations
impl<'tcx> Clone for Mir<'tcx>
[src]
fn clone(&self) -> Mir<'tcx>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'tcx> Encodable for Mir<'tcx>
[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
deprecated in favor of rustc-serialize on crates.io
impl<'tcx> Decodable for Mir<'tcx>
[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Mir<'tcx>, __D::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
deprecated in favor of rustc-serialize on crates.io
impl<'tcx> Debug for Mir<'tcx>
[src]
impl<'tcx> Index<BasicBlock> for Mir<'tcx>
[src]
type Output = BasicBlockData<'tcx>
The returned type after indexing
fn index(&self, index: BasicBlock) -> &BasicBlockData<'tcx>
The method for the indexing (container[index]
) operation
impl<'tcx> IndexMut<BasicBlock> for Mir<'tcx>
[src]
fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx>
The method for the mutable indexing (container[index]
) operation
impl<'tcx> ControlFlowGraph for Mir<'tcx>
[src]
type Node = BasicBlock
rustc_private
)fn num_nodes(&self) -> usize
rustc_private
)fn start_node(&self) -> Self::Node
rustc_private
)fn predecessors<'graph>(&'graph self, node: Self::Node) -> Self::Iter
rustc_private
)fn successors<'graph>(&'graph self, node: Self::Node) -> Self::Iter
rustc_private
)impl<'a, 'b> GraphPredecessors<'b> for Mir<'a>
[src]
type Item = BasicBlock
rustc_private
)type Iter = IntoIter<BasicBlock>
rustc_private
)impl<'a, 'b> GraphSuccessors<'b> for Mir<'a>
[src]
type Item = BasicBlock
rustc_private
)type Iter = IntoIter<BasicBlock>
rustc_private
)impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx>
[src]
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self,
folder: &mut F)
-> Self
folder: &mut F)
-> Self
rustc_private
)fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool
rustc_private
)fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self,
folder: &mut F)
-> Self
folder: &mut F)
-> Self
rustc_private
)fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool
rustc_private
)fn has_regions_escaping_depth(&self, depth: u32) -> bool
rustc_private
)fn has_escaping_regions(&self) -> bool
rustc_private
)fn has_type_flags(&self, flags: TypeFlags) -> bool
rustc_private
)fn has_projection_types(&self) -> bool
rustc_private
)fn references_error(&self) -> bool
rustc_private
)fn has_param_types(&self) -> bool
rustc_private
)fn has_self_ty(&self) -> bool
rustc_private
)fn has_infer_types(&self) -> bool
rustc_private
)fn needs_infer(&self) -> bool
rustc_private
)fn needs_subst(&self) -> bool
rustc_private
)fn has_re_skol(&self) -> bool
rustc_private
)fn has_closure_types(&self) -> bool
rustc_private
)fn has_erasable_regions(&self) -> bool
rustc_private
)fn is_normalized_for_trans(&self) -> bool
rustc_private
)fn is_global(&self) -> bool
rustc_private
)Indicates whether this value references only 'global' types/lifetimes that are the same regardless of what fn we are in. This is used for caching. Errs on the side of returning false. Read more