pub struct MirFunction {
pub name: String,
pub arity: usize,
pub return_ty: Ty,
pub locals: PrimaryMap<MirLocalId, LocalInfo>,
pub params: Vec<MirLocalId>,
pub param_modes: Vec<MirOwnershipMode>,
pub entry: MirBlockId,
pub blocks: PrimaryMap<MirBlockId, MirBlock>,
}Expand description
Function-level MIR in CFG form.
paramsare function parameter locals.param_modesmirrors source ownership modes for parameters.entryis the first block reached for execution.
Fields§
§name: StringUser-visible function or field name.
arity: usizeNumber of source parameters accepted by the function.
return_ty: TySemantic return type of the function.
locals: PrimaryMap<MirLocalId, LocalInfo>Local metadata arena for function values.
params: Vec<MirLocalId>Local ids corresponding to incoming parameters.
param_modes: Vec<MirOwnershipMode>Ownership modes for each incoming parameter.
entry: MirBlockIdEntry block id for the function CFG.
blocks: PrimaryMap<MirBlockId, MirBlock>CFG blocks stored for the function.
Implementations§
Source§impl MirFunction
impl MirFunction
Sourcepub fn param_binding(&self, index: usize) -> MirParamBinding<'_>
pub fn param_binding(&self, index: usize) -> MirParamBinding<'_>
Return metadata for one parameter by index.
Sourcepub fn param_bindings(&self) -> impl Iterator<Item = MirParamBinding<'_>> + '_
pub fn param_bindings(&self) -> impl Iterator<Item = MirParamBinding<'_>> + '_
Iterate over source parameters with normalized query helpers.
Sourcepub fn local_info(&self, local_id: MirLocalId) -> &LocalInfo
pub fn local_info(&self, local_id: MirLocalId) -> &LocalInfo
Return metadata for one local.
Sourcepub fn call_arg_binding<'a>(
&'a self,
arg: &'a MirCallArg,
) -> MirCallArgBinding<'a>
pub fn call_arg_binding<'a>( &'a self, arg: &'a MirCallArg, ) -> MirCallArgBinding<'a>
Return normalized metadata for one call argument.
Sourcepub fn assert_valid(&self)
pub fn assert_valid(&self)
Assert internal MIR invariants needed by downstream backends.
Sourcefn assert_edge_args_compatible(
&self,
params: &[MirLocalId],
args: &[MirLocalId],
edge_kind: &'static str,
)
fn assert_edge_args_compatible( &self, params: &[MirLocalId], args: &[MirLocalId], edge_kind: &'static str, )
Assert that edge arguments match the target block parameter contract.
Sourcefn assert_instr_valid(&self, instr: &MirInstr)
fn assert_instr_valid(&self, instr: &MirInstr)
Assert per-instruction MIR invariants.
Sourcefn assert_call_args_valid(&self, args: &[MirCallArg])
fn assert_call_args_valid(&self, args: &[MirCallArg])
Assert call argument invariants that are backend-independent.
Trait Implementations§
Source§impl Clone for MirFunction
impl Clone for MirFunction
Source§fn clone(&self) -> MirFunction
fn clone(&self) -> MirFunction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more