Struct rustc_mir_transform::Body[−][src]

pub(crate) struct Body<'tcx> {
Show 15 fields basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>, pub phase: MirPhase, pub source: MirSource<'tcx>, pub source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>, pub generator: Option<Box<GeneratorInfo<'tcx>, Global>>, pub local_decls: IndexVec<Local, LocalDecl<'tcx>>, pub user_type_annotations: IndexVec<UserTypeAnnotationIndex, CanonicalUserTypeAnnotation<'tcx>>, pub arg_count: usize, pub spread_arg: Option<Local>, pub var_debug_info: Vec<VarDebugInfo<'tcx>, Global>, pub span: Span, pub required_consts: Vec<Constant<'tcx>, Global>, pub is_polymorphic: bool, predecessor_cache: PredecessorCache, is_cyclic: GraphIsCyclicCache,
}
Expand description

The lowered representation of a single function.

Fields

basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>

A list of basic blocks. References to basic block use a newtyped index type BasicBlock that indexes into this vector.

phase: MirPhase

Records how far through the “desugaring and optimization” process this particular MIR has traversed. This is particularly useful when inlining, since in that context we instantiate the promoted constants and add them to our promoted vector – but those promoted items have already been optimized, whereas ours have not. This field allows us to see the difference and forego optimization on the inlined promoted items.

source: MirSource<'tcx>source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>

A list of source scopes; these are referenced by statements and used for debuginfo. Indexed by a SourceScope.

generator: Option<Box<GeneratorInfo<'tcx>, Global>>local_decls: IndexVec<Local, LocalDecl<'tcx>>

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.

user_type_annotations: IndexVec<UserTypeAnnotationIndex, CanonicalUserTypeAnnotation<'tcx>>

User type annotations.

arg_count: usize

The 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.

spread_arg: Option<Local>

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.

var_debug_info: Vec<VarDebugInfo<'tcx>, Global>

Debug information pertaining to user variables, including captures.

span: Span

A span representing this MIR, for error reporting.

required_consts: Vec<Constant<'tcx>, Global>

Constants that are required to evaluate successfully for this MIR to be well-formed. We hold in this field all the constants we are not able to evaluate yet.

is_polymorphic: bool

Does this body use generic parameters. This is used for the ConstEvaluatable check.

Note that this does not actually mean that this body is not computable right now. The repeat count in the following example is polymorphic, but can still be evaluated without knowing anything about the type parameter T.

fn test<T>() {
    let _ = [0; std::mem::size_of::<*mut T>()];
}

WARNING: Do not change this flags after the MIR was originally created, even if an optimization removed the last mention of all generic params. We do not want to rely on optimizations and potentially allow things like [u8; std::mem::size_of::<T>() * 0] due to this.

predecessor_cache: PredecessorCacheis_cyclic: GraphIsCyclicCache

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 232 bytes